Benutzer:PerfektesChaos/js/editMenusPREGO/r.js

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
/// PerfektesChaos/js/editMenusPREGO/r.js
/// 2018-12-01 PerfektesChaos@de.wikipedia
/// Fingerprint:#0#A8420217#
///<nowiki>
(function(mw){
"use strict";
var Version=1.4,Sign="editMenus",Sub="Prego",Support="Wikipedia:Technik/Skin/Gadgets/"+Sign,EDIT={learnt:false,lower:false,mini:1,singles:"",standard:"Standard"},PREGO={app:false,live:false,maxage:604815,order:{selector:Sign+"-order",style:"font-size:85%;"+"font-style:italic;",suggest:"",$suggest:false},pars:[["learnt","boolean"],["mini","number"],["singles","string"]],signature:"preferencesGadgetOptions",site:"w:en",store:"User:PerfektesChaos/js/",sub:"/r.js"},REPOS={};
PREGO.texts={
"^show":{"de":Sign},
"^suffix":{"de":"&#8211; Sonderzeichenleiste usw."},
"^^learnt":{"de":"Direktverlinkung mit der Projektseite nicht mehr anzeigen"},
"^^mini":{"de":"Minimieren für die jeweilige Seite"},
"^^lower":{"de":"HTML-Generation unterdrücken (vor allem für nicht angemeldete Benutzer)"},
"^^mini0":{"de":"Nicht anbieten"},
"^^mini1":{"de":"Eingeblendet beginnen"},
"^^mini2":{"de":"Ausgeblendet beginnen"},
"^^singles":{"de":"Bevorzugte Sprachen, durch Leerzeichen getrennt (wichtigste zuerst)"}
};
EDIT.fire=function(app){
var i,got,hide,options,s,top;
if(typeof app==="object"&&app&&typeof app.fire==="function"){
if(EDIT.lower){
options=false;
}else{
if(EDIT.singles){
got=EDIT.singles.split(" ");
if(got.length){
top=[EDIT.standard];
for(i=0;i<got.length;i++){
s=got[i];
if(s){
top.unshift(s);}}}}
if(EDIT.mini){
hide={less:(EDIT.mini>1)};
}else{
hide=false;}
options={hide:hide,top:top};
if(EDIT.learnt){
options.help=false;}}
app.fire(options);}
};
EDIT.fired=function(access){
var i,got,hide,options,s,top;
if(typeof access==="function"){
if(EDIT.lower){
options=false;
}else{
if(EDIT.singles){
got=EDIT.singles.split(" ");
if(got.length){
top=[EDIT.standard];
for(i=0;i<got.length;i++){
s=got[i];
if(s){
top.unshift(s);}}}}
if(EDIT.mini){
hide={less:(EDIT.mini>1)};
}else{
hide=false;}
options={hide:hide,top:top};
if(EDIT.learnt){
options.help=false;}}
access(options);}
};
PREGO.features=function(applied){
var i,n,s,v;
if(typeof applied==="object"&&applied){
n=PREGO.pars.length;
for(i=0;i<n;i++){
v=PREGO.pars[i];
s=v[0];
if(typeof applied[s]===v[1]){
EDIT[s]=applied[s];}}}
if(PREGO.live){
PREGO.form(EDIT);
}else{
mw.hook("editMenus.completed").add(EDIT.fire);
mw.hook("editMenusPrego.options").add(EDIT.fired);}
};
PREGO.feed=function(){
var sign="ext.gadget."+PREGO.signature,rls;
if(!mw.loader.getState(sign)){
rls={};
rls[sign]="loading";
mw.loader.state(rls);
REPOS.fire(PREGO.site,PREGO.store+PREGO.signature+PREGO.sub,false,{action:"raw",ctype:"text/javascript",bcache:1,maxage:PREGO.maxage});}
};
PREGO.first=function(application){
PREGO.app=application;
mw.hook(PREGO.signature+".fetch").fire(Sign,PREGO.features);
if(PREGO.live){
mw.hook("editMenusDef.sprachen").add(PREGO.order.fed);}
};
PREGO.form=function(apply){
var opts=[],dialog;
opts.push({signature:"singles",type:"text",show:PREGO.texts["^^singles"],minimum:100,val:PREGO.order.fiat(apply.singles),field:PREGO.order.field},{signature:"sprachen",type:"html",source:"<div id='"+PREGO.order.selector+"' style='"+PREGO.order.style+"'></div>"},{signature:"mini",type:"radio",show:PREGO.texts["^^mini"],val:(apply.mini?apply.mini:0),poly:[{val:0,show:PREGO.texts["^^mini0"]},{val:1,show:PREGO.texts["^^mini1"]},{val:2,show:PREGO.texts["^^mini2"]}
]},{signature:"learnt",type:"checkbox",show:PREGO.texts["^^learnt"],val:apply.learnt},{signature:"lower",type:"checkbox",show:PREGO.texts["^^lower"],val:apply.lower});
dialog={script:Sign,show:PREGO.texts["^show"],support:"//de.wikipedia.org/wiki/"+Support,suffix:PREGO.texts["^suffix"],opts:opts,fiat:PREGO.order.form};
if(typeof PREGO.app.form==="function"){
PREGO.app.form(dialog);}
};
PREGO.order.fed=function(aliens){
var e,i;
if(typeof aliens==="object"&&aliens&&typeof aliens.length==="number"&&aliens.length){
PREGO.order.suggest="";
for(i=0;i<aliens.length;i++){
e=aliens[i];
if(typeof e==="object"&&e&&typeof e.length==="number"&&e.length>1){
e=e[0];
if(typeof e==="string"&&e){
if(PREGO.order.suggest){
PREGO.order.suggest=PREGO.order.suggest+" ";}
PREGO.order.suggest=PREGO.order.suggest+e;}}}
if(PREGO.order.$suggest&&PREGO.order.suggest){
PREGO.order.$suggest.text(PREGO.order.suggest);}}
};
PREGO.order.fiat=function(apply){
var got,r;
if(PREGO.order.$input){
r=PREGO.order.$input.val();
}else{
r=apply;}
if(typeof PREGO.reWScollapse!=="object"){
PREGO.reWScollapse=new RegExp("\\s+","g");}
r=r.replace(PREGO.reWScollapse," ");
got=r.split(" ");
if(got.length){
r=got.join("  ")+" ";
}else{
r="";}
if(PREGO.order.$input){
PREGO.order.$input.val(r);}
return r;
};
PREGO.order.field=function($applying){
PREGO.order.$input=$applying;
PREGO.order.$input.change(PREGO.order.fiat);
};
PREGO.order.form=function(){
PREGO.order.$suggest=this.$pop.find("#"+PREGO.order.selector);
if(PREGO.order.suggest){
PREGO.order.$suggest.text(PREGO.order.suggest);}
};
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;
};
function fire(){
var signature="ext.gadget."+Sign+"."+Sub,rls,special;
if(mw.loader.getState(signature)!=="ready"){
rls={};
rls[signature]="ready";
mw.loader.state(rls);
special=mw.config.get("wgCanonicalSpecialPageName");
if(special==="Blankpage"){
special=mw.config.get("wgTitle");
signature="/"+PREGO.signature;
PREGO.live=(special.indexOf(signature)>1);}
PREGO.feed();
mw.hook(PREGO.signature+".ready").add(PREGO.first);}}
fire();
}(window.mediaWiki,window.jQuery));
/// EOF</nowiki>editMenusPREGO/r.js