User:PerfektesChaos/js/externalLinkProblem/talk/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. |
Documentation for this user script can be added at User:PerfektesChaos/js/externalLinkProblem/talk/r. |
/// User:PerfektesChaos/js/externalLinkProblem/talk/r.js
/// 2018-08-24 PerfektesChaos@de.wikipedia
/// Fingerprint:#0#3DF6CBBE#
/// @license GPL [//www.mediawiki.org/w/COPYING](+GFDL,LGPL,CC-BY-SA)
///<nowiki>
(function(mw,$){
"use strict";
var Version=2.8,ELP="externalLinkProblem",Sub="talk",Section="#deadurl_",SubjectPg="SubjectPg";
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[Sub].texts!=="object"){
ELP[Sub].texts={
"subjectPage":{"en":"article","de":"Artikel"},
"subjectPage-edit":{"en":"edit entire article source code","de":"Gesamten Artikelquelltext bearbeiten"}
};}
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 fed(about){
if(typeof ELP.gui==="object"&&ELP.gui&&typeof ELP.gui.fresh==="function"&&(ELP.talk.leader||ELP.problems===null)){
ELP.gui.fresh(about);}}
function feed(){
var launch=ELP.talk.leader,lazy,low;
if(typeof ELP.config.lazy==="boolean"){
lazy=ELP.config.lazy;
}else{
ELP.config.lazy=false;}
if(typeof ELP.config.low==="boolean"){
low=ELP.config.low;
}else{
ELP.config.low=false;}
if(!low){
launch=true;
if(typeof ELP.raw==="object"&&ELP.raw&&typeof ELP.raw.fire==="function"){
ELP.raw.fire(fed);
}else{
ELP.feed("raw",function(){
ELP.raw.fire(fed);
});}
if(!lazy){
ELP.feed("extlinks",fed);}}
if(launch){
ELP.request="gui";
ELP.feed(ELP.request,fed);}}
function fetched(arrived){
var q;
if(typeof arrived==="object"&&typeof arrived.query==="object"){
q=arrived.query;
if(typeof q.pageids==="object"&&typeof q.pages==="object"){
ELP.talk.id=q.pageids[0];
q=q.pages[ELP.talk.id];
if(q&&typeof q.categories==="object"){
feed();}}}}
function find(){
var env=mw.config.get(["wgFormattedNamespaces","wgTitle"]),q=new mw.Api(),w={action:"query",indexpageids:true,prop:"categories"
};
ELP.envNS=env.wgFormattedNamespaces;
ELP.spot=env.wgTitle;
ELP.talk.stuff=ELP.envNS[ELP.nsubject+1]+":"+ELP.spot;
w.titles=ELP.talk.stuff.replace(/\s/g,"_");
w.clcategories="category:"+ELP.project.template.scan;
q.get(w).done(fetched);}
function fire(){
var lone;
if(typeof ELP.config.lone==="boolean"){
lone=ELP.config.lone;}
if(ELP.talk.leader){
if(lone){
lone=(ELP.scope!=="view");}
if(!lone&&true){
mw.loader.using(["mediawiki.api"],find);}
}else if(!lone&&typeof ELP.project.template.scan==="string"&&ELP.project.template.scan&&$.inArray(ELP.project.template.scan,mw.config.get("wgCategories"))>=0){
feed();}}
function flip(action){
var $r=$("<a />"),shift="subjectPage",params,s;
if(ELP.config.loose){
s="_blank";
}else{
s=SubjectPg;}
if(action){
params={action:"edit"};
shift=shift+"-edit";}
$r.attr({"href":ELP.title.getUrl(params),"id":ELP.type+"-"+shift,
"target":s});
$r.css({"background-color":"#F0F0F0","border-color":"#E0E0E0 #E0E0E0 #707070 #707070",
"border-style":"solid","border-width":"2px",
"display":"inline-block","font-size":"small",
"font-weight":"normal","line-height":"1em",
"margin-left":"2em","padding":"0.3em",
"text-decoration":"none","vertical-align":"super",
"white-space":"nowrap"});
ELP.gui.texts[shift]=ELP.talk.texts[shift];
$r.text(ELP.lang.fine(shift));
return $r;}
function furnish(){
var $head;
if(typeof ELP.gui==="object"&&ELP.gui&&typeof ELP.gui.texts==="object"&&ELP.gui.texts&&typeof ELP.lang==="object"&&ELP.lang&&typeof ELP.lang.fine==="function"){
$head=$(Section);
if($head.length){
$head=$head.parent(".mw-headline");
if($head.length){
if(typeof ELP.spot!=="string"){
ELP.spot=mw.config.get("wgTitle");}
ELP.title=new mw.Title(ELP.spot,ELP.nsubject);
$head.after(flip(false));}}}}
ELP[Sub].fire=function(){
facilitated();
if(typeof ELP.config==="object"&&ELP.config&&typeof ELP.project==="object"&&ELP.project&&typeof ELP.project.template==="object"&&ELP.project.template&&typeof ELP.request==="object"&&ELP.request&&typeof ELP.request[0]==="number"){
ELP.nsubject=ELP.request[0];
ELP.talk.leader=ELP.request[1];
ELP.request=false;
mw.loader.using(["mediawiki.util"],fire);}
};
ELP.talk.former=function(){
var i,n,o,u,$li,$r;
if(typeof ELP.problems==="object"&&ELP.problems&&typeof ELP.problems.length==="number"){
n=ELP.problems.length;
if(n){
u=[];
for(i=0;i<n;i++){
o=ELP.problems[i];
if(!(o.learnt||o.live)){
u.push(o.url);}}
if(u.length){
$r=$("<ul>");
for(i=0;i<u.length;i++){
$li=$("<li>");
$li.text(u[i]);
$r.append($li);}}}}
return $r;
};
ELP.talk.furnish=function(about){
var $r=$("<a />"),s=Section;
if(typeof ELP.project.template.stamp==="string"&&ELP.project.template.stamp){
Section=Section+ELP.project.template.stamp;}
if(ELP.talk.leader){
if(ELP.config.loose){
s="_blank";
}else{
s="ExternalL";}
$r.attr({"target":s,"title":about});
s=mw.util.getUrl("Special:Redirect/page/"+ELP.talk.id);
}else{
s="";
mw.loader.using(["mediawiki.Title"],furnish);}
$r.attr("href",s+Section);
return $r;
};
function first(){
facilitated();
if(typeof ELP.featuring==="function"){
ELP.featuring(ELP[Sub].fire);}}
first();
}(window.mediaWiki,window.jQuery));
/// EOF</nowiki>externalLinkProblem/talk/r.js