Jump to content

User:PerfektesChaos/js/filesMetaData/r.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/// User:PerfektesChaos/js/filesMetaData/r.js
/// 2018-08-24 PerfektesChaos@de.wikipedia
/// Fingerprint:#0#614CC173#
/// @license GPL [//www.mediawiki.org/w/COPYING](+GFDL,LGPL,CC-BY-SA)
///<nowiki>
(function(mw,$){
"use strict";
var Version=1.1,Signature="filesMetaData",FILMED={doc:"en:User:PerfektesChaos/js/"+Signature,list:false,loaded:false,using:["mediawiki.api","mediawiki.user","mediawiki.util","oojs","oojs-ui-core","oojs-ui-widgets"]},CODES={maxage:86400,site:"w:en",sign:"lib",store:"User:PerfektesChaos/js/"},PREGO={app:false,maxage:604814,signature:"preferencesGadgetOptions",site:"w:en",store:"User:PerfektesChaos/js/",sub:"/r.js"},REPOS={},GADGET;
function face(){
if(!FILMED.$body){
FILMED.$body=$("body");
FILMED.ltr=($("html").attr("dir")!=="rtl");}}
function fair(){
FILMED.list=(mw.config.get("skin")!=="minerva");
if(FILMED.list){
FILMED.using.push("jquery.tablesorter");}}
function first(){
var i,rls,s;
FILMED.signature="ext.gadget."+Signature;
if(mw.loader.getState(FILMED.signature)!=="ready"){
rls={};
rls[FILMED.signature]="ready";
mw.loader.state(rls);
s=mw.config.get("wgCanonicalSpecialPageName");
if(s==="Blankpage"){
s=mw.config.get("wgTitle");
i=s.indexOf("/");
if(i>1&&s.substr(i+1)===Signature){
FILMED.first();}}
FILMED.pub={doc:"[["+FILMED.doc+"]]",type:Signature,vsn:Version};
mw.hook(Signature+".ready").fire(FILMED.pub);}}
FILMED.fed=function(){
if(GADGET){
FILMED.finish();
}else{
FILMED.loaded=true;}
};
FILMED.finish=function(){
if(REPOS){
REPOS=false;
FILMED.vsn=Version+" * "+GADGET.vsn;
FILMED.$vsn.text(FILMED.vsn);
GADGET.$page=FILMED.$page;
GADGET.ltr=FILMED.ltr;
GADGET.list=FILMED.list;
GADGET.head.$doc=FILMED.$doc;
FILMED.$doc=false;
mw.hook(PREGO.signature+".ready").add(GADGET.first);
CODES=false;
PREGO=false;}
};
FILMED.fire=function(application){
GADGET=application;
if(FILMED.loaded){
FILMED.finish();}
};
FILMED.first=function(){
PREGO.feed();
fair();
mw.loader.load(FILMED.using);
CODES.signature=Signature+"."+CODES.sign;
mw.hook(CODES.signature+".ready").add(FILMED.fire);
CODES.feed();
mw.hook("wikipage.content").add(FILMED.furnish);
};
FILMED.furnish=function($area){
var $v=$("head"),$e=$v.find("title");
$e.remove();
$e=$("<title>");
$e.text(Signature);
$v.prepend($e);
FILMED.$page=$area;
FILMED.$page.empty();
face();
$v=FILMED.$body.find("#firstHeading,#section_0");
if(!$v.length){
$v=$("h1");}
$v.eq(0).text(Signature);
$v=$("<div>");
$v.css({"clear":"both"});
FILMED.$doc=$("<a>");
FILMED.$doc.text(Signature+"@PerfektesChaos");
FILMED.$vsn=$("<span>");
FILMED.$vsn.css({"font-size":"smaller"}).css("margin-"+(FILMED.ltr?"left":"right"),"2em").text(Version);
$v.append(FILMED.$doc,FILMED.$vsn);
FILMED.$page.append($v);
mw.loader.using(FILMED.using,FILMED.fed);
};
CODES.feed=function(){
var s="ext.gadget."+CODES.signature;
if(mw.loader.getState(s)!=="ready"){
s=CODES.store+Signature+"/"+CODES.sign+"/"+(Version<1?"d":"r")+".js";
REPOS.fire(CODES.site,s,false,{action:"raw",ctype:"text/javascript",bcache:1,maxage:(Version<1?0:CODES.maxage)});}
};
PREGO.feed=function(){
var s="ext.gadget."+PREGO.signature;
if(mw.loader.getState(s)!=="ready"){
REPOS.fire(PREGO.site,PREGO.store+PREGO.signature+PREGO.sub,false,{action:"raw",ctype:"text/javascript",bcache:1,maxage:PREGO.maxage});}
};
REPOS.fire=function(at,access,append,alter){
var source,syntax;
if(typeof REPOS.requests!=="object"){
REPOS.requests={};}
if(typeof REPOS.requests[access]!=="boolean"){
REPOS.requests[access]=true;
if(append){
source=access+append;
}else{
source=access;}
if(at){
source=REPOS.foundation(at,source,alter);
if(typeof alter==="object"&&alter&&typeof alter.ctype==="string"){
syntax=alter.ctype;}
}else{
syntax=alter;}
mw.loader.load(source,syntax);}
};
REPOS.foundation=function(at,access,alter){
var s=access,r=encodeURI(s);
if(typeof alter==="object"&&alter){
r="/w/index.php?title="+r;
if(access.substr(-3)===".js"){
alter.ctype="text/javascript";
}else if(access.substr(-4)===".css"){
alter.ctype="text/css";}
alter.action="raw";
for(s in alter){
r=r+"&"+s+"="+encodeURI(alter[s]);}
}else{
r="/wiki/"+r;}
if(typeof at==="string"&&at){
switch(at){
case "meta":
r="meta.wikimedia.org"+r;
break;
case "mw":
r="www.mediawiki.org"+r;
break;
case "w:en":
r="en.wikipedia.org"+r;
break;
default:
r=window.location.host+r;}
r="https://"+r;}
return r;
};
first();
}(window.mediaWiki,window.jQuery));
/// EOF</nowiki>filesMetaData/r.js