User:PerfektesChaos/js/fragmentAnchors/r.js: Difference between revisions

Content deleted Content added
2.4
2.7
 
(2 intermediate revisions by the same user not shown)
Line 1:
/// Gadget/fragmentAnchors/r.js
/// 20182021-0107-2930 PerfektesChaos@de.wikipedia
/// Fingerprint:#0#F7546968378F0A71#
/// Documentation:[[w:en:User:PerfektesChaos/js/fragmentAnchors]]
/// @license:CC-by-sa/4.0 GPLv3
///<nowiki>
(function(mw,$){
"use strict";
var Version=2.47,FANCY="fragmentAnchors",FASC={cfg:{},siblings:"error-repeated-id",source0:"6/62/Anchor_pictogram.svg",source1:"d/d6/Anchor_pictogram_red.svg",unStart:["wpTextbox","/maplink/","Anker:"],vsn:Version
},EXPORT={},OO;
function facet($area){
Line 30 ⟶ 31:
mw.loader.using(["oojs","oojs-ui-core","oojs-ui-widgets"],facility);}
function fire(){
var signature="ext.gadget."+FANCY,env,rls;
if(mw.loader.getState(signature)!=="ready"){
rls={};
mw.loader.state(signature,"ready");
rls[signature]="ready";
mw.loader.state(signature,"ready"rls);
if(typeof mw.libs[FANCY]!=="object"||!mw.libs[FANCY]){
mw.libs[FANCY]={};}
Line 135 ⟶ 138:
var m=(alert||augment?1:0),n=(alert?20:12),s=FASC["source"+m],$r=$("<img />");
$r.attr({alt:"id?",src:"https://upload.wikimedia.org/wikipedia/commons/thumb/"+s+"/"+n+"px-"+s.substr(5)+".png"});
$r.css({"height":n,
"width":n});
if(alert){
$r.css({"background-color":"#FFFF00",
"border":"#FF0000 2px solid",
"padding":"1px"});}
return $r;
Line 179 ⟶ 184:
$s=$("<span>");
$s.addClass(FASC.single);
$s.css({"background-color":"#FFFF00",
"border":"#FF0000 2px solid",
"color":"#FF0000",
"font-size":"120%",
"font-weight":"bold",
"padding-left":"0.2em",
"padding-right":"0.2em"});
$s.attr({title:anchor});
Line 197 ⟶ 205:
if(all[s]){
if(FASC.$content){
if(typeof FASC.reApos!=="object"){
seek="[id='"+s.substr(1)+"']";
FASC.reApos=new RegExp("'","g");}
seek="[id='"+s.substr(1).replace(FASC.reApos,"\\'")+"']";
try{
$e=FASC.$content.find(seek);
if}catch($e.length){
$e=false;}
if($e&&$e.length&&!(FASC.$exclude&&FASC.$exclude.find(seek).length)){
r[s]=$e;}}
}else{
r[s]=all[s];}}}
Line 208 ⟶ 220:
FASC.fiat=function(about,action){
var illusive=0.75,margin=10,options={align:"center",anchor:true,horizontalPosition:"center",padded:false,verticalPosition:"below"},show=about.sign,sign=FASC.sign+(action?"-t":"-i")+about.id,$p=$("<span>"),r;
$p.css({"left":(-0.5*about.$span.innerWidth()-1)+"px",
"position":"relative",
"top":"3px"});
about.$span.append($p);
Line 218 ⟶ 231:
show="#";}
if(about.mode===2){
$p.css({"background-color":"#FFFF00",
"color":"#FF0000",
"font-weight":"bold",
"margin":"0.2em",
"padding":"0.4em"}).text(show);
}else{
Line 226 ⟶ 241:
show=FASC.cfg.fancy(show);
illusive=0.95;}
$p.css({"color":"#000000",
"font-weight":"normal"}).text(show);
.text(show);
}else{
$p.css({"margin":"0.2em",
"width":"2em"}).text("  ");}}
.text("  ");}}
$p.attr({"id":sign}).addClass(FASC.sign+"-text")
.css({"font-family":"sans-serif",
"font-size":"medium",
"font-style":"normal",
"font-variant":"normal",
"visibility":"hidden"});
FASC.$body.append($p);
Line 242 ⟶ 259:
r=new OO.ui.PopupWidget(options);
r.$floatable.attr({"role":"tooltip"}).css({"opacity":illusive,
"padding":"2px",
"text-align":"center"});
FASC.$body.append(r.$floatable);
return r;
Line 298 ⟶ 316:
$li.text("−"+FASC.want[s]+"× "+s);
$ul.append($li);}
$box.css({"border":"#FF0000 2px solid",
"color":"#FF0000",
"margin-bottom":"1em",
"margin-top":"1em",
"padding":"0.5em"});
$box.attr({"id":FASC.sign+"-errors"});
$box.addClass(FASC.show+" error "+FASC.sign+"-errors");
$box.append($ul);
$before.before($box);}