User:PerfektesChaos/js/WikiSyntaxTextMod/rM.js

/// PerfektesChaos/js/WikiSyntaxTextMod/rM.js /// 2019-11-12 PerfektesChaos@de.wikipedia /// Fingerprint:#0#38A1CD95# /// @license:CC-by-sa/4.0 GPLv3 /// if(typeof mediaWiki!=="object"){ mw={config:false,libs:{WikiSyntaxTextMod:{debugging:false} },log:function{"use strict";} };} (function(mw){ "use strict"; var version=7.32,sign="WikiSyntaxTextMod",sub="M",rls,self,WSTM; if(typeof mw.loader==="object"){ rls={}; self="user:PerfektesChaos/"+sign+"/"+sub; rls[self]="loading"; mw.loader.state(rls);} if(typeof mw.libs[sign]!=="object"){ mw.libs[sign]={};} WSTM=mw.libs[sign]; if(typeof WSTM.main!=="object"){ WSTM.main={};} WSTM.main.vsn=version; WSTM.main.self=self; if(typeof WSTM.bb!=="object"){ WSTM.bb={};} if(typeof WSTM.debugging!=="object"){ WSTM.debugging={};} }(mw)); mw.libs.WikiSyntaxTextMod.bb.utilM=function(WSTM){ "use strict"; if(typeof(WSTM.util)!=="object"){ WSTM.util={};} if(typeof(WSTM.util.fiatObjects)!=="function"){ WSTM.util.fiatObjects=function(adult,activate,assign){ var elt,obj,s; if(typeof(adult[activate])!=="object"){ adult[activate]=(assign?assign:{});} if(assign){ obj=adult[activate]; for(s in assign){ elt=assign[s]; if(typeof(elt)==="object"){ WSTM.util.fiatObjects(obj,s,elt);}}} };} WSTM.util.fiatObjects(WSTM,"debugging",{loud:false}); }; mw.libs.WikiSyntaxTextMod.bb.utilM(mw.libs.WikiSyntaxTextMod); delete mw.libs.WikiSyntaxTextMod.bb.utilM; mw.libs.WikiSyntaxTextMod.bb.apiM=function(WSTM){ "use strict"; WSTM.util.fiatObjects(WSTM,"api",{}); WSTM.api.edit=function(arglist){ var got=this.textMod(arglist.wikitext),lapsus=(WSTM.errors.collection||WSTM.warn.failed),r=false,seed,sum; if(!got&&lapsus){ got=[arglist.wikitext,false];} if(got){ seed=false; sum=""; r={wikitext:got[0],minor:(got[1]&&WSTM.mod.lazy),summary:false,diffpage:true,lapsus:lapsus}; if(typeof(WSTM.main.less)==="boolean"){ r.minor=r.minor&&WSTM.main.less;} if(typeof(arglist.summary)==="string"){ sum=WSTM.str.trimR(arglist.summary,true);} if(WSTM.config&&typeof(WSTM.config)==="object"){ if(WSTM.config.mod&&typeof(WSTM.config.mod)==="object"){ if(typeof(WSTM.config.mod.summary)==="string"){ seed=WSTM.config.mod.summary;}}} if(typeof(seed)==="string"){ if(sum.indexOf(seed)<0){ sum=sum+" "+WSTM.str.trimL(seed,true);}} sum=WSTM.str.trim(sum,true); if(sum.length>0){ r.summary=sum;} if(r.minor){ if(WSTM.config&&typeof(WSTM.config)==="object"){ if(typeof(WSTM.config.diffPage)==="boolean"){ r.diffpage=WSTM.config.diffPage;}}}} return r; }; WSTM.api.setContext=function(article,aNS,aDB){ if(typeof(article)==="string"){ WSTM.g.wTitle=article;} if(typeof(aNS)==="number"){ WSTM.g.wNsNumber=aNS;} if(typeof(aDB)==="string"){ WSTM.g.wDBname=aDB; WSTM.g.factoryProject;} }; }; mw.libs.WikiSyntaxTextMod.bb.apiM(mw.libs.WikiSyntaxTextMod); delete mw.libs.WikiSyntaxTextMod.bb.apiM; mw.libs.WikiSyntaxTextMod.bb.errorsM=function(WSTM){ "use strict"; WSTM.util.fiatObjects(WSTM,"errors",{}); WSTM.errors.maximum=7; WSTM.errors.selector="WSTM-errors"; WSTM.errors.fashion=function(apply){ var r="\n"; if(apply[3]>1){ r=r+" ("+apply[3]+"&times;) ";} r=r+WSTM.lang.text.fetch(apply[0]); if(apply[2]){ r=r+" \n"+WSTM.str.escapeLight(apply[2]);} r=r+"\n"; return r; }; WSTM.errors.fill=function{ var l=true,n=this.collection.length,s="",e,i; n=(n>this.more?this.more:n); for(i=0;i/g,"--&gt;"); if(this.collection.length>this.more){ s=s+"\n\n"+WSTM.lang.text.fetch("_ErrorLimitMore")+" ("+this.collection.length+")\n";} this.story=this.frozen+"\n"+s+"\n-->\n"; }; WSTM.errors.filter=function{ var r=this.swap,n; if(r){ if(this.joint>0){ r=r.substr(this.joint);} n=r.indexOf("",12); if(n>0){ r=r.substr(0,n+7);} }else{ r="";} return r; }; WSTM.errors.finalize=function(append,always){ var live=false; this.story=false; if(always&&!this.collection){ this.collection=[];} if(typeof(this.collection)==="object"){ if(typeof(WSTM.config.errorlimit)==="number"){ if(WSTM.config.errorlimit>0){ this.more=WSTM.config.errorlimit; }else{ this.more=0;} }else{ this.more=this.maximum;} if(this.more||append||always){ if(typeof(mw.user)==="object"){ if(mw.user.options){ if(mw.user.options.get("uselivepreview")){ live=true;}}} if(typeof(window.jQuery)==="function"){ if(live&&append){ this.flat; }else if(!append){ if(!this.flip){ this.fill;} }else if(append||always){ this.flush(this.furnish);}}}} }; WSTM.errors.first=function{ var s; if(typeof(window.sessionStorage)==="object"){ s=window.sessionStorage.getItem(this.swift); if(typeof(s)==="string"&&s){ window.sessionStorage.setItem(this.swift,"");}} }; WSTM.errors.fixed=function{ var $e=window.jQuery("#"+WSTM.errors.selector); if($e.length){ $e.attr("style","display: none;");} }; WSTM.errors.flat=function{ var s=this.furnish,$e; s="  \n"+s; $e=this.flush(s); if($e){ $e.find("#WSTM-errors-hide").click(this.fixed); window.jQuery(mw).bind("LivePreviewDone",this.focus);} this.collection=false; }; WSTM.errors.flip=function{ var r=false,s; if(typeof(window.sessionStorage)==="object"){ this.fixing; s=window.sessionStorage.getItem(this.swift); if(typeof(s)==="string"){ s=this.flop(s); }else{ s="";} s=s+"\n"+this.starter+"\n"+this.furnish+"\n\n"; s=s.replace(/\n\n+/,"\n"); window.sessionStorage.setItem(this.swift,s); r=(window.sessionStorage.getItem(this.swift)===s);} return r; }; WSTM.errors.flop=function(adjust){ var i,j,r; if(typeof(adjust)==="string"){ r=adjust; if(adjust.length){ i=r.indexOf(this.starter); if(i>=0){ j=r.indexOf("",i+12); if(j>i){ r=r.substr(0,i)+r.substr(j+7);}} r=r.replace(/\n\n+/,"\n"); r=(r==="\n"?"":r);} }else{ r="";} return r; }; WSTM.errors.flush=function(attach){ var $div=window.jQuery(" "),$e=window.jQuery("#"+this.selector),$u=WSTM.main.focus; $e.remove; $div.attr({"class":"error remindErrorMessages-noContent", "id":this.selector}); $div.css({border:"solid 3px",padding:"3px"}); $div.html(attach); $u.before($div); return($u.length?$u:false); }; WSTM.errors.focus=function{ var o=window.jQuery("#"+WSTM.errors.selector).offset; window.scrollTo(0,o.top); }; WSTM.errors.format=function{ var re,s; if(typeof(this.story)==="string"){ s=this.story.replace(//g,"&gt;"); re=new RegExp("\n\\* ","g"); s=s.replace(re,"\n"); s="\n"+s+"\n"; re=/(\n[^<]?.*)<\/li>\n/g; s=s.replace(re,"$1\n\n"); re=/(\n.+[^>])\n/g; s=s.replace(re,"$1</li>\n</ul>\n"); s=s.replace(/\n\n/g," \n"); s="<p class='error-explanation'> "+WSTM.lang.text.fetch("_ErrorBegin"+(this.story.search(/\n\*.+\n?.*\n\*/)===-1?"1":"N"))+" "+s+"\n<p class='error-explanation'>"+WSTM.lang.text.fetch("_ErrorEpilog")+" -- WikiSyntaxTextMod (PerfektesChaos) "; if(typeof(window.jQuery)==="function"){ this.flush(s);} }else if(this.swap){ this.fixing; s=this.filter; this.flush(s); s=this.flop(this.swap); window.sessionStorage.setItem(this.swift,s); this.swap=false;} }; WSTM.errors.found=function(alert,auto,add){ var err=[alert,auto,add,1],e,i,n; if(this.collection){ n=this.collection.length; for(i=0;i<n;i++){ e=this.collection[i]; if(e[0]===alert&&e[1]===auto&&e[2]===add){ e[3]++; err[3]=e[3]; break;}} if(err[3]===1){ this.collection.push(err);} }else{ this.collection=[err];} if(WSTM.debugging){ mw.log(WSTM.debugging,".errors.found",1,err);} }; WSTM.errors.furnish=function{ var n=this.collection.length,r="",u="",e,i; n=(n>this.more?this.more:n); for(i=0;i<n;i++){ e=this.collection[i]; if(e[1]){ u=u+this.fashion(e);}} if(u){ r=WSTM.lang.text.fetch("_ErrorBeginAuto"+(this.more===1?"1":"N"))+"\n<ul>\n"+u+"\n</ul>"; u="";} for(i=0;i<n;i++){ e=this.collection[i]; if(!e[1]){ u=u+this.fashion(e);}} if(u){ r=r+"\n\n"+WSTM.lang.text.fetch("_ErrorBeginMan"+(this.more===1?"1":"N"))+"\n<ul>\n"+u+"\n</ul>";} r="<p class='error-explanation'> "+WSTM.lang.text.fetch("_ErrorBegin"+(n===1?"1":"N"))+" "+r; if(this.collection.length>this.more){ r=r+"\n\n"+WSTM.lang.text.fetch("_ErrorLimitMore")+" ("+this.collection.length+")\n";} r=r+WSTM.warn.fetch; r=r+"\n<p class='error-explanation'> -- WikiSyntaxTextMod (PerfektesChaos) "; return r; }; }; mw.libs.WikiSyntaxTextMod.bb.errorsM(mw.libs.WikiSyntaxTextMod); delete mw.libs.WikiSyntaxTextMod.bb.errorsM; mw.libs.WikiSyntaxTextMod.bb.gM=function(WSTM){ "use strict"; WSTM.util.fiatObjects(WSTM,"g",{learnt:false,re:{s:{}},s:{re:{}} }); WSTM.util.fiatObjects(WSTM,"str",{re:{} }); WSTM.str.locateEntities=false; WSTM.str.sortLang=false; WSTM.str.sortMode=false; WSTM.g.factory=function{ if(!this.learnt){ this.fetch(this.wDBname,"wgDBname"); this.fetch(this.wPageLang,"wgContentLanguage"); this.fetch(this.wNsNumber,"wgNamespaceNumber"); this.fetch(this.wTitle,"wgTitle"); if(typeof(this.wDBname)!=="string"){ this.wDBname="";} if(typeof(this.wNsNumber)!=="number"){ this.wNsNumber=0;} if(typeof(this.wTitle)!=="string"){ this.wTitle="";} this.factoryProject; this.re.ISBN=WSTM.util.isbn.factory(WSTM.mod.lock); this.re.ISBN=new RegExp(this.re.ISBN,"i"); WSTM.str.sortLang=this.projLang; this.learnt=true;} }; WSTM.g.factoryProject=function{ var project,sole; if(typeof(this.wDBname)==="string"){ sole="|commons|mediawiki|meta|"; project=this.fetchDB(this.wDBname); this.projLang=project[0]; this.projType=project[1]; this.projLone=(sole.indexOf(this.projType)>0); WSTM.hooks.fire("*"); WSTM.lang.translate.factory;} }; WSTM.g.fetchDB=function(around){ var r=["en","wikipedia"],got; if(!this.re.wmfDB){ this.re.wmfDB="^([a-z]+)(_[a-z_]+)?(wik(?:i(?:books|data|media|news|quote|source|versity|voyage)?|tionary)|mediawiki)$"; this.re.wmfDB=new RegExp(this.re.wmfDB,"");} got=this.re.wmfDB.exec(around); if(got){ r[0]=got[1]; if(got[3]!=="wiki"){ r[1]=got[3];} if(r[0].length>3){ switch(r[0]){ case "simple": break; case "commons": case "foundation": case "incubator": case "mediawiki": case "meta": case "species": case "usability": r[1]=r[0]; r[0]="en"; break;} }else{ if(typeof(got[2])==="string"){ if(got[2]){ r[0]=r[0]+"-"+got[2];}}}} return r; }; }; mw.libs.WikiSyntaxTextMod.bb.gM(mw.libs.WikiSyntaxTextMod); delete mw.libs.WikiSyntaxTextMod.bb.gM; mw.libs.WikiSyntaxTextMod.bb.hooksM=function(WSTM){ "use strict"; WSTM.util.fiatObjects(WSTM,"hooks"); WSTM.hooks.finalize=function(apply){ var i; if(apply){ if(this.endrun){ this.endrun.push(apply); }else{ this.endrun=[apply];} }else if(WSTM.hooks.endrun){ for(i=0;i<this.endrun.length;i++){ this.endrun[i];}} }; }; mw.libs.WikiSyntaxTextMod.bb.hooksM(mw.libs.WikiSyntaxTextMod); delete mw.libs.WikiSyntaxTextMod.bb.hooksM; mw.libs.WikiSyntaxTextMod.bb.langM=function(WSTM){ "use strict"; WSTM.util.fiatObjects(WSTM,"lang",{proj:{},s:{},templates:{},text:{},translate:{read:["en"],write:["en"]} }); WSTM.lang.find=function(adjust){ var r=this.fragment(adjust),s=this.trans[r]; if(s){ r=s;} return r; }; WSTM.lang.fix=function(adjust){ var r=adjust.toLowerCase,s=this.correct[r]; if(s){ r=s;} return r; }; WSTM.lang.flop=function(adjust){ var s=WSTM.str.trimL(adjust,false),got,k,r; if(!WSTM.g.re.lang){ WSTM.g.re.lang="^("+WSTM.w.link.langs+") *$"; WSTM.g.re.lang=new RegExp(WSTM.g.re.lang,"i");} got=WSTM.g.re.lang.exec(s); if(got){ r=s; got=got[1]; s=got.toLowerCase; k=got.length; if(k===2){ if(s==="wp"){ r="WP"; }else if(WSTM.util.isO_639_1(s)){ s="|"+s+"|"; if(WSTM.w.link.wiki.iwPrenatal.indexOf(s)<0){ r=false;}} }else if(k===3){ if(s==="doi"){ r=s; }else if(WSTM.w.link.projects3.indexOf(s)>=0){ r=false;} }else if(s==="simple"){ r=false; }else if(k>5){ k=s.indexOf("-"); if(k===2||k===3){ if(/^[a-z][a-z][a-z]?-[a-z][a-z][-a-z]*/.test(got)){ r=false;}}} }else{ r=s;} return r; }; WSTM.lang.forward=function{ var s; if(typeof(this.ltr)!=="boolean"){ s=":"+WSTM.g.projLang+":"; this.ltr=(WSTM.lang.chr.rtl.indexOf(s)<0);} return this.ltr; }; WSTM.lang.fragment=function(adjust){ var r=adjust.toLowerCase; if(r.length>4){ if(r.charCodeAt(2)===45){ r=r.substr(0,2);}} return r; }; WSTM.lang.text.fetch=function(access){ var e=WSTM.lang.text.trsl[access],r=false; if(typeof(e)==="object"){ if(typeof(WSTM.g.userLang)!=="string"){ WSTM.g.fetch(WSTM.g.wUserLang,"wgUserLanguage"); WSTM.g.userLang=WSTM.lang.find(WSTM.g.wUserLang);} r=e[WSTM.g.userLang]; if(typeof(r)!=="string"){ r=e.en;} }else{ r="***"+access+"***";} return r; }; WSTM.lang.translate.factory=function{ var sep="[ ,;/]+",got,i,n; this.further(WSTM.g.projLang,this.read,true); this.further(WSTM.g.wDBname,this.read,false); if(WSTM.config&&typeof(WSTM.config)==="object"){ if(WSTM.config.lang&&typeof(WSTM.config.lang)==="object"){ if(typeof(WSTM.config.lang.accept)==="string"){ got=WSTM.config.lang.accept.split(new RegExp(sep)); n=got.length; for(i=0;i<n;i++){ this.further(got[i],this.read,false);}}}} this.flush(WSTM.g.projLang,WSTM.g.wDBname); this.finish(0); }; WSTM.lang.translate.fair=function(accept,assign){ this.further(accept,this.read,false); this.finish(-1); if(assign){ WSTM.lang.write={lead:true,linklang:false};} }; WSTM.lang.translate.feed=function(adapt,access,adjust,apply,alone){ var r=adapt+adjust+"|",q=this.d[access],x=(typeof(apply)==="string"?[apply]:apply),n=x.length,i,j,m,e,s; if(q){ for(i=0;i<n;i++){ e=q[x[i]]; if(e){ if(typeof(e)==="object"){ m=e.length; }else{ e=[e]; m=1;} for(j=0;j<m;j++){ s=e[j]; if(s){ s=this.fiat(s)+"|"; if(r.indexOf("|"+s)<0){ r=r+s;}}}}}} if(alone){ r=r.substr(0,r.length-1).substr(1);} return r; }; WSTM.lang.translate.fetch=function(access){ var q=this.d[access],r=access,i,n,w; if(q){ n=this.write.length; for(i=0;i<n;i++){ w=q[this.write[i]]; if(w){ if(typeof(w)==="object"){ w=w[0];} switch(typeof(w)){ case "object": w=this.fiat(w); break; case "boolean": w=access; break;} r=w; break;}}} return r; }; WSTM.lang.translate.fiat=function(access){ var r=access,i,n; if(typeof(access)==="object"){ r=""; n=access.length; for(i=0;i<n;i++){ r=r+String.fromCharCode(access[i]);}} if(r.indexOf(" ")>0){ if(!this.reSpace){ this.reSpace=new RegExp(" ","g");} r=r+"|"+r.replace(this.reSpace,"_");} return r; }; WSTM.lang.translate.finish=function(apply){ WSTM.w.link.namespace.factory(apply,false); WSTM.w.img.factory(apply); }; WSTM.lang.translate.flush=function(able,around){ var i,n; this.write=["en"]; this.further(able,this.write,true); this.write.unshift(around.toLowerCase); n=this.write.length; for(i=0;i<n;i++){ if(WSTM.lang.chr.cjk.indexOf(":"+this.write[i]+":")>=0){ WSTM.w.chr.lang.cjk=true; break;}} }; WSTM.lang.translate.further=function(add,assign,ahead){ var s=add.toLowerCase,s2; if(s.length>4){ if(s.charCodeAt(2)===45){ s2=s.substr(0,2); if(!WSTM.util.isElement(assign,s2)){ if(ahead){ assign.unshift(s2); }else{ assign.push(s2);}}}} if(!WSTM.util.isElement(assign,s)){ if(ahead){ assign.unshift(s); }else{ assign.push(s);}} }; }; mw.libs.WikiSyntaxTextMod.bb.langM(mw.libs.WikiSyntaxTextMod); delete mw.libs.WikiSyntaxTextMod.bb.langM; mw.libs.WikiSyntaxTextMod.bb.mainM=function(WSTM){ "use strict"; WSTM.main.maxMsg=5; WSTM.main.fault=function(alert,about){ var s; if(window){ s=(about?" "+about:""); if(typeof(window.console)==="object"){ window.console.info("PerfektesChaos::WikiSyntaxTextMod"+s+"\n"+alert);} if(WSTM.main.maxMsg){ s=window.confirm(WSTM.lang.text.fetch("ERROR")+":\r\n"+alert+"\r\nPerfektesChaos/js/WikiSyntaxTextMod"+s); if(s){ WSTM.main.maxMsg--; }else{ WSTM.main.maxMsg=0;}}} }; WSTM.main.full=function{ var stuff=WSTM.main.textarea(false,false),button,perform,s,task,$field; if(typeof(WSTM.prefs.fetch)==="function"){ WSTM.prefs.fetch;} if(typeof(stuff)==="string"){ task={wikitext:stuff,summary:false}; $field=WSTM.ia.$editform.find("#wpSummary"); if($field.length){ if(WSTM.ia.$editform.find("#wpMinoredit").length){ task.summary=$field.val; }else{ $field=false;} }else{ $field=false;} perform=WSTM.api.edit(task); if(perform){ s=perform.wikitext; WSTM.errors.finalize(!perform.diffpage,perform.lapsus); if(WSTM.errors.story){ s=WSTM.errors.story+s;} if(perform.diffpage){ if(typeof(WSTM.debugging)==="object"){ if(typeof(WSTM.debugging.live)==="boolean"){ perform.diffpage=!WSTM.debugging.live; if(WSTM.debugging.live){ mw.log(WSTM.debugging,".main.full diffpage",1);}}}} WSTM.main.textarea(s,perform.diffpage); if(perform.summary&&$field){ $field.val(perform.summary);} if(perform.diffpage){ button=window.document.getElementById("wpDiff"); if(button!==null){ button.click;}}}} }; }; mw.libs.WikiSyntaxTextMod.bb.mainM(mw.libs.WikiSyntaxTextMod); delete mw.libs.WikiSyntaxTextMod.bb.mainM; mw.libs.WikiSyntaxTextMod.bb.mod=function(WSTM){ "use strict"; if(typeof(WSTM.mod)!=="object"){ WSTM.mod={"*": {comment:false,file:false,lazy:true,lenient:false,lock:false,luxury:false,plain:false,table:false,tag:false,text:false, template:false,url:false,wiki:false } };} WSTM.mod.furnish=function{ var base=this["*"],cnf,p; for(p in base){ this[p]=base[p];} if(typeof(WSTM.config)==="object"&&WSTM.config){ cnf=WSTM.config; if(typeof(cnf.mod)==="object"&&cnf.mod){ if(typeof(cnf.mod.tested)==="boolean"){ this.lenient=cnf.mod.tested;} if(typeof(cnf.mod.plain)==="object"&&WSTM.util.isArray(cnf.mod.plain)){ this.plain={name:".config.mod.plain",raw:cnf.mod.plain};} if(typeof(cnf.mod.url)==="object"&&WSTM.util.isArray(cnf.mod.url)){ p={name:".config.mod.url",raw:cnf.mod.url}; this.url=WSTM.w.link.replace.factory(p);} if(typeof(cnf.mod.wikilink)==="object"&&WSTM.util.isArray(cnf.mod.wikilink)){ p={name:".config.mod.wikilink",raw:cnf.mod.wikilink}; this.wikilink=WSTM.w.link.replace.factory(p);} if(typeof(cnf.mod.comment)==="object"&&WSTM.util.isArray(cnf.mod.comment)){ this.comment={name:".config.mod.comment",raw:cnf.mod.comment};} if(typeof(cnf.mod.template)==="object"&&cnf.mod.template){ this.template=WSTM.w.template.mod.factory(cnf.mod.template);} if(typeof(cnf.mod.table)!=="undefined"&&cnf.mod.table){ this.table=true;}} if(cnf.warn&&typeof(cnf.warn)==="object"){ WSTM.warn.furnish;}} this.luxury=(this.plain||this.template); this.lock=this.luxury; }; }; mw.libs.WikiSyntaxTextMod.bb.mod(mw.libs.WikiSyntaxTextMod); delete mw.libs.WikiSyntaxTextMod.bb.mod; mw.libs.WikiSyntaxTextMod.bb.prefsM=function(WSTM){ "use strict"; WSTM.util.fiatObjects(WSTM,"prefs",{}); WSTM.prefs.form=function{ var dialog,slang,texts; if(mw.libs[WSTM.prefs.supply]&&typeof(mw.libs[WSTM.prefs.supply])==="object"&&!WSTM.prefs.launched&&mw.libs[WSTM.prefs.supply].form&&mw.libs[WSTM.prefs.supply].form){ WSTM.prefs.launched=true; WSTM.g.fetch(WSTM.g.wUserLang,"wgUserLanguage"); slang=WSTM.lang.find(WSTM.g.wUserLang); texts=WSTM.lang.text; switch(slang){ case "als": case "bar": case "dsb": case "frr": case "gsw": case "hsb": case "ksh": case "lb": case "nds": case "pdc": case "pdt": case "pfl": case "sli": case "stq": case "vmf": slang="de"; break; case "de": break; default: slang="en";} dialog={ script:WSTM.type,support:"//"+slang+".wikipedia.org/wiki/User:PerfektesChaos/js/"+WSTM.type,suffix:texts.fetch("_PrefsDescription"),opts:[{signature:"diffPage",type:"checkbox",show:texts.fetch("_Prefs.diffPage"),val:WSTM.config.diffPage },{signature:"portlet",type:"checkbox",show:texts.fetch("_Prefs.portlet"),val:WSTM.config.portlet } ] }; mw.libs[WSTM.prefs.supply].form(dialog);} }; }; mw.libs.WikiSyntaxTextMod.bb.prefsM(mw.libs.WikiSyntaxTextMod); delete mw.libs.WikiSyntaxTextMod.bb.prefsM; mw.libs.WikiSyntaxTextMod.bb.warn=function(WSTM){ "use strict"; if(typeof(WSTM.warn)!=="object"){ WSTM.warn={};} WSTM.warn.failed=function{ return(this.detected?true:false); }; WSTM.warn.fetch=function{ var r="",e,got,i,n,scope; if(this.detected){ r=WSTM.lang.text.fetch("_WarnUserDefined")+"\n<ul>"; for(scope in this.detected){ got=this.detected[scope]; n=got.length; r=r+"\n<ul>"; for(i=0;i<n;i++){ e=got[i]; if(e[1]===1){ e=e[0]; }else{ e=""+e[1]+"&times;  "+e[0];} r=r+"<li>"+e+"</li>";} r=r+"\n</ul>";} r=r+"\n</ul>\n";} return r; }; WSTM.warn.fill=function(access,assembly){ var s=typeof(WSTM.config.warn[access]),cnf,e,i,n,re,t,tmp; if(s==="undefined"){ this[access]=false; }else{ cnf=WSTM.config.warn[access]; switch(s){ case "object": if(WSTM.util.isArray(cnf)){ tmp=[]; n=cnf.length; re=false; for(i=0;i<n;i++){ e=cnf[i]; t=(e?typeof(e):"-"); if(t==="string"||t===assembly){ tmp.push(cnf[i]); }else{ WSTM.errors.found("Invalid",false,".config.warn."+access+"["+i+"]"); re=true;}} if(re){ tmp=false;} }else{ WSTM.errors.found("Invalid",false,"Array .config.warn."+access);} break; case "string": this[access]=[cnf]; break; default: tmp=false; WSTM.errors.found("Invalid",false,".config.warn."+access);} if(tmp){ this[access]=[]; n=tmp.length; for(i=0;i<n;i++){ re=tmp[i]; if(re&&assembly==="RegExp"){ if(re.charCodeAt(0)!==94){ re="^.*"+re;} if(re.charCodeAt(re.length-1)!==36){ re=re+".*$";} re=WSTM.util.regexp.fiat(re,false,".config.warn."+access+"["+i+"]");} if(re){ this[access].push(re);}} if(!this[access].length){ delete this[access]; this[access]=false;} }else{ this[access]=false;}} }; WSTM.warn.filter=function(approve,against){ var res=this[against],got,i,n; if(res){ n=res.length; for(i=0;i<n;i++){ got=res[i].exec(approve); if(got){ this.found(against,WSTM.str.escapeLight(got[0])); break;}}} }; WSTM.warn.found=function(against,apply){ var e,g,i,n; if(!this.detected){ this.detected={};} if(!this.detected[against]){ this.detected[against]=[];} g=this.detected[against]; n=g.length; for(i=0;i<n;i++){ e=g[i]; if(e[0]===apply){ e[1]++; g=false; break;}} if(g){ g.push([apply,1]);} }; WSTM.warn.furnish=function{ var cnf=WSTM.config; if(cnf&&typeof(cnf)==="object"&&cnf.warn&&typeof(cnf.warn)==="object"){ this.fill("attribute","object"); this.fill("char","number"); this.fill("comment","string"); this.fill("entity","string"); this.fill("parserfun","string"); this.fill("plain","RegExp"); this.fill("property","string"); this.fill("tag","string"); this.fill("template","string"); this.fill("transclusion","string"); this.fill("url","RegExp"); this.fill("variable","string"); this.fill("wikilink"); if(typeof(cnf.warn.templateParamDup)==="boolean"){ this.templateParamDup=cnf.warn.templateParamDup;}} }; }; mw.libs.WikiSyntaxTextMod.bb.warn(mw.libs.WikiSyntaxTextMod); delete mw.libs.WikiSyntaxTextMod.bb.warn; (function(WSTM){ "use strict"; var sub="M",self=WSTM.main.self,version=WSTM.main.vsn,rls; if(!WSTM.main.bb){ WSTM.main.bb={};} WSTM.main.bb[sub]={load:true,vsn:version}; if(typeof WSTM.main.wait==="function"){ WSTM.main.wait(sub,version);} if(typeof mw.loader==="object"&&typeof mw.hook!=="undefined"){ rls={}; rls[self]="ready"; mw.loader.state(rls); mw.hook("WikiSyntaxTextMod/"+sub+".ready") .fire([sub,version]);} }(mw.libs.WikiSyntaxTextMod)); /// EOF WikiSyntaxTextMod/rM.js