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

Content deleted Content added
1.1
1.2
Line 1:
/// Gadget/fragmentAnchors/r.js
/// 2016-04-1718 PerfektesChaos@de.wikipedia
/// Fingerprint:#0#294272B82D1FA4DB#
///<nowiki>
(function(mw,$){
"use strict";
var Version=1.12,FANCY="fragmentAnchors",FASC={cfg:{},siblings:"error-repeated-id",source0:"6/62/Anchor_pictogram.svg",source1:"d/d6/Anchor_pictogram_red.svg",vsn:Version
};
if(typeof mw.libs[FANCY]!=="object"||!mw.libs[FANCY]){
Line 11:
mw.libs[FANCY].type=FANCY;
FANCY=mw.libs[FANCY];
function fiatfeed(){
mw.hook("wikipage.content").add(FASC.furnish);}
function firefiat(){
FASC.cfg.live=false;
if(typeof FASC.cfg.$portlet.hide(==="object");{
FASC.cfg.$portlet.hide();}
mw.loader.using(["jquery.tipsy"],feed);}
function fire(){
mw.loader.state(var signature="ext.gadget."+FANCY.type,"ready")env;
FANCY.doc="[[w:en:User:PerfektesChaos/js/"+FANCY.type+"]]";
if(mw.loader.getState(signature)!=="ready"){
mw.loader.state(signature,"ready");
var env=mw.config.get(["wgAction","wgPageContentModel"]);
FANCY.vsn=Version;
if(env.wgPageContentModel==="wikitext"){
FASC.locked=(env.wgAction==="view");
FASC.sign=FANCY.type;
FASC.cfg.live=false;
mw.loader.using(["user","mediawiki.util"],FASC.fire);}}}
FANCY.fetch=function(){
var dup,r,s;
Line 26 ⟶ 45:
return r;
};
FANCY.fire=function feed(){
var r=FASC.cfg.live;
mw.hook("wikipage.content").add(FASC.furnish);}
if(r){
function fiat(){
fiat();}
FASC.cfg.$portlet.hide();
return r;
mw.loader.using(["jquery.tipsy"],feed);}
};
function fire(){
FASC.cfg.element=function(attend,attributes,anchor){
var env=mw.config.get(["wgAction","wgPageContentModel"]);
return mw.html.element(attend,attributes,anchor);
FANCY.vsn=Version;
};
FANCY.doc="[[w:en:User:PerfektesChaos/js/"+FANCY.type+"]]";
FASC.cfg.escape=function(anchor){
mw.loader.state("ext.gadget."+FANCY.type,"ready");
return mw.html.escape(anchor);
if(env.wgPageContentModel==="wikitext"){
};
FASC.locked=(env.wgAction==="view");
FASC.sign=FANCY.type;
FASC.cfg.live=false;
mw.loader.using(["user","mediawiki.util"],FASC.fire);}}
FASC.cfg.fair=function(anchor){
var r=anchor.replace(/_/g," "),s;
Line 61 ⟶ 77:
};
FASC.cfg.fire=function(){
var lock,portlet;
var portlet=mw.util.addPortletLink("p-tb","#"," ","t-"+FASC.sign);
if(typeof FANCY.large==="boolean"){
FASC.large=FANCY.large;}
if(typeof FANCY.lock==="boolean"){
lock=FANCY.lock;}
if(!lock){
var portlet=mw.util.addPortletLink("p-tb","#"," ","t-"+FASC.sign);
FASC.cfg.$portlet=$(portlet);
FASC.cfg.$portlet.append(FASC.$facet());
FASC.cfg.$portlet.click(fiat);
FASC.cfg.$portlet.attr({title:FASC.sign+" "+FASC.vsn});}
mw.hook(FANCY.type+".ready").fire(FANCY);
FASC.cfg.live=true;
Line 79 ⟶ 99:
$r.css({"height":n,"width":n});
if(alert){
$r.css({"background-color":"#FFFF00","border":"#FF0000 2px solid"});},
"padding":"1px"});}
return $r;
};
FASC.$factory=function(anchor,alert){
var sign=anchor.substr(1),lapse=(alert||!FASC.fine(sign)),mode=(alert?1:(lapse?2:0)),$r=FASC.badges[mode],show,$i,$s;
if(!$r){
$i=FASC.$facet(alert,lapse);
Line 102 ⟶ 123:
$i=$r.children();
if(lapse){
show=mwFASC.htmlcfg.element("span",{style:"background-color:#FFFF00;color:#FF0000;font-weight:bold;margin:0.2em;padding:0.4em;"},sign);
}else{
show=mwFASC.htmlcfg.escape(sign);}
$i.attr({"data-id":sign,"title":show});
$i.tipsy({gravity:"s",html:true,opacity:0.8});
Line 234 ⟶ 255:
$e=$inner.eq(i);
s=$e.attr("href");
if(s!=="#"&&typeof total[s]!=="object"){
$e.addClass(FASC.scope);
if(typeof total[s]!=="object"){
$e.before(FASC.$failure(s));
if(!FASC.want){
Line 242 ⟶ 264:
FASC.want[s]=FASC.want[s]+1;
}else{
FASC.want[s]=1;}}}}}
if(FASC.dup||FASC.want){
FASC.flag();}