コンテンツにスキップ
Wikipedia

MediaWiki:Gadget-JSL.js

お知らせ: 保存した後、ブラウザのキャッシュをクリアしてページを再読み込みする必要があります。

多くの WindowsLinux のブラウザ

  • Ctrl を押しながら F5 を押す。

Mac における Safari

  • Shift を押しながら、更新ボタン をクリックする。

Mac における ChromeFirefox

  • Cmd Shift を押しながら R を押す。

詳細についてはWikipedia:キャッシュを消すをご覧ください。

 // (C) Andrea Giammarchi - JSL 1.4b
 varundefined;
 function$JSL(){
 this.inArray=function(){
 vartmp=false,i=arguments[1].length;
 while(i&&!tmp)tmp=arguments[1][--i]===arguments[0];
 returntmp;
 };
 this.has=function(str){return$JSL.inArray(str,$has)};
 this.random=function(elm){
 vartmp=$JSL.$random();
 while(typeof(elm[tmp])!=="undefined")tmp=$JSL.$random();
 returntmp;
 };
 this.$random=function(){return(Math.random()*1234567890).toString()};
 this.reverse=function(str){returnstr.split("").reverse().join("")};
 this.replace=function(str){
 vartmp=str.split(""),i=tmp.length;
 while(i>0)tmp[--i]=$JSL.$replace(tmp[i]);
 returntmp.join("");
 };
 this.$replace=function(tmp){
 vari=tmp.length===1?tmp.charCodeAt(0):0;
 switch(i){
 case8:tmp="\\b";break;
 case10:tmp="\\n";break;
 case11:tmp="\\v";break;
 case12:tmp="\\f";break;
 case13:tmp="\\r";break;
 case34:tmp="\\\"";break;
 case92:tmp="\\\\";break;
 default:
 tmp=tmp.replace(/([\x00-\x07]|[\x0E-\x1F]|[\x7F-\xFF])/g,function(a,b){return"\\x"+$JSL.charCodeAt(b)}).
 replace(/([\u0100-\uFFFF])/g,function(a,b){b=$JSL.charCodeAt(b);returnb.length<4?"\\u0"+b:"\\u"+b});
 break;
 };
 returntmp;
 };
 this.charCodeAt=function(str){return$JSL.$charCodeAt(str.charCodeAt(0))};
 this.$charCodeAt=function(i){
 varstr=i.toString(16).toUpperCase();
 returnstr.length<2?"0"+str:str;
 };
 this.$toSource=function(elm){returnelm.toSource().replace(/^(\(new \w+\()([^000円]+)(\)\))$/,"2ドル")};
 this.$toInternalSource=function(elm){
 vartmp=null;
 switch(elm.constructor){
 caseBoolean:
 caseNumber:
 tmp=elm;
 break;
 caseString:
 tmp=$JSL.$toSource(elm);
 break;
 default:
 tmp=elm.toSource();
 break;
 };
 returntmp;
 };
 this.getElementsByTagName=function(scope,i,elm,str){
 vartmp=$JSL.$getElementsByTagName(scope),j=tmp.length,$tmp=[];
 while(i<j){if(tmp[i][str]===elm||elm==="*")$tmp.push($JSL.$getElementsByName(tmp[i]));++i};
 if(!$tmp.item){if(!$JSL.has("item"))$has.push("item");$tmp.item=function(tmp){returnthis[tmp]}};
 return$tmp;
 };
 this.$getElementsByTagName=function(scope){returnscope.layers||scope.all};
 this.$getElementsByName=function(elm){
 if(!elm.getElementsByTagName)elm.getElementsByTagName=document.getElementsByTagName;
 returnelm;
 };
 this.encodeURI=function(str){returnstr.replace(/"/g,"%22").replace(/\\/g,"%5C")};
 this.$encodeURI=function(str){return$JSL.$charCodeAt(str)};
 this.$encodeURIComponent=function(a,b){
 vari=b.charCodeAt(0),str=[];
 if(i<128)str.push(i);
 elseif(i<2048)str.push(0xC0+(i>>6),0x80+(i&0x3F));
 elseif(i<65536)str.push(0xE0+(i>>12),0x80+(i>>6&0x3F),0x80+(i&0x3F));
 elsestr.push(0xF0+(i>>18),0x80+(i>>12&0x3F),0x80+(i>>6&0x3F),0x80+(i&0x3F));
 return"%"+str.map($JSL.$encodeURI).join("%");
 };
 this.$decodeURIComponent=function(a,b,c,d,e){
 vari=0;
 if(e)i=parseInt(e.substr(1,2),16);
 elseif(d)i=((parseInt(d.substr(1,2),16)-0xC0)<<6)+(parseInt(d.substr(4,2),16)-0x80);
 elseif(c)i=((parseInt(c.substr(1,2),16)-0xE0)<<12)+((parseInt(c.substr(4,2),16)-0x80)<<6)+(parseInt(c.substr(7,2),16)-0x80);
 elsei=((parseInt(b.substr(1,2),16)-0xF0)<<18)+((parseInt(b.substr(4,2),16)-0x80)<<12)+((parseInt(b.substr(7,2),16)-0x80)<<6)+(parseInt(b.substr(10,2),16)-0x80);
 returnString.fromCharCode(i);
 };
 var$has=[];
 if(!Function.prototype.apply){$has[$has.length]="apply";Function.prototype.apply=function(){
 vari=arguments.length===2?arguments[1].length:0,str,tmp=[],elm=(""+this).replace(/[^\(]+/,"function");
 if(!arguments[0])arguments[0]={};
 while(i)tmp.unshift("arguments[1]["+(--i)+"]");
 do{str="__".concat($JSL.random(arguments[0]).replace(/\./,"_"),"__")}while(newRegExp(str).test(elm));
 eval("var ".concat(str,"=arguments[0];tmp=(",elm.replace(/([^$])\bthis\b([^$])/g,"1ドル".concat(str,"2ドル")),")(",tmp.join(","),")"));
 returntmp;
 }};
 if(!Function.prototype.call){$has[$has.length]="call";Function.prototype.call=function(){
 vari=arguments.length,tmp=[];
 while(i>1)tmp.unshift(arguments[--i]);
 returnthis.apply((i?arguments[0]:{}),tmp);
 }};
 if(!Array.prototype.pop){$has[$has.length]="pop";Array.prototype.pop=function(){
 vara=this.length,r=this[--a];
 if(a>=0)this.length=a;
 returnr;
 }};
 if(!Array.prototype.push){$has[$has.length]="push";Array.prototype.push=function(){
 vara=0,b=arguments.length,r=this.length;
 while(a<b)this[r++]=arguments[a++];
 returnr;
 }};
 if(!Array.prototype.shift){$has[$has.length]="shift";Array.prototype.shift=function(){
 this.reverse();
 varr=this.pop();
 this.reverse();
 returnr;
 }};
 if(!Array.prototype.splice){$has[$has.length]="splice";Array.prototype.splice=function(){
 vara,b,c,d=arguments.length,tmp=[],r=[];
 if(d>1){
 arguments[0]=parseInt(arguments[0]);
 arguments[1]=parseInt(arguments[1]);
 c=arguments[0]+arguments[1];
 for(a=0,b=this.length;a<b;a++){
 if(a<arguments[0]||a>=c){
 if(a===c&&d>2){
 for(a=2;a<d;a++)tmp.push(arguments[a]);
 a=c;
 };
 tmp.push(this[a]);
 }
 else
 r.push(this[a]);
 };
 for(a=0,b=tmp.length;a<b;a++)
 this[a]=tmp[a];
 this.length=a;
 };
 returnr;
 }};
 if(!Array.prototype.unshift){$has[$has.length]="unshift";Array.prototype.unshift=function(){
 vari=arguments.length;
 this.reverse();
 while(i>0)this.push(arguments[--i]);
 this.reverse();
 returnthis.length;
 }};
 if(!Array.prototype.indexOf){$has[$has.length]="indexOf";Array.prototype.indexOf=function(elm,i){
 varj=this.length;
 if(!i)i=0;
 if(i>=0){while(i<j){if(this[i++]===elm){
 i=i-1+j;j=i-j;
 }}}
 else
 j=this.indexOf(elm,j+i);
 returnj!==this.length?j:-1;
 }};
 if(!Array.prototype.lastIndexOf){$has[$has.length]="lastIndexOf";Array.prototype.lastIndexOf=function(elm,i){
 varj=-1;
 if(!i)i=this.length;
 if(i>=0){do{if(this[i--]===elm){
 j=i+1;i=0;
 }}while(i>0)}
 elseif(i>-this.length)
 j=this.lastIndexOf(elm,this.length+i);
 returnj;
 }};
 if(!Array.prototype.every){$has[$has.length]="every";Array.prototype.every=function(callback,elm){
 varb=false,i=0,j=this.length;
 if(!elm){while(i<j&&!b)b=!callback(this[i]||this.charAt(i),i++,this)}
 else{while(i<j&&!b)b=!callback.apply(elm,[this[i]||this.charAt(i),i++,this]);}
 return!b;
 }};
 if(!Array.prototype.filter){$has[$has.length]="filter";Array.prototype.filter=function(callback,elm){
 varr=[],i=0,j=this.length;
 if(!elm){while(i<j){if(callback(this[i],i++,this))
 r.push(this[i-1]);
 }}else{while(i<j){if(callback.apply(elm,[this[i],i++,this]))
 r.push(this[i-1]);
 }}
 returnr;
 }};
 if(!Array.prototype.forEach){$has[$has.length]="forEach";Array.prototype.forEach=function(callback,elm){
 vari=0,j=this.length;
 if(!elm){while(i<j)callback(this[i],i++,this)}
 else{while(i<j)callback.apply(elm,[this[i],i++,this]);}
 }};
 if(!Array.prototype.map){$has[$has.length]="map";Array.prototype.map=function(callback,elm){
 varr=[],i=0,j=this.length;
 if(!elm){while(i<j)r.push(callback(this[i],i++,this))}
 else{while(i<j)r.push(callback.apply(elm,[this[i],i++,this]));}
 returnr;
 }};
 if(!Array.prototype.some){$has[$has.length]="some";Array.prototype.some=function(callback,elm){
 varb=false,i=0,j=this.length;
 if(!elm){while(i<j&&!b)b=callback(this[i],i++,this)}
 else{while(i<j&&!b)b=callback.apply(elm,[this[i],i++,this]);}
 returnb;
 }};
 if(!String.prototype.lastIndexOf){if(!this.inArray("lastIndexOf",$has))$has[$has.length]="lastIndexOf";String.prototype.lastIndexOf=function(elm,i){
 varstr=$JSL.reverse(this),elm=$JSL.reverse(elm),r=str.indexOf(elm,i);
 returnr<0?r:this.length-r;
 }};
 if("aa".replace(/\w/g,function(){returnarguments[1]+" "})!=="0 1 "){$has[$has.length]="replace";String.prototype.replace=function(replace){returnfunction(reg,func){
 varr="",tmp=$JSL.random(String);
 String.prototype[tmp]=replace;
 if(func.constructor!==Function)
 r=this[tmp](reg,func);
 else{
 functiongetMatches(reg,pos,a){
 functionio(){
 vara=reg.indexOf("(",pos),b=a;
 while(a>0&&reg.charAt(--a)==="\\"){};
 pos=b!==-1?b+1:b;
 return(b-a)%2===1?1:0;
 };
 do{a+=io()}while(pos!==-1);
 returna;
 };
 function$replace(str){
 varj=str.length-1;
 while(j>0)str[--j]='"'+str[j].substr(1,str[j--].length-2)[tmp](/(\\|")/g,'\\1ドル')+'"';
 returnstr.join("");
 };
 varp=-1,i=getMatches(""+reg,0,0),args=[],$match=this.match(reg),elm=$JSL.$random()[tmp](/\./,'_AG_');
 while(this.indexOf(elm)!==-1)elm=$JSL.$random()[tmp](/\./,'_AG_');
 while(i)args[--i]=[elm,'"$',(i+1),'"',elm].join("");
 if(!args.length)r="$match[i],(p=this.indexOf($match[i++],p+1)),this";
 elser="$match[i],"+args.join(",")+",(p=this.indexOf($match[i++],p+1)),this";
 r=eval('['+$replace((elm+('"'+this[tmp](reg,'"'+elm+',func('+r+'),'+elm+'"')+'"')+elm).split(elm))[tmp](/\n/g,'\\n')[tmp](/\r/g,'\\r')+'].join("")');
 };
 deleteString.prototype[tmp];
 returnr;
 }}(String.prototype.replace)};
 if((newDate().getYear()).toString().length===4){$has[$has.length]="getYear";Date.prototype.getYear=function(){
 returnthis.getFullYear()-1900;
 }};
 };$JSL=new$JSL();
 if(typeof(encodeURI)==="undefined"){functionencodeURI(str){
 varelm=/([\x00-\x20]|[\x25|\x3C|\x3E|\x5B|\x5D|\x5E|\x60|\x7F]|[\x7B-\x7D]|[\x80-\uFFFF])/g;
 return$JSL.encodeURI(str.toString().replace(elm,$JSL.$encodeURIComponent));
 }};
 if(typeof(encodeURIComponent)==="undefined"){functionencodeURIComponent(str){
 varelm=/([\x23|\x24|\x26|\x2B|\x2C|\x2F|\x3A|\x3B|\x3D|\x3F|\x40])/g;
 return$JSL.encodeURI(encodeURI(str).replace(elm,function(a,b){return"%"+$JSL.charCodeAt(b)}));
 }};
 if(typeof(decodeURIComponent)==="undefined"){functiondecodeURIComponent(str){
 varelm=/(%F[0-9A-F]%E[0-9A-F]%[A-B][0-9A-F]%[8-9A-B][0-9A-F])|(%E[0-9A-F]%[A-B][0-9A-F]%[8-9A-B][0-9A-F])|(%[C-D][0-9A-F]%[8-9A-B][0-9A-F])|(%[0-9A-F]{2})/g;
 returnstr.toString().replace(elm,$JSL.$decodeURIComponent);
 }};
 if(typeof(decodeURI)==="undefined"){functiondecodeURI(str){
 returndecodeURIComponent(str);
 }};
 if(!document.getElementById){document.getElementById=function(elm){
 return$JSL.$getElementsByName($JSL.$getElementsByTagName(this)[elm]);
 }};
 if(!document.getElementsByTagName){document.getElementsByTagName=function(elm){
 return$JSL.getElementsByTagName(this,0,elm.toUpperCase(),"tagName");
 }};
 if(!document.getElementsByName){document.getElementsByName=function(elm){
 return$JSL.getElementsByTagName(this,0,elm,"name");
 }};
 if(typeof(XMLHttpRequest)==="undefined"){XMLHttpRequest=function(){
 vartmp=null,elm=navigator.userAgent;
 if(elm.toUpperCase().indexOf("MSIE 4")<0&&window.ActiveXObject)
 tmp=elm.indexOf("MSIE 5")<0?newActiveXObject("Msxml2.XMLHTTP"):newActiveXObject("Microsoft.XMLHTTP");
 returntmp;
 }};
 if(typeof(Error)==="undefined")Error=function(){};
 Error=function(base){returnfunction(message){
 vartmp=newbase();
 tmp.message=message||"";
 if(!tmp.fileName)
 tmp.fileName=document.location.href;
 if(!tmp.lineNumber)
 tmp.lineNumber=0;
 if(!tmp.stack)
 tmp.stack="Error()@:0\n(\""+this.message+"\")@"+tmp.fileName+":"+this.lineNumber+"\n@"+tmp.fileName+":"+this.lineNumber;
 if(!tmp.name)
 tmp.name="Error";
 returntmp;
 }}(Error);

AltStyle によって変換されたページ (->オリジナル) /