カレンシステム専用変換フォーム

[diary:174106]
[beforeExec]
nbsp = function(n){
var s = "";
for(var i = 0; i < n; i++) s += "\x26nbsp;";
return s;
};

encEntry = function(){
var str = echo("txt1");
str = str.replace(/\x3c\/?code[^>]*>/gm, "");
str = str.replace(/^( +)/gm, function(e0,e1){ return nbsp(e1.length); });
str = str.replace(/</g, "\x26#60;").replace(/>/g, "\x26#62;");
var o = Fid("txt2");
echo(o, str);
o.focus(); o.select();

};
clsText = function(){
var o = Fid("txt1");
echo("txt2", ""); echo(o, "");
o.focus();
};
[/beforeExec]
[cssText]
#listDisp { margin:1em; }
[/cssText]
[body]
<$$div>
<$$a href="main.html?diary=174106">カレンシステム専用変換フォーム<$$/a>
<$$/div>
<$$div id="listDisp">
<$$textarea id="txt1" cols="80" rows="8"><$$/textarea>
<$$div>
<button onclick="encEntry()">置換</button>
<button onclick="clsText()">クリア</button>
<$$/div>
<$$textarea id="txt2" cols="80" rows="8"><$$/textarea>

<$$/div>
[/body]
[exec]
document.title = "カレンシステム専用変換フォーム";
[/exec]
[/diary:174106]


■仕様書 2010 08/09 18:25 Wrote