User:PerfektesChaos/js/refNames/core/r.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
This user script seems to have a documentation page at User:PerfektesChaos/js/refNames/core/r. |
/// User:PerfektesChaos/js/refNames/core/r.js
/// 2023-05-01 PerfektesChaos@de.wikipedia
/// Fingerprint:#0#A8D94BCE#
/// License:CC-by-sa/4.0
///<nowiki>
mw.hook("refNames.config").fire({trigger:[0],rooms:[0,2,4,100],warn:["^q\\d+$","^ref\\d+$"]});
(function(mw,$){
"use strict";
var Version=1.5,Signature="refNames",THIS={lapsus:false,launch:false,reUscore:false,show:"<ref>",sub:"core",using:["mediawiki.api","mediawiki.storage"],warn:["^:?\\d+$","^:$","^Reference[A-Z]$","^auto(?:generated)?\\d*$",String.fromCharCode(0x5B,0x09,0x0A,0x22,0x23,0x25,0x26,0x27,0x3C,0x3E,0x5B,0x5C,0x5D,0x60,0xA0,0xAD,0xB4,0x02C6,0x02DC,0x2002,0x2003,0x2009,0x200A,0x200B,0x200C,0x200D,0x200E,0x200F,0x2018,0x2019,0x201A,0x201C,0x201D,0x201E,0x202F,0x2032,0x2033,0x2039,0x203A,0x5D)],$widget:false
},PARSER={reQuot:false,reWS:false,pending:false,$textarea:false},SOURCE={before:[".wikibase-entity-usage",".templatesUsed",".hiddencats",".limitreport"],locked:true,pics:{drag:["de","OOjs_UI_icon_trash-destructive.svg"],drop:["9b","OOjs_UI_icon_trash-invert.svg"],exch:["e9","OOjs_UI_icon_reload-invert.svg"],edit:["8a","OOjs_UI_icon_edit-ltr-progressive.svg"],wait:["de","Ajax-loader.gif"]
},section:"section",$box:false,$editor:false,$wrapper:false},VIEW={};
function failure(apply){
var r=false,i;
for(i=0;i<THIS.warn.length;i++){
if(THIS.warn[i].test(apply)){
r=true;
break;}}
return r;}
function fair(apply){
var r=apply;
if(r.indexOf("%")>=0){
try{
r=decodeURIComponent(r);
}catch(e){
r=unescape(r);}}
if(r.indexOf("_")>=0){
if(!THIS.reUscore){
THIS.reUscore=new RegExp("_","g");}
r=r.replace(THIS.reUscore," ");}
return r;}
function $fault(apply){
var $r=$("<span>"),s=Signature;
if(apply){
s=s+" "+apply;}
$r.addClass(["mw-error","error","remindErrorMessages-invisible"]).hide().text(s);
THIS.lapsus=true;
return $r;}
function fiat(){
var learn=(PARSER.$textarea?true:false);
if(THIS.$widget){
THIS.$widget.empty();}
if(learn){
SOURCE.section=THIS.selector+SOURCE.section;
}else{
SOURCE.section=false;}
VIEW.fire();
if(learn){
SOURCE.first(true);}}
function $file(address,appearance){
var $r=$("<img>");
$r.attr({"src":"https://upload.wikimedia.org/wikipedia/commons/thumb/"+address[0].substr(0,1)+"/"+address[0]+"/"+address[1]+"/"+appearance+"px-"+address[1]+".png"});
return $r;}
function fire($area){
var dom,i,sel,$btn,$ta;
THIS.$content=$area;
THIS.$references=THIS.$content.find(".references");
if(THIS.$references.length){
THIS.ltr=($("html").attr("dir")!=="rtl");
THIS.selector="gadget-"+Signature.toLowerCase()+"-";
THIS.selItem=THIS.selector+"item";
THIS.selProblem=THIS.selector+"problem";
THIS.selWarn=THIS.selector+"warn";
for(i=0;i<THIS.warn.length;i++){
THIS.warn[i]=new RegExp(THIS.warn[i]);}
$ta=THIS.$content.find("#wpTextbox1");
if($ta.length===1){
PARSER.$textarea=$ta;}
if(THIS.launch&&PARSER.$textarea){
fiat();
}else{
sel=THIS.selector+"portlet";
$btn=$("<span>");
$btn.addClass(THIS.selItem).attr({"id":sel,
"title":THIS.serial}).click(fiat).html(THIS.show);
dom=mw.util.addPortletLink("p-tb","#",THIS.show,sel,THIS.serial);
THIS.$widget=$(dom);
if(dom.nodeName.toLowerCase()!=="li"){
THIS.$widget=THIS.$widget.parent();}
THIS.$widget.empty().append($btn);}}}
function fired(above){
var i;
if(typeof above==="object"&&above){
if(typeof above.doc==="object"&&above.doc){
THIS.doc=above.doc;}
if(typeof above.serial==="string"&&above.serial){
THIS.serial=above.serial;
}else{
THIS.serial="?";}
if(typeof above.launch==="boolean"&&above.launch){
THIS.launch=true;}
THIS.serial=THIS.serial+" / "+Version;
if(typeof above.warn==="object"&&above.warn&&typeof above.warn.length==="number"){
for(i=0;i<above.warn.length;i++){
THIS.warn.push(above.warn[i]);}}
mw.hook("wikipage.content").add(fire);}}
function first(){
var signature="ext.gadget."+Signature+"."+THIS.sub,rls;
if(mw.loader.getState(signature)!=="ready"){
rls={};
rls[signature]="ready";
mw.loader.state(rls);
mw.hook(Signature+"."+THIS.sub).add(fired);}}
function $flag(apply){
var $r=$("<span>"),$swap;
$r.addClass(THIS.selItem).text(" "+apply+" ");
if(failure(apply)){
$r.addClass(THIS.selWarn);
$swap=$r;
$r=$("<span>");
$r.append($fault(apply)).append($swap);}
if(SOURCE.section){
$r.click(SOURCE.forward);}
return $r;}
function flat(all,at,allow){
var r=all.charCodeAt(at);
switch(r){
case 0x0009:
case 0x000A:
case 0x005F:
case 0x00A0:
case 0x1680:
case 0x180E:
case 0x2000:
case 0x2001:
case 0x2002:
case 0x2003:
case 0x2004:
case 0x2005:
case 0x2006:
case 0x2007:
case 0x2008:
case 0x2009:
case 0x200A:
case 0x200B:
case 0x200C:
case 0x200D:
case 0x2028:
case 0x2029:
case 0x202F:
case 0x205F:
case 0x2060:
case 0x2061:
case 0x2062:
case 0x2063:
case 0x2064:
case 0x3000:
case 0x303F:
case 0xFEFF:
case 0xE0001:
case 0xE0020:
r=0x20;
break;
case 0x200E:
case 0x200F:
case 0x202A:
case 0x202B:
case 0x202C:
case 0x202D:
case 0x202E:
if(!allow){
r=0x20;}
break;}
return r;}
function fruit(all){
var k=0x20,r="",i,m;
for(i=0;i<all.length;i++){
m=flat(all,i,true);
if(m!==0x20||m!==k){
r=r+String.fromCharCode(m);
k=m;}}
return r;}
PARSER.fault=function(all,at,alert,about){
var i,n,s;
if(typeof window.console==="object"&&typeof window.console.warn==="function"){
i=-1;
n=0;
do{
i=all.indexOf("\n",i+1);
n++;
}while(i>=0&&i<at);
s=Signature+" #"+at+" @"+n+" "+alert;
if(about){
s=s+" -- "+about;}
if(!PARSER.reWS){
PARSER.reWS=new RegExp("\\s+");}
i=at;
while(all.charCodeAt(i)!==0x3C&&i>=0){
i--;}
n=all.indexOf(">",i+1);
if(n<0){
n=i+100;}
s=s+"\n"+all.substring(i,n+1).replace(PARSER.reWS," ");
window.console.warn(s);}
};
PARSER.feature=function(all,at,after,about){
var r={"set":"",
"lock":false,
"more":after},i=PARSER.first(all,at,after),k=all.charCodeAt(i),s;
if(k===0x22||k===0x27){
s=String.fromCharCode(k);
k=all.indexOf(s,i+1);
if(k<0||k>after){
r.lock=true;
PARSER.fault(all,at,"Unbalanced delimiter",about+"="+s);
}else if(k===i+1){
r.lock=true;
PARSER.fault(all,at,"Missing identifier",about+"="+s+s);
}else{
r.set=PARSER.focus(all.substring(i+1,k));
r.more=k+1;}
}else if(k===0x2F||k===0x3E){
PARSER.fault(all,at,"Identifier missing",about+"=");
r.lock=true;
}else{
for(k=i;k<=after;k++){
switch(flat(all,k)){
case 0x2F:
case 0x3E:
if(k===i){
r.lock=true;
PARSER.fault(all,at,"Missing identifier",about+"=");
k=after+1;
break;}
case 0x20:
r.set=all.substring(i,k);
r.more=k;
k=after+1;
break;}}}
return r;
};
PARSER.features=function(all,at,after,alone){
var i=at,j,lock,r,s,v;
do{
j=all.indexOf("=",i);
if(j<0||j>after){
break;
}else{
s=PARSER.focus(all.substring(i,j)).toLowerCase();
switch(s){
case "name":
case "group":
case "extends":
if(!r){
r={"name":false,
"group":false,
"extends":false,
"content":false,
"lone":false,
"multi":0,
"next":after,
"wikitext":false};}
if(typeof r[s]==="string"){
PARSER.fault(all,at,"Duplicated keyword",s);
lock=true;
}else{
v=PARSER.feature(all,j+1,after,s);
r[s]=v.set;
lock=v.lock;
i=v.more;}
break;
default:
PARSER.fault(all,at,"Unknown keyword",s);
lock=true;}}
}while(!lock);
if(lock){
PARSER.lock=true;
}else if(r){
i=PARSER.first(all,i,after);
if(all.charCodeAt(i)===0x2F){
r.lone=true;
i=PARSER.first(all,++i,after);}
if(alone||r.lone){
i=PARSER.first(all,i,after);
if(i===after){
if(r&&!r.name&&alone){
r=false;}
}else{
PARSER.lock=true;
PARSER.fault(all,i,"Trailing garbage");}}}
return r;
};
PARSER.fiat=function(all,at,after,about,adjust){
var p=["group","name","extends"],r=about,s="ref",i,set,sign;
for(i=0;i<3;i++){
sign=p[i];
set=(i===1?adjust.shift:about[sign]);
if(set){
s=s+" "+sign+"=\""+PARSER.fix(set)+"\"";}}
if(about.lone){
s=s+" /";}
r.name=adjust.shift;
r.wikitext=all.substr(0,at)+s+all.substr(after);
r.next=r.next+s.length+at-after;
return r;
};
PARSER.finalize=function(array){
var grouped={},groups=[],c,e,g,i,k,o,p,s,v;
for(i=0;i<array.length;i++){
e=array[i];
s=e.group;
if(typeof grouped[s]!=="object"){
groups.push(s);
grouped[s]=[];}
grouped[s].push(e);}
groups.sort();
for(i=0;i<groups.length;i++){
p=groups[i];
g=grouped[p];
c={};
o=[];
for(k=0;k<g.length;k++){
v=g[k];
s=v.name;
if(typeof c[s]==="object"){
e=c[s];
e.linked=true;
if(!v.lone){
e.lone=false;
if(e.content&&v.content){
e.multi++;}}
c[s]=e;
}else{
c[s]={name:s,content:v.content,lone:v.lone,linked:v.linked||v.lone,multi:v.multi};
o.push(s);}
g[k]=null;}
o.sort();
for(k=0;k<o.length;k++){
o[k]=c[o[k]];}
grouped[p]=o;
c=null;
g=null;
o=null;}
return{groups:groups,grouped:grouped};
};
PARSER.finish=function(all,at,alone){
var i=at,j,kR,kE,kF,n,r,s;
do{
i=all.indexOf("<",i);
if(i<0){
break;
}else{
i++;
n=all.indexOf(">",i);
if(n<0){
break;
}else if(n>i+3){
j=PARSER.first(all,i,n);
if(n>=j+3&&all.charCodeAt(j)===0x2F){
j=PARSER.first(all,j,n);
kR=all.charCodeAt(j+1);
kE=all.charCodeAt(j+2);
kF=all.charCodeAt(j+3);
if((kR===0x52||kR===0x72)&&(kE===0x45||kE===0x65)&&(kF===0x46||kF===0x66)){
if(alone){
if(n===j+4||n===PARSER.first(all,j+4,n)){
r=[i-1,n];}
}else if(n>=j+10){
kE=all.charCodeAt(j+4);
if(kE===0x45||kE===0x65){
s=all.substring(j+1,j+11).toLowerCase();
if(s==="references"){
r=[i-1,n];}}}}}}}
}while(!r);
return r;
};
PARSER.fire=function(always,adjust){
var e,k,r,s,x;
if(PARSER.$textarea.attr("disabled")){
if(always){
r=PARSER.fired(PARSER.$textarea.val());}
}else{
PARSER.lock=false;
s=PARSER.$textarea.val();
if(adjust){
PARSER.$textarea.attr("disabled",true);
r=PARSER.fired(s);
if(!PARSER.lock){
x=adjust;
for(k=0;k<r.length;k++){
e=r[k];
if(e.name===x.name&&e.group===x.group){
x=false;
break;}}
if(x){
r=PARSER.fired(s,x,PARSER.$textarea);}}
PARSER.$textarea.attr("disabled",false);
}else{
r=PARSER.fired(s);}}
if(r){
r=PARSER.finalize(r);}
return r;
};
PARSER.fired=function(all,adjust,$assign){
var i=0,s=all,e,k,p,r,v;
do{
v=PARSER.front(s,i,adjust);
if(v){
i=v.next;
if(v.wikitext){
s=v.wikitext;
delete v.wikitext;}
delete v.next;
if(v.lone){
if(r){
for(k=0;k<r.length;k++){
e=r[k];
if(e.name===v.name&&e.group===v.group){
r[k].linked=true;
v=false;
break;}}}
if(v){
if(p){
for(k=0;k<p.length;k++){
e=p[k];
if(e.name===v.name&&e.group===v.group){
p[k].linked=true;
v=false;
break;}}
}else{
p=[];}
if(v){
v.linked=true;
p.push(v);}}
}else if(r){
v.linked=false;
for(k=0;k<r.length;k++){
e=r[k];
if(e.name===v.name&&e.group===v.group){
if(v.content&&e.content===v.content){
r[k].multi++;}
r[k].content=e.content||v.content;
if(r[k].content){
r[k].lone=false;}
r[k].linked=true;
v=false;
break;}}}
if(v){
r=r||[];
r.push(v);
}else{
v=true;}}
}while(v);
if($assign){
$assign.val(s);}
if(p){
for(k=0;k<p.length;k++){
v=p[k];
if(r){
for(i=0;i<r.length;i++){
e=r[i];
if(e===v){
v=false;
}else if(e.name===v.name&&e.group===v.group){
r[i].linked=true;
if(e.content&&e.content===v.content){
r[i].multi++;}
v=false;}}}
if(v){
r=r||[];
r.push(v);}}}
return r;
};
PARSER.first=function(all,at,after){
var r=at,i;
for(i=at;i<=after;i++){
if(flat(all,i)!==0x20){
r=i;
break;}}
return r;
};
PARSER.fix=function(ask){
var r=ask;
if(ask.indexOf("\"")>=0){
if(!PARSER.reQuot){
PARSER.reQuot=new RegExp("\"","g");}
r=r.replace(PARSER.reQuot,""");}
return r;
};
PARSER.focus=function(ask){
var r=ask.trim(),n=r.length,i=PARSER.first(r,0,n);
if(i){
r=r.substr(i);}
n=r.length;
if(n){
for(i=n-1;i>=0;i--){
if(flat(r,i)===0x20){
r=r.substr(0,i);
}else{
break;}}}
return r;
};
PARSER.front=function(all,at,adjust){
var i=at,j,kR,kE,kF,n,r,v;
do{
i=all.indexOf("<",i);
if(i<0){
break;
}else{
i++;
n=all.indexOf(">",i);
if(n<0){
break;
}else if(n>=i+10){
j=PARSER.first(all,i,n);
if(n>=j+10){
kR=all.charCodeAt(j);
kE=all.charCodeAt(j+1);
kF=all.charCodeAt(j+2);
if((kR===0x52||kR===0x72)&&(kE===0x45||kE===0x65)&&(kF===0x46||kF===0x66)){
if(flat(all,j+3)===0x20){
r=PARSER.features(all,j+4,n,true);
if(r){
if(!r.lone){
v=PARSER.finish(all,n+1,true);
if(v){
r.content=all.substring(n+1,v[0]).trim();
r.next=v[1]+1;
}else{
PARSER.lock=true;
PARSER.fault(all,i,"Missing </ref>");}}
if(PARSER.pending){
if(r.next<PARSER.pending.max){
r.group=PARSER.pending.shared;
}else{
PARSER.pending=false;}}
if(r.name&&adjust&&adjust.seek===r.name&&((!adjust.group&&!r.group)||adjust.group===r.group)&&!PARSER.lock){
r=PARSER.fiat(all,i,n,r,adjust);}}
}else{
kE=all.charCodeAt(j+3);
if(kE===0x45||kE===0x65){
PARSER.frontal(all,j,n);}}}}}}
}while(!r);
return r;
};
PARSER.frontal=function(all,at,after){
var s=all.substring(at,at+10).toLowerCase(),k,q;
if(s==="references"){
k=flat(all,at+10);
if(k===0x20){
q=PARSER.features(all,at+10,after,false);
if(q&&q.group&&!q.lone){
PARSER.pending={shared:q.group};
q=PARSER.finish(all,at+10,false);
if(q){
PARSER.pending.max=q[0];
}else{
PARSER.pending.max=all.length;
PARSER.lock=true;}}
}else if(PARSER.pending){
PARSER.pending=false;}}
};
SOURCE.favour=function(){
if(typeof THIS.doc==="object"&&THIS.doc&&typeof THIS.doc.server==="string"&&THIS.doc.server&&typeof THIS.doc.support==="string"&&THIS.doc.support){
window.open(THIS.doc.server+"Special:MyLanguage/"+THIS.doc.support,Signature);}
};
SOURCE.fiat=function(){
var o;
SOURCE.$doit.hide();
SOURCE.$wait.show();
o=PARSER.fire(false,SOURCE.exec);
if(o){
SOURCE.$editor.hide();
SOURCE.$wait.hide();
SOURCE.groups=o.groups;
SOURCE.grouped=o.grouped;
if(typeof VIEW.offered[SOURCE.exec.seek]==="object"){
delete VIEW.offered[SOURCE.exec.seek];}
SOURCE.fill(false);
}else{
SOURCE.$input.css({"border-color":"#FF0000"});
SOURCE.focus();}
};
SOURCE.field=function(){
var $buttons=$("<div>"),$ruler=$("<div>"),m=22,$img;
SOURCE.$editor=$("<div>");
SOURCE.$editor.addClass(THIS.selector+"editor").css({"position":"absolute",
"text-align":(THIS.ltr?"left":"right"),
"z-index":"1"});
SOURCE.$input=$("<input>");
SOURCE.$input.addClass([THIS.selector+"input","noime"]).attr({"maxlength":"100",
"size":"42",
"type":"text"}).css({"border-color":"transparent",
"border-radius":"2px",
"border-style":"solid",
"border-width":"2px",
"margin-left":(THIS.ltr?"0":"auto"),
"margin-right":(THIS.ltr?"auto":"0")});
SOURCE.fresh();
$img=$file(SOURCE.pics.exch,m);
SOURCE.$deny=$("<div>");
SOURCE.$deny.append($img).css({"background-color":"#808080",
"border-color":"transparent",
"border-radius":"4px",
"border-style":"solid",
"border-width":"2px",
"float":(THIS.ltr?"left":"right")});
SOURCE.$doit=$("<div>");
SOURCE.$doit.addClass(THIS.selector+"button").append($img.clone()).attr({"lang":"en",
"role":"button",
"title":"exchange!"}).css({
"border-color":"transparent",
"border-radius":"4px",
"border-style":"solid",
"border-width":"4px",
"cursor":"pointer",
"float":(THIS.ltr?"left":"right")}).hide();
$img=$file(SOURCE.pics.wait,m);
SOURCE.$wait=$("<div>");
SOURCE.$wait.append($img).attr({"title":"..."}).css({"border-color":"transparent",
"border-radius":"4px",
"border-style":"solid",
"border-width":"4px",
"float":(THIS.ltr?"left":"right")}).hide();
SOURCE.$abort=$("<div>");
SOURCE.$abort.addClass(THIS.selector+"abort").attr({"lang":"en",
"role":"button",
"title":"abort"}).css({"border-color":"transparent",
"border-radius":"4px",
"border-style":"solid",
"border-width":"2px",
"color":"#FFFFFF",
"cursor":"pointer",
"float":(THIS.ltr?"right":"left"),
"font-family":"sans-serif",
"font-size":(m-4)+"px",
"font-weight":"bold",
"min-width":m+"px",
"text-align":"center",
"vertical-align":"middle"}).text("×");
$buttons.append(SOURCE.$deny).append(SOURCE.$doit).append(SOURCE.$wait).append(SOURCE.$abort).css({"margin-top":"1em",
"width":"100%"});
$ruler.css({"clear":"both"});
SOURCE.$story=$("<textarea>");
SOURCE.$story.addClass(THIS.selector+"content").attr({"readonly":"readonly",
"rows":"5"}).css({"margin-top":"1em",
"max-width":"100%",
"min-width":"100%",
"overflow-y":"auto"});
SOURCE.$editor.append(SOURCE.$input).append($buttons).append($ruler).append(SOURCE.$story);
};
SOURCE.fill=function(adjust){
var css={"display":"inline-block",
"margin-left":"1em",
"margin-right":"1em"},n=SOURCE.groups.length,e,group,i,k,o,s,$head,$img,$item,$li,$ul;
if(!adjust){
SOURCE.$box.empty();}
if(!(SOURCE.locked||PARSER.lock)){
SOURCE.lock=false;}
if(n>1){
SOURCE.groups.sort();
if(!SOURCE.groups[n-1]){
SOURCE.groups.pop();
SOURCE.groups.unshift(false);}}
for(i=0;i<n;i++){
s=SOURCE.groups[i];
group=SOURCE.grouped[s];
for(k=0;k<group.length;k++){
e=group[k];
if(e.lone){
PARSER.lock=true;}}}
for(i=0;i<n;i++){
s=SOURCE.groups[i];
group=SOURCE.grouped[s];
if(s){
$head=$("<div>");
$head.addClass(THIS.selItem).text("<ref group=\""+s+"\">");
SOURCE.$box.append($head);}
$ul=$("<ul>");
for(k=0;k<group.length;k++){
e=group[k];
if(typeof VIEW.offered[e.name]==="object"){
o=VIEW.offered[e.name];
if(o.lone&&o.content){
e.content=o.content;}
}else{
o=false;}
e.content=fruit(e.content);
$item=$flag(e.name);
$item.attr({"title":e.content});
$li=$("<li>");
$li.append($item).css({"position":"relative"});
if(e.lone){
$li.append($fault("<ref />"));
$item=$("<span>");
$item.addClass(THIS.selProblem).css(css).html("<ref />");
$li.append($item);
}else if(e.multi){
s=(e.multi+1)+"×";
$li.append($fault());
$item=$("<span>");
$item.addClass(THIS.selProblem).css(css).text(s);
$li.append($item);
}else if(o&&o.sign){
$item.attr({"role":"link"}).click(o.sign,SOURCE.fragment).css({"cursor":"pointer"});}
if(!PARSER.lock){
$img=$file(SOURCE.pics.edit,16);
$item=$("<span>");
$item.append($img).attr({"lang":"en",
"role":"button",
"title":"edit"}).click([$li,e,s],SOURCE.flip).css(css).css({"cursor":"pointer"});
$li.append($item);
if(!e.linked){
$img=$file(SOURCE.pics.drag,16);
$item=$("<span>");
$item.append($img).attr({"lang":"en",
"role":"button",
"title":"discard"}).click([$li,e,s,$item,css],SOURCE.flopping).css(css).css({"cursor":"pointer"});
$li.append($item);}}
$ul.append($li);}
SOURCE.$box.append($ul);}
};
SOURCE.first=function(always){
var collection=PARSER.fire(always),i,$before,$editform,$head,$header;
if(collection){
SOURCE.grouped=collection.grouped;
SOURCE.groups=collection.groups;
$editform=THIS.$content.find(".mw-editform");
for(i=0;i<SOURCE.before.length;i++){
$before=$editform.find(SOURCE.before[i]);
if($before.length===1){
SOURCE.$wrapper=$("<div>");
$header=$("<div>");
$head=$("<span>");
$head.addClass(THIS.selItem).attr({"id":SOURCE.section,
"lang":"en",
"role":"link",
"title":"help"}).click(SOURCE.favour).css({"cursor":"pointer",
"font-size":"130%"}).html(THIS.show);
$header.append($head);
SOURCE.$box=$("<div>");
SOURCE.$wrapper.addClass(THIS.selector+"wrapper").append($header).append(SOURCE.$box);
$before.before(SOURCE.$wrapper);
SOURCE.locked=mw.util.getParamValue("section");
SOURCE.fill(true);
break;}}}
};
SOURCE.flash=function(about){
var $li=about.data[0],pre=about.data[1],group=about.data[2],$drag=about.data[3],$drop=about.data[5];
if($drop){
$drop.remove();}
if(PARSER.fire(false,{group:group,seek:pre.name,shift:false})){
if(typeof VIEW.offered[pre.name]==="object"){
delete VIEW.offered[pre.name];}
pre.name=false;
$li.remove();
}else if($drag){
$drag.show();}
SOURCE.lock=false;
};
SOURCE.flip=function(about){
var $li;
if(!SOURCE.lock){
SOURCE.lock=true;
$li=about.data[0];
SOURCE.pre=about.data[1];
SOURCE.pre.group=about.data[2];
if(SOURCE.$editor){
SOURCE.$input.attr({"readonly":null});
SOURCE.focus();
SOURCE.$editor.show();
}else{
SOURCE.field();}
SOURCE.start=SOURCE.pre.name;
SOURCE.$input.val(SOURCE.start);
SOURCE.$story.val(SOURCE.pre.content);
$li.append(SOURCE.$editor);
SOURCE.$input.blur(SOURCE.formal).focus(SOURCE.focus).keyup(SOURCE.fresh).mousedown(SOURCE.fresh).mouseout(SOURCE.formal).focus();
SOURCE.$doit.click(SOURCE.fiat);
SOURCE.$abort.click(SOURCE.flush);}
};
SOURCE.flop=function(about){
var $drop;
if(SOURCE.lock){
$drop=about[5];
$drop.click(about,SOURCE.flash).css({"background-color":"#FF0000",
"cursor":"pointer"});}
};
SOURCE.flopped=function(about){
var $drag,$drop;
if(SOURCE.lock){
$drag=about.data[3];
$drop=about.data[5];
if($drop){
$drop.remove();}
if($drag){
$drag.show();}
SOURCE.lock=false;}
};
SOURCE.flopping=function(about){
var css,discard,e,s,$drag,$img,$drop,$li;
if(!SOURCE.lock){
SOURCE.lock=true;
$li=about.data[0];
e=about.data[1];
s=about.data[2];
$drag=about.data[3];
css=about.data[4];
$drag.focus().hide();
$img=$file(SOURCE.pics.drop,16);
$drop=$("<span>");
discard=[$li,e,s,$drag,css,$drop];
$drop.addClass(THIS.selector+"discard").append($img).attr({"lang":"en",
"role":"button",
"title":"discard"}).css(css).css({"background-color":"#FFB0B0",
"border-color":"transparent",
"border-radius":"2px",
"border-style":"solid",
"border-width":"2px",
"cursor":"none",
"transition":"background-color 2s"}).focusout(discard,SOURCE.flopped).mouseout(discard,SOURCE.flopped);
$li.append($drop);
$drop.focus();
window.setTimeout(SOURCE.flop,1500,discard);}
};
SOURCE.flush=function(){
SOURCE.$editor.detach().hide();
SOURCE.lock=false;
};
SOURCE.focus=function(){
SOURCE.$doit.hide();
SOURCE.$wait.hide();
SOURCE.$deny.show();
};
SOURCE.formal=function(){
var s=fruit(PARSER.focus(SOURCE.$input.val())),group,i,lapsus;
SOURCE.$input.val(s);
if(s){
lapsus=failure(s);
}else{
lapsus=false;}
if(s===SOURCE.start){
SOURCE.focus();
}else if(!lapsus){
SOURCE.fresh();
group=SOURCE.grouped[SOURCE.pre.group];
if(group){
for(i=0;i<group.length;i++){
if(s===group[i].name){
lapsus=true;
break;}}
if(!lapsus){
SOURCE.exec={group:SOURCE.pre.group,seek:SOURCE.start,shift:s};
SOURCE.$deny.hide();
SOURCE.$doit.show();}}}
if(lapsus){
SOURCE.$input.css({"border-color":"#FF0000"});
SOURCE.focus();
}else{
SOURCE.fresh();}
};
SOURCE.forward=function(){
var url=window.location;
url.hash="#"+SOURCE.section;
window.location=url;
};
SOURCE.fragment=function(about){
var url=window.location;
url.hash="#"+about.data;
window.location=url;
};
SOURCE.fresh=function(){
SOURCE.$input.css({"border-color":"#3366CC"});
};
VIEW.field=function(at,apply){
var $li=$(apply),sel=$li.attr("id"),got,s;
if(sel){
got=VIEW.reNamed.exec(sel);
if(got){
s=fair(got[1]);
$li.prepend($flag(s));
if(typeof VIEW.offered[s]==="object"){
VIEW.offered[s]={lone:false};
}else{
VIEW.offered[s]={
content:$li.find(".reference-text").text().trim(),lone:true,sign:sel
};}}}
return true;
};
VIEW.fill=function(at,apply){
var $ol=$(apply);
$ol.children("li").each(VIEW.field);
return true;
};
VIEW.fire=function(){
THIS.$references=THIS.$content.find(".references");
if(THIS.$references.length){
VIEW.reNamed=new RegExp("^cite_note-(.+)-\\d+$");
VIEW.offered={};
THIS.$references.each(VIEW.fill);
if(THIS.lapsus){
mw.hook("remindErrorMessages.refresh").fire(THIS.$references);}}
};
first();
}(window.mediaWiki,window.jQuery));
/// EOF</nowiki>refNames/core/r.js