User:PerfektesChaos/js/externalLinkProblem/gui/r.js

/// User:PerfektesChaos/js/externalLinkProblem/gui/r.js /// 2019-01-23 PerfektesChaos@de.wikipedia /// Fingerprint:#0#1E8AFF85# /// @license GPL [//www.mediawiki.org/w/COPYING](+GFDL,LGPL,CC-BY-SA) /// (function(mw,$){ "use strict"; var Version=2.9,ELP="externalLinkProblem",Sub="gui",Supersed="defekterWeblinkBotVorlage",Box={},Content={},Pop={$body:false},OO; if(typeof mw.libs[ELP]!=="object"||!mw.libs[ELP]){ mw.libs[ELP]={};} mw.libs[ELP].type=ELP; ELP=mw.libs[ELP]; if(typeof ELP[Sub]!=="object"){ ELP[Sub]={};} ELP[Sub].vsn=Version; if(typeof ELP.config!=="object"){ ELP.config={};} if(typeof ELP.config.css!=="object"){ ELP.config.css={}; ELP.config.css.box={"border":"#808080 2px solid", "clear":"both", "margin-top":"1em", "margin-bottom":"1em", "padding":"0.8em", "padding-right":"0"}; ELP.config.css.href={"background-color":"#FFD0D0", "border":"#FF0080 2px solid", "padding-bottom":"2px", "padding-left":"4px", "padding-right":"16px", "padding-top":"2px"}; ELP.config.css.ref={"color":"#FF00FF"}; ELP.config.css.factory=function{ var o,s,u,v; if(typeof ELP.css==="object"&&typeof ELP.css){ for(s in ELP.config.css){ if(typeof ELP.config.css[s]==="object"&&typeof ELP.css[s]==="object"&&typeof ELP.css[s]){ o=ELP.config.css[s]; u=ELP.css[s]; for(s in u){ v=u[s]; switch(typeof v){ case "string": o[s]=v; break; case "boolean": if(!v&&typeof o[s]==="string"){ delete o[s];} break;}}}}} };} if(typeof ELP.lang!=="object"){ ELP.lang={slang:"en"};} if(typeof ELP[Sub].texts!=="object"){ ELP[Sub].texts={ "blocked":{"en":"Blocked.", "de":"Blockiert."}, "blocking":{"en":"(malware, spam [blacklist], mailto:)", "de":"(Malware, Spam [blacklist], mailto:)"}, "bracket":{"en":"Opening bracket '[' in URL, might be unescaped ']'", "de":"Öffnende Klammer '[' in der URL, womöglich ']' nicht kodiert"}, "curl":{"en":"CURL: network problem", "de":"CURL: Netzwerkproblem"}, "current":{"en":"current", "de":"aktuell"}, "discard":{"en":"Perhaps already resolved", "de":"Möglicherweise bereits nicht mehr wirksam"}, "editSrc":{"en":"edit section source", "de":"Abschnittsquelltext bearbeiten"}, "empty":{"en":"(empty)", "de":"(leer)"}, "help":{"en":"details", "de":"Details"}, "hint":{"en":"Show external links", "de":"Zeige Links"}, "hintTalk":{"en":"Show external links with assumed problem on talk page (will open in new window)", "de":"Zeige Links mit vermutetem Problem auf der Diskussionsseite (wird in neuem Fenster geöffnet)"}, "mode":{"en":"HTTP status", "de":"HTTP-Status"}, "mode3":{"en":"Page has been moved", "de":"Seite wurde verschoben"}, "mode5":{"en":"Entire domain or server unavailable", "de":"Ganze Domain / Server unerreichbar"}, "more":{"en":"More pages", "de":"Weitere Seiten"}, "notdone":{"en":"Error: marked as done", "de":"Fehler: als erledigt markiert"}, "other":{"en":"Other page with same URL:", "de":"Andere Seite mit gleicher URL:"}, "others":{"en":"Other pages with same URL (research might be used here):", "de":"Andere Seiten mit gleicher URL (Erfolg könnte wiederverwendet werden):"}, "pipe":{"en":"Pipe '|' within URL, might be wikilink syntax", "de":"Pipe '|' in der URL, womöglich Wikilink-Syntax"}, "earlier":{"en":"Section from earlier bot run detected", "de":"Abschnitt aus früherem Botlauf gefunden"}, "since":{"en":"Already unavailable:", "de":"Bereits unerreichbar:"}, "special":{"en":"Special character at URL end, might have caused problem", "de":"Sonderzeichen am Ende der URL, womöglich Ursache"}, "sub":{"en":"Truncated URL appropriate?", "de":"Gekürzte URL inhaltlich richtig?"}, "success":{"en":"success", "de":"erfolgreich"}, "syntax":{"en":"Syntax error", "de":"Syntaxfehler"}, "try":{"en":"try", "de":"Ausprobieren"}, "wayback":{"en":"A version in wayback.archive.org might be appropriate:", "de":"Vielleicht ist eine Version auf wayback.archive.org geeignet:"}, "wayback*":{"en":"all", "de":"alle"}, "wayback!":{"en":"most recent", "de":"jüngste"}, "webcite":{"en":"A version in webcitation.org might be appropriate:", "de":"Vielleicht ist eine Version auf webcitation.org geeignet:"}, "wikilink":{"en":"Internal link should be rewritten as ...", "de":"Wikilink sollte als ... geschrieben werden"} };} function facilitated{ var rls,signature,sub; if(typeof ELP.signature==="string"){ sub="/"+Sub; signature=ELP.signature+sub; if(mw.loader.getState(signature)!=="ready"){ rls={}; rls[signature]="ready"; mw.loader.state(rls); mw.hook(ELP.type+sub+".ready").fire;}}} function fair(access){ var r=access.replace(/#.*$/,""),k=r.indexOf("\\" ); if(k>=0){ if(k>6){ r=r.replace(/\\/g,"%5C"); }else{ k=r.indexOf("\\\\", k ); if(k>=0&&k<=6){ r=r.substr(0,k)+"//"+r.substr(k+2);}}} r=r.replace(/{/g,"%7B") .replace(/}/g,"%7D") .replace(/%28/g,"(") .replace(/%29/g,")"); k=r.indexOf("//"); if(k>=0&&k<=6){ if(k){ r=r.substr(0,k).toLowerCase+r.substr(k); }else{ r="https:"+r;} if(r.indexOf("/",11)<0){ r=r+"/";}} return r;} function far(access){ var r=access,i=r.indexOf("//"),k,start,strip; if(i>=0&&i<=6){ i=r.indexOf("/",i+6); if(i>0){ start=r.substr(0,i); strip=r.substr(i+1); try{ start=decodeURI(start); }catch(e){ } if(strip){ for(i=strip.length-1;i>=0;i--){ k=strip.charCodeAt(i); if(k>127){ strip=strip.substr(0,i)+String.fromCharCode(k)+strip.substr(i+1);}}} r=start+"/"+strip;}} return r;} function furnish{ $(".cn-fundraiser-banner, #fundraising").remove; OO=window.OO; Box.factory; ELP.gui.$content.prepend(ELP.gui.$wrapper); ELP.gui.fresh;} Box.factory=function{ var s,$bl,$el; ELP.config.css.factory; ELP.gui.$wrapper=$(" "); ELP.gui.$wrapper.addClass("noprint").attr("id",ELP.type) .css(ELP.config.css.box); ELP.gui.$buttons=$(" "); ELP.gui.$buttons.css({"float":"right", "vertical-align":"top"}); if(typeof ELP.prego==="object"){ if(typeof ELP.prego.supply==="string"){ ELP.prego.lib=mw.libs[ELP.prego.supply];} if(typeof ELP.prego.lib==="object"&&typeof ELP.prego.lib.$button==="function"){ $el=ELP.prego.lib.$button(ELP.type); $el.css({"float":"right", "vertical-align":"top"}); ELP.gui.$buttons.append($el);}} ELP.gui.$wrapper.append(ELP.gui.$buttons); if(typeof ELP[Supersed]==="boolean"&&false){ s="Du verwendest noch das Skript '"+Supersed+"'. Der Nachfolger ist "+ELP.type+". Bitte ändere den Eintrag "; if(typeof ELP.fliegelflagel==="boolean"&&ELP.fliegelflagel){ s=s+"auf Fliegelflagel."; }else{ s=s+"in deiner common.js usw.";} $bl=$(" "); $bl.css({"color":"#FF00FF", "font-weight":"bold", "margin-bottom":"1em", "width":"70%"}); $el=$(" "+s+" "); $bl.append($el); ELP.gui.$wrapper.append($bl);} if(typeof ELP.talk==="object"){ $el=ELP.talk.furnish(ELP.lang.find("hintTalk")); $el.attr({"target":"ExtLPtalk"}); }else{ $el=$(" ");} $el.css({"font-size":"1.8em", "white-space":"nowrap"}).text(ELP.project.say); $bl=$(" "); $bl.css({"width":"70%"}).append($el); ELP.gui.$wrapper.append($bl); }; Box.fiat=function(access){ var s="$"+access,$r=null,$el; if(typeof this[s]==="object"){ $r=this[s]; }else{ if(access==="throbber"){ $r=$(" "); $r.attr("src","//upload.wikimedia.org/wikipedia/commons/d/de/Ajax-loader.gif") .attr("id",ELP.type+"-clock").css({"height":"20px"}); }else if(access==="spacer"){ $r=$(" "); $r.text("   "); }else{ $r=$(" "); $r.attr({"id":ELP.type+"-"+access, "type":"button"}).css({"border-color":"#E0E0E0 #E0E0E0 #707070 #707070", "float":"left"}); $el=$(" "); $el.css({"font-weight":"bolder"}); if(access==="show"){ $el.css({"color":"#00A000", "font-size":"120%", "font-weight":"bold", "padding":"2px"}).text("+"); }else{ $el.css({"color":"#FF0000", "padding":"2px"}).text("X");} $r.append($el); $r.click(this.flip);} this[s]=$r;} return $r; }; Box.fill=function{ var listed=(typeof Box.$ol==="object"),i,n; if(listed){ Pop.$ol.empty;} if(typeof Pop.complain==="object"){ if(!listed){ Pop.$ol=$("");} n=Pop.complain.length; for(i=0;i<n;i++){ Pop.$ol.append(Pop.complain[i]);} if(!Pop.$list){ Pop.$list=$(" "); Pop.$list.attr("id",ELP.type+"_list").css({"clear":"both"}); ELP.gui.$wrapper.append(Pop.$list);} if(!listed){ Pop.$list.append(Pop.$ol);}} }; Box.flip=function(after,assign){ var live=(typeof Pop.$list==="object"),list,s,submit,suspend; if(after===true){ list=assign; }else if(typeof Box.large==="boolean"){ list=(!Box.large); }else{ list=true;} submit=(list?"hide":"show"); suspend=(list?"show":"hide"); s="$"+suspend; if(typeof Box[s]==="object"){ Box[s].hide;} if(list){ if(live){ Pop.$list.show; }else{ Box.fill;} }else if(live){ Pop.$list.hide;} Box.flop(true); s="$"+submit; if(typeof Box[s]==="object"){ Box[s].show; }else if(typeof Box.$action==="object"){ Box.$action.append(Box.fiat(submit));} if(ELP.config.mode===1){ Box.future(true,list);} Box.large=list; }; Box.flop=function(align){ if(typeof this.$throbber==="object"){ this.$throbber.remove; delete this.$throbber;} if(align&&typeof this.$spacer!=="object"){ Box.$action.append(Box.fiat("spacer"));} }; Box.future=function(after,assign){ var r=false,s; if(typeof window.sessionStorage==="object"){ s=window.sessionStorage.getItem(ELP.type); if(!s){ s="";} if(after){ s=s.replace(/~details=.~/g,"")+"~details="+(assign?1:0)+"~"; window.sessionStorage.setItem(ELP.type,s); }else{ r=(s.indexOf("~details=1~")>=0);}} return r; }; Box.google={de:"de",fr:"fr" }; Content.fetch=function{ var i,n,swift,$external; if(typeof ELP.problems==="object"&&typeof this.pointer!=="object"){ swift="(?:ipedia|ibooks|imediafoundation|inews|iquote|isource|iversity|ivoyage|tionary"; if(ELP.scope!=="info"){ swift=swift+"|idata";} swift="\\/\\/[^/#?]*\\.?wik"+swift+")\.org/wiki/"; swift="^(?:[hft]+tps?:)?"+swift; this.reWiki=new RegExp(swift); n=ELP.problems.length; this.pointer={}; for(i=0;i<n;i++){ this.pointer[fair(ELP.problems[i].url)]=i;} $external=ELP.gui.$content.find(".external"); if($external.length){ $external.each(Content.found);}} }; Content.fill=function{ var i,n,r,$e; ELP.gui.$content.find("."+Content.signature).remove; Pop.complain=[]; Pop.limited=(ELP.scope!=="view"); if(typeof ELP.problems==="object"){ n=ELP.problems.length; if(n){ for(i=0;i<n;i++){ $e=Pop.factory(ELP.problems[i],Pop.complain.length,-1); if($e){ $e.attr({"data-problem":i}); Pop.complain.push($e);}}}} if(typeof Box.wikilinks==="object"){ n=Box.wikilinks.length; if(n){ for(i=0;i<n;i++){ Pop.friend(Box.wikilinks[i]);}}} if(Pop.complain.length){ r=true; }else{ delete Pop.complain; r=false;} return r; }; Content.flip=function(about){ var illusive=0.9,margin=10,j,k,offset,options,sign,$c; if(about.popup){ about.live=!about.live; }else{ $c=Pop.complain[about.id]; if($c){ if(about.sequence){ j=about.sequence.charCodeAt(0)-65; }else{ j=0;} sign=$c.attr("data-problem"); if(sign){ k=parseInt(sign,10); $c=Pop.factory(ELP.problems[k],about.id,j,about.section); }else if(about.syntax){ $c=$(" "); $c.text(ELP.lang.find("wikilink")); }else{ $c=false;}} if($c){ if(typeof this.$body!=="object"){ this.$body=$("body"); this.$window=$(window);} sign=Content.signature+"-"+about.id; if(about.sequence){ sign=sign+about.sequence;} $c.attr({"id":sign}).addClass(Content.signature+"-popup") .css({"display":"table", "font-family":"sans-serif", "font-size":"medium", "font-style":"normal", "font-variant":"normal", "padding-top":"3px", "visibility":"hidden"}); this.$body.append($c); $c=$("#"+sign); options={align:"center",anchor:false,height:$c.outerHeight+margin,padded:false,width:$c.outerWidth+margin}; $c.detach; options.$content=$c; options.$content.css({"display":"block", "visibility":"visible"}); about.popup=new OO.ui.PopupWidget(options); about.popup.$element.attr({"role":"tooltip"}).css({"opacity":illusive}); this.$body.append(about.popup.$element); this.$window.resize(function{ if(about.live){ about.live=false; about.popup.toggle(false);} }); about.live=1;}} if(about.popup){ if(about.live){ offset=about.$parent.offset; offset.left+=about.$parent.outerWidth/ 2; offset.top-=about.popup.height+5; if(offset.top<0){ offset.top=about.$parent.offset.top+about.$parent.outerHeight+3;} j=$(window.document).scrollLeft; k=this.$window.width+j; if(offset.left+about.popup.width / 2>k){ offset.left=k-about.popup.width / 2-2; if(offset.left<0){ offset.left=j+3;}} if(about.live===true){ about.popup.toggle(true);} about.popup.$element.offset(offset); if(about.live!==true){ about.popup.toggle(true);} }else{ about.popup.toggle(false);}} }; Content.found=function{ var $el=$(this),k,p,s; s=$el.attr("href"); if(s==="#"){ s=$el.attr("data-href");} if(s){ s=fair(far(s)); k=Content.pointer[s]; if(typeof k==="number"){ p=ELP.problems[k]; if(p.effective){ p.effective.push($el); }else{ p.effective=[$el];} }else if(Content.reWiki.test(s)){ p=[s,$el]; if(Box.wikilinks){ Box.wikilinks.push(p); }else{ Box.wikilinks=[p];}}} return true; }; Content.frame=function($a,allow){ var $el=$a.prevAll(":header"),r=false; if($el.length){ $el=$el.first.children(".mw-editsection"); if($el.length){ $el=$el.children("a"); r=$el.attr("href");}} if(!r){ $el=$a.parent("#mw-content-text"); if(!$el.length&&allow){ r=Content.frame($a.parent,allow-1);}} return r; }; Content.furnish=function($a,assign,another){ var sign="data-"+ELP.type.toLowerCase,id,max,section,styleNE,styleSW,syntax,widget,$el,$id,$span; if(!$a.attr(sign)){ $a.attr(sign,assign); max=20; section=false; id=assign+1; sign=id+(another?another:""); styleSW="#707070"; styleNE="#D8D8D8"; $id=$(" "); $id.attr({"class":Content.signature, "id":ELP.type+"_"+sign}); $a.attr({"target":Pop.forward("ExternalL")}).before($id).css(ELP.config.css.href); if(!Pop.limited){ $el=$a.closest(".references"); if(!$el.length){ section=this.frame($a,max); if(!section){ if(typeof this.start!=="string"){ section=mw.config.get("wgPageName"); this.start=mw.config.get("wgScript")+"?action=edit&section=0&title="+mw.util.wikiUrlencode(section);} section=this.start;}}} $span=$(" "); $el=$(" "); $el.css({"font-size":"25%"}).text(" "); $span.append($el); if(another){ syntax=false; }else{ syntax=$a.attr("data-syntax");} $el=$(""); widget={$parent:$el,id:assign,section:section,sequence:another,syntax:syntax,popup:false}; $el.attr({"data-sign":"#"+assign, "href":"#", "title":ELP.type}).click(function{ Content.flip(widget); return false; }).css({"background":"#D0D0D0", "border-top-color":styleNE, "border-right-color":styleNE, "border-left-color":styleSW, "border-bottom-color":styleSW, "border-style":"solid", "border-width":"2px", "color":"#000000", "display":"inline-block", "padding-left":"2px", "padding-right":"2px", "padding-top":"1px", "padding-bottom":"1px", "text-decoration":"none"}).text(sign); $span.append($el); $el=$(" "); $el.css({"font-size":"25%"}).text(" "); $span.append($el).attr({"class":Content.signature+"-button"}); $a.after($span);} }; Content.signature=ELP.type+"_el-id"; Pop.facetter=function(access){ var join=access.indexOf("//"),$r=false,got,i,n,s,shift,spacer,start,sub,$el; if(join>=0){ join+=2; i=access.indexOf("/",join); if(i>=0){ s=access.substr(join,i-join); got=/\.([^.]+\.[a-z]+)$/.exec(s); shift=Pop.forward("ExternalL"); if(got){ sub=got[1]; $el=$(""); $el.attr({"href":access.substr(0,join)+sub, "target":shift}); $el.text(sub); $r=$(""); $r.append($el);} join=i+1; i=access.indexOf("?",join); if(i<0){ sub=access; }else{ sub=access.substr(0,i);} sub=sub.substr(join); if(sub!==""||i>=0){ if($r){ spacer=" · "; $el=$(" "); $el.text(spacer); $r.append($el); }else{ $r=$("");} start=access.substr(0,join-1); $el=$(""); $el.attr({"href":start+"/", "target":shift}).text(start); $r.append($el); if(sub!==""){ got=sub.split("/"); n=got.length; for(i=0;i"); $el.attr({"href":start, "target":shift}).text(s); $r.append($el);}}}}} return $r; }; Pop.factory=function(about,assigned,another,access){ var legal=true,$r=$((another<0?"":" ")),$ul=$(""),list,lock,i,j,n,s,spacer,$el,$uli; if(typeof about.effective==="object"){ spacer=" · "; s=about.url; list=(another<0); if(typeof about.listed==="boolean"&&about.listed){ lock=true; if(list){ $el=this.forbidden(s); }else{ $el=$(" "); $el.css({"font-weight":"bolder"}).text("SPAM");} }else if(list){ $el=$(""); $el.attr({"href":s, "target":Pop.forward("ExternalL")}).text(s);} if($el){ $r.append($el);} n=about.effective.length; if(list||n>1){ $uli=$("<li>"); for(i=0;i<n;i++){ if(i!==another){ if(i){ $el=$(" "); $el.text(spacer); $uli.append($el);} j=assigned+1; s=String.fromCharCode(i+65); $el=$("<a>"); $el.text(s).attr("href","#"+ELP.type+"_"+j+s); $uli.append($el); Content.furnish(about.effective[i],assigned,s);}} $ul.append($uli);} if(!lock){ $uli=this.fatal(s); if($uli){ $ul.append($uli); legal=false;} if(typeof about.link==="boolean"&&about.link){ $el=this.flow(s); if($el){ $ul.append($el);}} if(typeof about.since==="string"){ $ul.append(this.former(about.since));} if(typeof about.mode==="number"){ $ul.append(this.figure(about.mode,s));} if(typeof about.cit==="string"){ $ul.append(this.webcite(s,about.cit));} s=typeof about.wba; if(s==="string"||s==="boolean"){ $ul.append(this.wayback(about.url,about.wba));} $uli=this.flop(about.url,about.sub,about.less); if($uli){ $ul.append($uli);} if(typeof about.other==="object"){ $uli=this.further(about.other,about.url); if($uli){ $ul.append($uli);}} if(legal){ if(ELP.config.levels){ $uli=this.facetter(about.url); if($uli){ $ul.append($uli);}} if(ELP.config.lookup){ $uli=this.google(about.url,about.effective); if($uli){ $ul.append($uli);}}}} if(typeof about.learnt==="boolean"&&about.learnt){ $uli=$("<li>"); $el=$(" "); $el.css({"font-weight":"bold"}).text(ELP.lang.find("notdone")); $uli.append($el); $ul.append($uli); }else if(access){ $uli=$("<li>"); $el=$(" "); $el.text("["); $uli.append($el); $el=$("<a>"); $el.attr("href",access).text(ELP.lang.find("editSrc")); $uli.append($el); $el=$(" "); $el.text("]"); $uli.append($el); $ul.append($uli);} }else if(this.limited){ $r=false; }else if(about.learnt){ $el=$(" "); $el.css({"text-decoration":"line-through"}).text(about.url); $r.append($el); $el=$(" "); $el.text(ELP.lang.find("discard")); $uli=$("<li>"); $uli.append($el); $ul.append($uli); }else{ $r=false;} if($r){ if($ul.children.length){ $r.append($ul); }else if(!list){ $el=$(" "); $el.text("404"); $r.append($el).css({"text-align":"center"});}} return $r; }; Pop.fatal=function(access){ var i=access.indexOf("//"),$r=false,got,k,s,$el; if(i>=0){ s=access.substr(i+2); i=s.indexOf("/"); if(i>=0){ if(typeof this.rePort!=="object"){ this.rePort=new RegExp("^(.+):[0-9]+$"); this.reIPv4=new RegExp("^[0-9.]+$"); this.reIPv4s=new RegExp("^([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+)$"); this.reIPv6=new RegExp("^\\[[0-9.a-f:]+\\]$"); this.TLD2=new RegExp("^[0-9a-z][-0-9.a-z]*[0-9a-z]\\.[a-z]{2,}$");} s=s.substr(0,i).toLowerCase; got=this.rePort.exec(s); if(got){ s=got[1];} if(this.reIPv4.test(s)){ got=this.reIPv4s.exec(s); for(i=1;i<=4;i++){ k=parseInt(got[i],10); if(k>255){ $r=true; break;}} }else if(!this.reIPv6.test(s)&&!this.TLD2.test(s)){ $r=true;} if($r){ $r=$("<li>"); $el=$(" "); $el.text(ELP.lang.find("syntax")).css({"font-weight":"bold"}); $r.append($el);}}} return $r; }; Pop.favour=function(access,about){ var show=about,id,$a,$e,$r; if(typeof ELP.project[access]==="number"){ id=ELP.project[access]; if(!show){ show=ELP.lang.find("help");} $a=$("<a>"); $a.attr({"href":mw.util.getUrl("Special:Redirect")+"/page/"+id, "target":Pop.forward("help")}).text(show); if(about){ $r=$a; }else{ $r=$(" "); $e=$(" "); $e.text("("); $r.append($e).append($a); $e=$(" "); $e.text(")"); $r.append($e).css({"margin-left":"1em"});}} return $r; }; Pop.figure=function(answer,access){ var s=ELP.lang.find("mode"),$r=$("<li>"),$el=Pop.favour("idHTTPstat",s),i; if($el){ $r.append($el); s="";} $el=$(" "); s=s+" = "+answer; if(answer>=500&&answer<=599){ s=s+" ("+ELP.lang.find("mode5")+")"; i=access.indexOf("//"); if(i>0){ $el.text(s); $r.append($el); $el=$(" "); $el.text(" · "); $r.append($el); $el=$("<a>"); i=access.indexOf("/",i+2); if(i>0){ s=access.substr(0,i+1); }else{ s=access+"/";} $el.attr({"href":mw.util.getUrl("Special:Linksearch")+"/"+s, "target":Pop.forward("Linksearch")}); s=ELP.lang.find("more");} }else if(answer>=300&&answer<=399){ s=s+" ("+ELP.lang.find("mode3")+")"; }else if(answer<100){ s=s+" ("+ELP.lang.find("curl")+")";} $el.text(s); $r.append($el); return $r; }; Pop.flop=function(access,attempt,after){ var s=access,sub=attempt,i=s.lastIndexOf("|"),j=s.lastIndexOf("%7C"),like=false,story=false,$r=false,suffix,$el,$help,$show; if(typeof this.reEnd!=="object"){ this.reEnd=new RegExp("[(,.;?|]$"); this.reFile=new RegExp("[a-zA-Z0-9]\\.[a-zA-Z]"); this.rePipe=new RegExp("%7C$","i"); this.reSlash=new RegExp("//.+/.+/$"); this.reURL=new RegExp("[&#]");} if(i>0||j>0){ if(j>i){ s=s.replace(this.rePipe,"|"); suffix=s.substr(j+3); i=j; }else{ suffix=s.substr(i+1);} if(suffix){ if(this.reURL.test(suffix)){ suffix=false; }else if(this.reFile.test(suffix)){ suffix=false;} if(suffix){ story=ELP.lang.find("pipe"); $help=Pop.favour("idPipe"); $show=$(" "); $show.css({"font-weight":"bold", "margin-left":"1em"}).text("|"+suffix+"]"); if(!sub){ sub=s.substr(0,i); like=true;}}}} if(after||this.reEnd.test(s)||this.reSlash.test(s)){ story=(story?story+". ":"")+ELP.lang.find("special"); if(!sub){ sub=s.substr(0,s.length-1); like=true;}} if(story){ $r=$("<li>"); $el=$(" "); $el.text(story); $r.append($el);} if(typeof sub==="string"){ if(!$r){ $r=$("<li>");} story=(story?". ":"")+ELP.lang.find("sub"); $el=$(" "); $el.text(story); $r.append($el); if($help){ $r.append($help);} if($show){ $r.append($show);} $el=$("<a>"); $el.attr({"href":sub, "target":Pop.forward("ExternalL")}).css({"margin-left":"1em"}) .text(ELP.lang.find((like?"try":"success"))); $r.append($el);} return $r; }; Pop.flow=function(access){ var $r=false,parts,scheme,$a; if(typeof Pop.reScheme!=="object"){ Pop.reWiki=new RegExp("^((?:ht|f)tp)(s?)(//:.+)$","i");} parts=Pop.reWiki.exec(access); if(parts){ scheme=parts[1]+(parts[2]?"":"s"); $a=$("<a>"); $r=$("<li>"); $a.attr({"href":scheme+parts[3], "target":Pop.forward("ExternalL")}).text(scheme+"^//:"); $r.append($a);} return $r; }; Pop.forbidden=function(access){ var s=access+"/",j=s.indexOf("\\\\" ),k=s.indexOf("/"),$a=$("<a>"),$el=$(" "),$r=$(" "); $a.attr({"href":fair(access), "target":Pop.forward("ExternalL")}).css({"font-weight":"bold"}) .text(ELP.lang.find("blocked")); $r.append($a); $el.text(ELP.lang.find("blocking")).css({"margin-left":"1em"}); $r.append($el); $el=$(" "); $el.text(s.substring(j+2,k)).css({"font-style":"italic", "margin-left":"1em"}); $r.append($el); return $r; }; Pop.former=function(already){ var $el=$(" "),$r=$("<li>"); $el.text(ELP.lang.find("since")+already); $r.append($el); return $r; }; Pop.forward=function(assume){ return(ELP.config.loose?"_blank":assume); }; Pop.friend=function(about){ var src=about[0],$got=about[1],k,n,$a,$li,$ul,$uli; if(!$got.closest(Pop.wikiClasses).length){ k=this.complain.length; $got.attr({"data-syntax":"wikilink"}); $a=$("<a>"); $a.attr({"href":src, "target":Pop.forward("ExternalL")}).text(src); $li=$("<li>"); $li.append($a); $a=$("<a>"); n=k+1; $a.attr("href","#"+ELP.type+"_"+n).text(ELP.lang.find("wikilink")); $uli=$("<li>"); $uli.append($a); $ul=$("<ul>"); $ul.append($uli); $li.append($ul); Content.furnish($got,k); this.complain.push($li);} }; Pop.further=function(array,access){ var i,s,spacer,$el,n=array.length,$r=false; if(n){ $r=$("<li>"); $el=$(" "); s=(n===1?"other":"others"); spacer=" · "; $el.text(ELP.lang.find(s)); $r.append($el); for(i=0;i<n;i++){ $el=$(" "); $el.text((i?spacer:" ")); $r.append($el); s=array[i]; $el=$("<a>"); $el.attr({"href":mw.util.getUrl("Special:Redirect")+"/page/"+s, "target":Pop.forward("_blank")}); $el.text(s); $r.append($el);} $el=$(" "); $el.text(spacer); $r.append($el); $el=$("<a>"); $el.attr({"href":mw.util.getUrl("Special:Linksearch")+"/"+access, "target":Pop.forward("_blank")}).text(ELP.lang.find("current")); $r.append($el);} return $r; }; Pop.google=function(access,a){ var i=access.indexOf("//"),$r=false,j,n,parts,s,seek,words,$el; if(i>=0){ seek="https://www.google."+ELP.lang.search+"/search?q=site:"; i+=2; n=access.indexOf("/",i); words={}; if(n>0){ seek=seek+access.substring(i,n); s=access.substr(n).replace(/[#?].*$/g,"") .replace(/\.[a-z0-9]+$/g,""); parts=s.split("/"); n=parts.length; for(i=0;i<n;i++){ s=parts[i]; if(s){ words[s]=true;}}} for(i=0;i<a.length;i++){ $el=a[i]; s=$el.text.replace(/[-_|:,;.?!&{}+*=~'"\xA0\u202F]/g," ").replace(/\s+/g," "); parts=s.split(" "); for(j=0;j<parts.length;j++){ words[encodeURIComponent(parts[j])]=true;}} for(s in words){ seek=seek+"+"+s;} $el=$("<a>"); $el.attr({"href":seek, "target":Pop.forward("GoogleSearch")}); $el.text("Google"); $r=$("<li>"); $r.append($el);} return $r; }; Pop.wayback=function(access,almost){ var $el=$(" "),$r=$("<li>"); $el.text(ELP.lang.find("wayback")+" "); $r.append($el); $el=$("<a>"); $el.attr({"href":"http://wayback.archive.org/web/*/"+access.replace(/</g,"%3C"), "target":Pop.forward("wwwarchive")}).text(ELP.lang.find("wayback*")); $r.append($el); $el=$("<a>"); if(typeof almost==="string"&&almost.length>=10){ $el=$(" "); $el.text(" · "); $r.append($el); $el=$("<a>"); $el.attr({"href":"http://wayback.archive.org/web/"+almost+"/"+access, "target":Pop.forward("wwwarchive")}).text(ELP.lang.find("wayback!")); $r.append($el);} return $r; }; Pop.webcite=function(access,almost){ var $el=$(" "),$r=$("<li>"); $el.text(ELP.lang.find("webcite")+" "); $r.append($el); $el=$("<a>"); $el.attr({"href":"http://www.webcitation.org/"+almost, "target":Pop.forward("wwwarchive")}).text("webcitation.org"); $r.append($el); return $r; }; Pop.wikiClasses=".mw-warning-with-logexcerpt,.noprint,.plainlinks,.wikibase-entity-usage"; ELP.lang.fallback=function(access){ var r; if(typeof ELP.gui.texts[access]==="object"){ r=ELP.gui.texts[access].en; }else{ r="***????* "+access+" *????***";} return r; }; ELP.lang.fine=function(access){ var r; if(typeof ELP.gui.texts[access]==="object"){ r=ELP.prego.lib.translation(ELP.gui.texts[access]); }else{ r="***??* "+access+" *??***";} return r; }; ELP.gui.fresh=function{ var last,list,$bl,$span,$ul; if(typeof ELP.gui.$wrapper==="object"&&typeof ELP.problems==="object"&&ELP.problems){ $bl=$(" "); $bl.css({"float":"left", "vertical-align":"top"}); if(typeof ELP.talk==="object"&&ELP.talk){ list=ELP.talk.leader; if(typeof ELP.talk.last==="boolean"){ last=ELP.talk.last;} }else{ list=true;} if(ELP.problems){ if(list){ Box.$action=$bl; Box.$action.append(Box.fiat("throbber")); ELP.gui.$buttons.prepend(Box.$action); Content.fetch; if(Content.fill){ switch(ELP.config.mode){ case 1: list=Box.future(false); break; case 2: list=true; break; default: list=false;} Box.flip(true,list); }else{ Box.flop(false);} }else if(!ELP.config.lazy&&typeof ELP.talk.former==="function"){ $ul=ELP.talk.former; if($ul){ $bl=$(" "); $bl.css({"padding":"1em"}); $span=$(" "); $span.css({"font-weight":"bold"}).text(ELP.lang.find("discard")+":"); $bl.append($span).append($ul); ELP.gui.$wrapper.append($bl);}} }else{ $bl.css({"color":"#FF0000", "font-weight":"bold"}); $bl.text(ELP.lang.find("empty")); ELP.gui.$buttons.prepend($bl);} if(!list&&last){ ELP.talk.last=false; $bl=$(" "); $bl.css({"background-color":"#FFD0D0", "margin-right":"1em", "padding":"1em"}).text(ELP.lang.find("earlier")); ELP.gui.$wrapper.append($bl);} if(typeof ELP.follow==="function"){ ELP.follow;}} }; function fire($area){ ELP.gui.$content=$area; if(typeof ELP.gui.$wrapper!=="object"){ if(ELP.config.less){ furnish; }else{ mw.loader.using(["oojs","oojs-ui-core","oojs-ui-widgets"],furnish);}}} ELP[Sub].fire=function{ facilitated; if(typeof ELP.request==="string"&&ELP.request===Sub&&typeof ELP.project==="object"&&ELP.project&&typeof ELP.config==="object"&&ELP.config){ ELP.request=false; if(typeof ELP.config.less!=="boolean"){ ELP.config.less=false;} if(typeof ELP.config.levels!=="boolean"){ ELP.config.levels=false;} if(typeof ELP.prego.lib==="object"&&typeof ELP.prego.lib.translation==="function"){ ELP.lang.find=ELP.lang.fine; }else{ ELP.lang.find=ELP.lang.fallback;} if(typeof ELP.config.loose!=="boolean"){ ELP.config.loose=false;} if(typeof ELP.config.low!=="boolean"){ ELP.config.low=false;} if(!ELP.config.low&&typeof ELP.talk==="object"&&ELP.talk&&typeof ELP.talk.leader==="boolean"&&ELP.talk.leader){ ELP.config.low=false;} if(typeof ELP.config.lookup==="boolean"&&ELP.config.lookup){ ELP.lang.standard=mw.config.get("wgContentLanguage"); if(typeof Box.google[ELP.lang.standard]){ ELP.lang.search=Box.google[ELP.lang.standard]; }else{ ELP.lang.search="com";} }else{ ELP.config.lookup=false;} if(!ELP.config.low){ mw.hook("wikipage.content").add(fire);}} }; function first{ facilitated; if(typeof ELP.featuring==="function"){ ELP.featuring(ELP[Sub].fire);}} first; }(window.mediaWiki,window.jQuery)); /// EOF externalLinkProblem/gui/r.js