@@ -0,0 +1,83 @@ | |||
var car; | |||
function transcrire() { | |||
car = document.conversion.saisie.value.toLowerCase(); | |||
car = car.replace(/a1/g, "ā"); | |||
car = car.replace(/a2/g, "á"); | |||
car = car.replace(/a3/g, "ǎ"); | |||
car = car.replace(/a4/g, "à"); | |||
car = car.replace(/e1/g, "ē"); | |||
car = car.replace(/e2/g, "é"); | |||
car = car.replace(/e3/g, "ě"); | |||
car = car.replace(/e4/g, "è"); | |||
car = car.replace(/i1/g, "ī"); | |||
car = car.replace(/i2/g, "í"); | |||
car = car.replace(/i3/g, "ǐ"); | |||
car = car.replace(/i4/g, "ì"); | |||
car = car.replace(/o1/g, "ō"); | |||
car = car.replace(/o2/g, "ó"); | |||
car = car.replace(/o3/g, "ǒ"); | |||
car = car.replace(/o4/g, "ò"); | |||
car = car.replace(/u1/g, "ū"); | |||
car = car.replace(/u2/g, "ú"); | |||
car = car.replace(/u3/g, "ǔ"); | |||
car = car.replace(/u4/g, "ù"); | |||
car = car.replace(/ü1/g, "ǖ"); | |||
car = car.replace(/ü2/g, "ǘ"); | |||
car = car.replace(/ü3/g, "ǚ"); | |||
car = car.replace(/ü4/g, "ǜ"); | |||
car = car.replace(/an1/g, "ān"); | |||
car = car.replace(/an2/g, "án"); | |||
car = car.replace(/an3/g, "ǎn"); | |||
car = car.replace(/an4/g, "àn"); | |||
car = car.replace(/ang1/g, "āng"); | |||
car = car.replace(/ang2/g, "áng"); | |||
car = car.replace(/ang3/g, "ǎng"); | |||
car = car.replace(/ang4/g, "àng"); | |||
car = car.replace(/en1/g, "ēn"); | |||
car = car.replace(/en2/g, "én"); | |||
car = car.replace(/en3/g, "ěn"); | |||
car = car.replace(/en4/g, "èn"); | |||
car = car.replace(/eng1/g, "ēng"); | |||
car = car.replace(/eng2/g, "éng"); | |||
car = car.replace(/eng3/g, "ěng"); | |||
car = car.replace(/eng4/g, "èng"); | |||
car = car.replace(/in1/g, "īn"); | |||
car = car.replace(/in2/g, "ín"); | |||
car = car.replace(/in3/g, "ǐn"); | |||
car = car.replace(/in4/g, "ìn"); | |||
car = car.replace(/ing1/g, "īng"); | |||
car = car.replace(/ing2/g, "íng"); | |||
car = car.replace(/ing3/g, "ǐng"); | |||
car = car.replace(/ing4/g, "ìng"); | |||
car = car.replace(/ong1/g, "ōng"); | |||
car = car.replace(/ong2/g, "óng"); | |||
car = car.replace(/ong3/g, "ǒng"); | |||
car = car.replace(/ong4/g, "òng"); | |||
car = car.replace(/un1/g, "ūn"); | |||
car = car.replace(/un2/g, "ún"); | |||
car = car.replace(/un3/g, "ǔn"); | |||
car = car.replace(/un4/g, "ùn"); | |||
car = car.replace(/er2/g, "ér"); | |||
car = car.replace(/er3/g, "ěr"); | |||
car = car.replace(/er4/g, "èr"); | |||
car = car.replace(/aō/g, "āo"); | |||
car = car.replace(/aó/g, "áo"); | |||
car = car.replace(/aǒ/g, "ǎo"); | |||
car = car.replace(/aò/g, "ào"); | |||
car = car.replace(/oū/g, "ōu"); | |||
car = car.replace(/oú/g, "óu"); | |||
car = car.replace(/oǔ/g, "ǒu"); | |||
car = car.replace(/où/g, "òu"); | |||
car = car.replace(/aī/g, "āi"); | |||
car = car.replace(/aí/g, "ái"); | |||
car = car.replace(/aǐ/g, "ǎi"); | |||
car = car.replace(/aì/g, "ài"); | |||
car = car.replace(/eī/g, "ēi"); | |||
car = car.replace(/eí/g, "éi"); | |||
car = car.replace(/eǐ/g, "ěi"); | |||
car = car.replace(/eī/g, "èi"); | |||
document.conversion.saisie.value=car; | |||
var obj=document.conversion.saisie; | |||
obj.focus(); | |||
obj.scrollTop=obj.scrollHeight; | |||
} |
@@ -0,0 +1,41 @@ | |||
function alpha(item) { | |||
var input = document.conversion.saisie; | |||
if (document.selection) { | |||
input.focus(); | |||
range = document.selection.createRange() ; | |||
range.text = item ; | |||
range.select(); | |||
} | |||
else if (input.selectionStart || input.selectionStart == '0') { | |||
var startPos = input.selectionStart; | |||
var endPos = input.selectionEnd; | |||
var cursorPos = startPos; | |||
var scrollTop = input.scrollTop; | |||
var baselength = 0; | |||
input.value = input.value.substring(0, startPos) | |||
+ item | |||
+ input.value.substring(endPos, input.value.length); | |||
cursorPos += item.length; | |||
input.focus(); | |||
input.selectionStart = cursorPos; | |||
input.selectionEnd = cursorPos; | |||
input.scrollTop = scrollTop; | |||
} | |||
else { | |||
input.value += item; | |||
input.focus(); | |||
} | |||
} | |||
function copy() { | |||
textRange=document.conversion.saisie.createTextRange(); | |||
textRange.execCommand("Copy"); | |||
textRange=""; | |||
} | |||
var car; | |||
function annuler () { | |||
car = document.conversion.saisie.value; | |||
car=car.replace(/\u200b/g, ""); | |||
document.conversion.saisie.value=car; | |||
} |
@@ -0,0 +1,98 @@ | |||
<!DOCTYPE html> | |||
<html lang="fr"> | |||
<head> | |||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |||
<title>Pinyin</title> | |||
<meta name="Description" content="Clavier en ligne pour écrire les caractères pinyin du chinois"> | |||
<meta name="Keywords" content="chinois,pinyin,clavier,alphabet,latin"> | |||
<meta name="viewport" content="width=device-width"> | |||
<meta name="author" content="Heuze Florent" /> | |||
<meta property="og:locale" content="fr_FR" /> | |||
<meta property="og:type" content="website"/> | |||
<meta property="og:url" content="http://www.heuzef.com/"/> | |||
<meta property="og:site_name" content="Heuzef"/> | |||
<meta property="og:image" content="http://heuzef.com/images/logo_heuzef_hd.png"/> | |||
<meta property="og:image:type" content="image/png" /> | |||
<meta property="og:image:width" content="2153" /> | |||
<meta property="og:image:height" content="640" /> | |||
<meta property="og:title" content="Heuzef - Heuze Florent"/> | |||
<meta name="twitter:card" content="summary"> | |||
<meta name="twitter:site" content="@heuzef"/> | |||
<meta name="twitter:creator" content="@heuzef"/> | |||
<link rel="shortcut icon" href="http://heuzef.com/favicon.png"> | |||
<link href="./bootstrap.min.css" rel="stylesheet" type="text/css"> | |||
<link href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css"> | |||
<script type="text/javascript" src="./comlat.js"></script> | |||
<script type="text/javascript" src="./carch.js"></script> | |||
</head> | |||
<body onload="conversion.saisie.focus()"> | |||
<div align="center"> | |||
<noscript> | |||
&lt;font color="red"&gt;Attention ! &amp;nbsp; JavaScript n'est pas activ&amp;eacute;.&lt;/font&gt;&lt;br&gt; | |||
Vous devez activer JavaScript dans votre navigateur, veuillez suivre les &lt;a class="ext" href="http://www.enable-javascript.com/fr/" target="_blank"&gt;instructions&lt;/a&gt;.&lt;p&gt; | |||
</noscript> | |||
<br> | |||
<form name="conversion" class="form-horizontal"> | |||
<div> | |||
<h1><a href="https://github.com/heuzef/pinyin" target="_blank">Pinyin</a></h1> | |||
<div class="col-lg-3"> | |||
<a href="http://localhost/pinyin/#" class="btn btn-primary" onclick="conversion.saisie.select();copy()"><i class="ion-document-text"> </i>Séléctionner tout</a> | |||
<br><br> | |||
<p class="text-primary"><i class="ion-scissors"></i> Couper [Ctrl]+[X] / <i class="ion-ios-copy"></i> Coller [Ctrl]+[V]</p> | |||
<hr> | |||
<h5>Mode d'emploi</h5> | |||
<p> | |||
Redigez votre mot, puis indiquez le chiffre correspondant au ton. | |||
</p><p> | |||
</p><p class="text-primary">zhong<span class="text-danger">1</span> wen<span class="text-danger">2</span> <i class="ion-arrow-right-c"></i> zh<span class="text-danger">ō</span>ng w<span class="text-danger">é</span>n</p><p> | |||
</p><p class="text-primary">ni<span class="text-danger">3</span> hao<span class="text-danger">3</span> ma<span class="text-danger">1</span> <i class="ion-arrow-right-c"></i> n<span class="text-danger">ǐ</span> h<span class="text-danger">ǎ</span>o m<span class="text-danger">ā</span></p><p> | |||
</p></div> | |||
<div class="col-lg-6"> | |||
<textarea name="saisie" onkeyup="transcrire()" class="form-control" rows="10" id="textArea"></textarea> | |||
<a href="https://fr.wikipedia.org/wiki/Hanyu_pinyin" target="_blank"><img src="./4_tons.png" alt="Les 4 tons chinois"></a> | |||
</div> | |||
<div class="col-lg-3"> | |||
<div class="btn-group"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ā')" value="ā"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ē')" value="ē"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ī')" value="ī"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ō')" value="ō"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ū')" value="ū"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ǖ')" value="ǖ"> | |||
</div> | |||
<hr> | |||
<div class="btn-group"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('á')" value="á"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('é')" value="é"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('í')" value="í"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ó')" value="ó"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ú')" value="ú"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ǘ')" value="ǘ"> | |||
</div> | |||
<hr> | |||
<div class="btn-group"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ǎ')" value="ǎ"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ě')" value="ě"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ǐ')" value="ǐ"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ǒ')" value="ǒ"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ǔ')" value="ǔ"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ǚ')" value="ǚ"> | |||
</div> | |||
<hr> | |||
<div class="btn-group"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('à')" value="à"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('è')" value="è"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ì')" value="ì"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ò')" value="ò"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ù')" value="ù"> | |||
<input type="button" class="btn btn-primary" onclick="alpha('ǜ')" value="ǜ"> | |||
</div> | |||
</div> | |||
</div> | |||
<br> | |||
<br> | |||
<br> | |||
</form> | |||
</div> | |||
</body> | |||
</html> |