CINXE.COM
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script src="jquery-1.11.3.min.js"></script> <script src="jquery-migrate-1.2.1.min.js"></script> <script src="jquery.selection-min.js"></script> <script> var ids; // https://raw.githubusercontent.com/cjkvi/cjkvi-ids/master/ids.txt $.get("ids.txt" , function(data){ ids = data; }); function bunkai(){ var char = $('input.line').getSelection(); if(char.length != 1){ return; } var temp = ids.indexOf("\t" + char + "\t"); if(temp == -1){ return; } var temp2 = ids.indexOf("\n", temp); var temp3 = ids.substring(temp + 3, temp2); var temp4 = temp3.replace(/[\t\u2ff0-\u2fff]|\[[^\]]+\]/g, ""); $('input.line').replaceSelection(temp4, 'end'); $('input.line').focus(); } function ketugo(){ var chars = $('input.line').getSelection(); if(chars.length < 2){ return; } var temp = new RegExp("\t(.)\t.*" + chars.split("").join(".*") + ".*\n", "g"); while((res = temp.exec(ids)) !== null){ $('input.line').replaceSelection(res[1], 'end'); } $('input.line').focus(); } function henkan(){ var result = new Array(); var temp = $('input.line').val(); for(i = 0; i < temp.length; i++){ if(temp.charCodeAt(i) < 0xd800 || temp.charCodeAt(i) > 0xdfff){ var temp2 = temp.charCodeAt(i).toString(16).toLowerCase(); temp2 = "u" + ("000" + temp2).substr(temp2.length - 1, 4); result.push(temp2); } else { var temp2 = (temp.charCodeAt(i) - 0xd800) * 1024 + temp.charCodeAt(i + 1) - 0xdc00 + 0x10000; temp2 = "u" + temp2.toString(16).toLowerCase(); result.push(temp2); i++; } } $('input.ids').val(result.join("-")); $('a.jump').attr("href", "/wiki/" + result.join("-")); } function gyakuh(){ var temp = $('input.ids').val().split("-"); var result = ""; for(i = 0; i < temp.length; i++){ if(parseInt(temp[i].substr(1), 16) < 0x10000){ result += String.fromCharCode(parseInt(temp[i].substr(1), 16)); } else { var temp2 = parseInt(temp[i].substr(1), 16) - 0x10000; result += String.fromCharCode(0xd800 + Math.floor(temp2 / 1024)); result += String.fromCharCode(0xdc00 + temp2 % 1024); } } $('input.line').val(result); } </script> <style> body { line-height: 300%; } input { line-height: 130%; font-size: 200%; } .line { font-family: HanaMinA, HanaMinB; } .ids { font-size: 100%; } </style> </head> <body> <input class="line" type="text" size="60"><br> <input type="button" onclick="bunkai()" value="分解"> <input type="button" onclick="ketugo()" value="結合"> <input type="button" onclick="henkan()" value="変換"> <input type="button" onclick="gyakuh()" value="逆変"><br> <input type="button" onclick="$('input.line').replaceSelection('⿰', 'end')" value="⿰"> <input type="button" onclick="$('input.line').replaceSelection('⿱', 'end')" value="⿱"> <input type="button" onclick="$('input.line').replaceSelection('⿲', 'end')" value="⿲"> <input type="button" onclick="$('input.line').replaceSelection('⿳', 'end')" value="⿳"> <input type="button" onclick="$('input.line').replaceSelection('⿴', 'end')" value="⿴"> <input type="button" onclick="$('input.line').replaceSelection('⿵', 'end')" value="⿵"> <input type="button" onclick="$('input.line').replaceSelection('⿶', 'end')" value="⿶"> <input type="button" onclick="$('input.line').replaceSelection('⿷', 'end')" value="⿷"> <input type="button" onclick="$('input.line').replaceSelection('⿸', 'end')" value="⿸"> <input type="button" onclick="$('input.line').replaceSelection('⿹', 'end')" value="⿹"> <input type="button" onclick="$('input.line').replaceSelection('⿺', 'end')" value="⿺"> <input type="button" onclick="$('input.line').replaceSelection('⿻', 'end')" value="⿻"> <input class="ids" type="text" size="120"><br> <a class="jump" href="/">作成したIDSのページを開く</a><br> ご使用前に<a href="http://fonts.jp/hanazono/">花園フォント</a>をインストールすることをお勧めします。<br> 分解:漢字1文字を選択した場合に、IDS構成要素の漢字に分解して置き換え<br> 結合:漢字2文字以上を選択した場合に、その漢字群をその順番で含むIDSの漢字に置き換え<br> 変換:上テキストボックスの内容で、グリフウィキの名前を作成し、下テキストボックスに用意、同時にリンクも作成<br> 逆変:変換の逆<br> IDCボタン:IDCを追加 <hr> glyphwiki.org </body> </html>