汎用サブルーチン集No.1
[beforeExec]

calenSystem = function(){
alert(this.toString());
/*
this.req = Freq();
this.req.onreadystatechange = this.reqEntry;
this.reqEntry.obj = this;
this.req.open("GET", "/cgi-bin/diary.cgi?oid=all", true);
this.req.send(null);
*/
};

calenSystem.prototype = {
reqEntry : function(){
if(this.obj.req.readyState == 4){
if(this.obj.status == 200){
alert(this.obj.resposeText);
}
}
}

};


sub1 = function(){
Fn1 = new calenSystem();


};



Fx.sp = function(s){ return s.replace(/^\s+|\s+$/g, ""); };
Fx.show = function(o,func){
var a,b,p = o.parentNode;
var a = p.getElementsByTagName("div");
if(a.length){
p.removeChild(a[0]);
b = p.getElementsByTagName("span");
if(b.length) p.removeChild(b[0]);
} else {
a = Fap(p, Fce("div"));
Fx.act = a;
a.className = "num";
if(func != "show" && func != "entry"){
Fx[func]();
} else {
a.innerHTML = "取得するものはありません。";
}
}
};
Fx.showSource = function(o,func){
var p = o.parentNode;
var a = p.getElementsByTagName("textarea");
if(a.length){
p.removeChild(a[0]);
} else {
a = Fap(p, Fce("textarea"));
a.className = "text";
a.value = "Fx." + func + " = " + Fx[func];
}
};

Fx.getNewArticleByAll = function(){
Fx.ent = function(){if(Fx.str.match(/n=0;s=(\d+)/)) Fx.act.innerHTML = " ⇒ " + RegExp.$1;};
Fx.uri = "/cgi-bin/diary.cgi?oid=all;n=0";
Fget();
};
Fx.getUserByAll = function(){
Fx.ent = function(){
Fx.temp = Fx.str.match(/"\/home\/([a-z0-9\-]+)\/"/g);
Fx.ent = function(){
var a = Fx.str.match(/"\/home\/([a-z0-9\-]+)\/"/g);
var b = Fx.temp.concat(a);
b.sort();
a = " " + b.join(" ").replace(/("|\/home\/|\/)/g, "");
a = a.replace(/(\s[a-z0-9\-]+)(\1{1,})/g, function(e0,e1,e2){
return e1 + "(" + (Fx.sp(e2).split(" ").length + 1) + ")";});
Fx.act.innerHTML = a;
};
if(Fx.str.match(/(http:.+?s=\d+)/)){
Fx.uri = RegExp.$1;
Fget();
}
};
Fx.uri = "/cgi-bin/diary.cgi?oid=all;n=100";
Fget();
};


Fx.getArticleTitle = function(n){
var o = Fx.act.parentNode;
var a = o.insertBefore(Fce("span"), Ftag(o, "a")[0].nextSibling);
Fx.ent = function(){
if(Fx.str.match(/name="article_title" value="(.+?)"/)) Fap(Fx.act, Fctn(RegExp.$1 + " "));
else Fap(Fx.act, Fctn("※削除されています"));
Fap(Fx.act, Fce("br"));
Fx.cnt--; Fx.num--;
Fx.uri = "/cgi-bin/diary_form.cgi?oid=nancyan&mode=edit&article_id=" + Fx.num;
Ftag(Fx.act.parentNode, "span")[0].innerHTML = (100 - Fx.cnt) + "/1000 <" + "a href='javascript:void(0);' onclick='Fx.fg=false;'>stop<" + "/a>";
if(Fx.cnt > 0 && Fx.fg) Fget();
};
if(n == null) n = 152535;
Fx.cnt = 1000;
Fx.num = n;
Fx.fg = true;
Fx.uri = "/cgi-bin/diary_form.cgi?oid=nancyan&mode=edit&article_id=" + n;
Fget();
};

Fx.entry = function(){
var str = Fx.dec(key(Fx.str, "data"));
str = str.replace(/([a-zA-Z0-9_]+)(\s.+)/g, "\x3cdiv>■Fx.\x3ca href='#' onclick='Fx.show(this,\"$1\"); return false;'>$1$2\x3c/a> | \x3ca href='#' onclick='Fx.showSource(this,\"$1\"); return false;'>ソース\x3c/a>\x3c/div>");
Fid("disp").innerHTML = str;
};


[/beforeExec]

[cssText]
#disp { color:blue; }
div.num { color:darkgreen; font-family:Verdana;}
textarea.text { width:80%; height:100px; background-color:#ffefff; color:#000;
border:none; display:block;
}

[/cssText]

[body]
汎用サブルーチン集No.1
<$$hr size="1" noshade="noshade" />
<$$div id="disp"><$$/div>
<$$hr size="1" noshade="noshade" />
<$$a href="javascript:void(0)" onclick="sub1()">新しい構造の検証<$$/a>

[/body]
[exec]
document.title = "汎用サブルーチン集No.1";
Fx.entry();
[/exec]
[data]
entry このページのエントリ
show サブルーチン集のコール
getNewArticleByAll 新着日記にて最新の記事番号を得る
getUserByAll 新着日記の200件にある全てのユーザ名を得る
getArticleTitle 引数の番号のタイトルを得る
[/data]