User:PerfektesChaos/js/idResolver/r.js

/// User:PerfektesChaos/js/idResolver/r.js /// 2018-09-04 PerfektesChaos@de.wikipedia /// Documentation:w:en:User:PerfektesChaos/js/idResolver /// Fingerprint:#0#15A8C37B# /// @license GPL [//www.mediawiki.org/w/COPYING](+GFDL,LGPL,CC-BY-SA) /// (function(mw,$){ "use strict"; var VERSION=1.7,IDA="idResolver",IDEA={load:true,sub:"/core",type:IDA}; if(typeof mw.libs[IDA]!=="object"||!mw.libs[IDA]){ mw.libs[IDA]={};} IDA=mw.libs[IDA]; if(typeof IDA.vsn==="string"){ IDA.vsn="*"+VERSION+" "+IDA.vsn; }else{ IDA.vsn=""+VERSION;} IDA.type=IDEA.type; IDA.signature="ext.gadget."+IDA.type; IDA.support="User:PerfektesChaos/js/"+IDA.type; IDA.doc=""+IDA.support+""; function facilitate(activate){ activate(IDA,IDEA.cfg);} function faculty(after){ after(IDEA.prego,IDEA.cfg);} function features(assign){ var part,s; for(s in assign){ if(s==="rooms"){ if(typeof assign.rooms==="object"){ part=assign.rooms; if(part&&typeof part.length==="number"&&part.length){ IDEA.rooms=part;}} }else if(s==="types"){ if(typeof assign.types==="object"&&assign.types){ IDEA.cfg.types=assign.types;} }else if(typeof IDEA.pars[s]==="undefined"){ IDEA.cfg[s]=assign[s]; }else if(typeof assign[s]===IDEA.pars[s]){ IDEA.opt[s]=assign[s];}}} function featuring(auxilary){ var i,s,v,vals; IDEA.cfg={make:0}; IDEA.opt={spaces:false}; IDEA.pars={launch:"boolean",layer:"boolean",lazy:"boolean",light:"boolean",linking:"boolean",lock:"boolean",make:"number",seen:"string",spaces:"string",debug:"boolean"}; for(s in IDEA.pars){ IDEA.opt[s]=false;} if(typeof IDA.opt==="object"&&IDA.opt){ features(IDA.opt);} mw.hook(IDA.type+".before").add(features); if(typeof auxilary==="object"&&auxilary){ if(typeof auxilary.fetch==="function"){ vals=auxilary.fetch(IDA.type); if(vals&&typeof vals==="object"){ for(s in IDEA.pars){ if(typeof vals[s]===IDEA.pars[s]){ IDEA.opt[s]=vals[s];}} if(IDEA.opt.spaces){ if(typeof IDEA.rooms!=="object"){ IDEA.rooms=[];} vals=IDEA.opt.spaces.split(" "); for(i=0;i=0){ IDEA.cfg.make=Math.floor(IDEA.opt.make);} return IDEA.opt.launch;} function feed(assigned,access,after,age){ var maxage,rls; if(!mw.loader.getState(assigned)){ rls={}; rls[assigned]="loading"; mw.loader.state(rls); if(typeof IDEA.level!=="boolean"){ IDEA.level=(VERSION>0); if(IDEA.level&&typeof IDEA.opt==="object"&&IDEA.opt&&typeof IDEA.opt.debug==="boolean"&&IDEA.opt.debug){ IDEA.level=false;}} maxage=(age?age:(IDEA.level?86400:1000)); mw.loader.load("https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/"+access+"/"+(IDEA.level?"r":"d")+".js&bcache=1&maxage="+maxage+"&action=raw&ctype=text/javascript","text/javascript");} if(after){ mw.hook(access+".ready").add(after);}} function fetch(activity){ if(typeof activity==="object"&&activity){ if(typeof activity.preventDefault==="function"){ activity.preventDefault;} if(typeof activity.stopPropagation==="function"){ activity.stopPropagation;}} if(IDEA.load){ IDEA.load=false; feed(IDA.signature+IDEA.sub,IDA.type+IDEA.sub,facilitate);}} function figure(auxilary){ IDEA.prego=auxilary; featuring(auxilary); mw.hook(IDA.type+"/prego.ready").add(faculty);} function fill{ var portlet=mw.util.addPortletLink("p-tb","#",IDA.type,"t-"+IDA.type),$portlet=$(portlet); $portlet.click(fetch); $portlet.attr({title:IDA.type+" "+IDA.vsn});} function filter(auxilary){ var env=mw.config.get(["wgTitle","wgUserName","wgWikibaseItemId"]),launch=featuring(auxilary); if(!launch){ switch(IDEA.nsn){ case 0: launch=true; break; case 2: launch=(!env.wgTitle.indexOf(env.wgUserName+"/")); break; case 4: if(typeof env.wgWikibaseItemId==="string"&&env.wgWikibaseItemId.toUpperCase==="Q3938"){ launch=true;} break;}} if(!launch&&IDEA.rooms&&$.inArray(IDEA.nsn,IDEA.rooms)>=0){ launch=true;} if(launch){ if(IDEA.lazy){ mw.loader.using(["mediawiki.util"],function{ $(fill); }); }else if(!IDEA.lock){ fetch; }else{ mw.hook(IDA.type+".fire").fire(fetch);}}} function fire{ var callback,env,rls,scope; if(mw.loader.getState(IDA.signature)!=="ready"){ rls={}; rls[IDA.signature]="ready"; mw.loader.state(rls); env=mw.config.get(["wgAction","wgCanonicalSpecialPageName","wgNamespaceNumber","wgPageContentModel"]); scope="|view|submit|edit|"; if(env.wgNamespaceNumber<0){ if(env.wgCanonicalSpecialPageName==="Blankpage"){ feed(IDA.signature+"/prego",IDA.type+"/prego",false); callback=figure;} }else if(scope.indexOf(env.wgAction)>0&&env.wgPageContentModel==="wikitext"){ IDEA.nsn=env.wgNamespaceNumber; callback=filter;} if(callback){ feed("ext.gadget.preferencesGadgetOptions","preferencesGadgetOptions",callback,86410);}}} fire; }(window.mediaWiki,window.jQuery)); /// EOF idResolver/r.js