Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.
- Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
- Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
- Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
// Dient dem schnellen globalen Sperren
// Ursprünglich von [[Benutzer:DerHexer]]
// <nowiki>
// get URL parameters (used for page type variables)
var UrlParameters = new Array ();
readparams();
function readparams() {
var asReadInUrlParameters;
var asReadInUrlParameter;
// Get URL parameters
asReadInUrlParameters = location.search.substring(1, location.search.length).split("&");
for (i = 0; i < asReadInUrlParameters.length; i++) {
asReadInUrlParameter = asReadInUrlParameters[i].split("=");
UrlParameters[decodeURIComponent(asReadInUrlParameter[0])] = decodeURIComponent(asReadInUrlParameter[1]);
}
}
function addLinkToCentralAuth() {
var lis = document.body.getElementsByTagName("ul")[0].getElementsByTagName("li");
for (i=0; i < lis.length; i++) {
if( mw.config.get('wgCanonicalSpecialPageName') == 'Ipblocklist' ) {
if(lis[i].getElementsByTagName('span')[1].getAttribute('class') == 'mw-usertoollinks') {
var username = lis[i].getElementsByTagName("a")[4];
if(username) {
username = username.childNodes[0].nodeValue;
if (username.search(/\d+\.\d+\.\d+\.\d+/) == -1) {
username = username.replace(/ /g, "%20").replace(/&/g, "%26").replace(/\"/g, "%22").replace(/\+/g, "%2B");
var placetoadd = lis[i].getElementsByTagName("a")[6];
} else {
continue;
}
} else {
continue;
}
} else {
continue;
}
} else if ( mw.config.get('wgCanonicalSpecialPageName') == 'Listusers' ) {
var placetoadd = lis[i];
var username = lis[i].getElementsByTagName('a')[0].innerHTML;
} else if ( mw.config.get('wgCanonicalSpecialPageName') == 'GlobalUsers' ) {
var placetoadd = lis[i];
var username = lis[i].innerHTML.replace(/\<a.*\>/,'replaced');
var brackets = username.match(/\(([^\)]*)\)/g);
brackets = '.{2}'+RegExp.$1+'.';
username = username.replace(new RegExp(brackets),'').replace(/ /g, "%20").replace(/&/g, "%26").replace(/\"/g, "%22").replace(/\+/g, "%2B");
} else if ( mw.config.get('wgCanonicalSpecialPageName') == 'Log' ) {
if(lis[i].getAttribute('class') == 'mw-logline-block' || lis[i].getAttribute('class') == 'mw-logline-suppress' || lis[i].getAttribute('class') == 'mw-logline-globalauth') {
if (lis[i].getAttribute('class') != 'mw-logline-globalauth') { var username = lis[i].getElementsByTagName("a")[4]; } else { var username = lis[i].getElementsByTagName("a")[5]; }
if(username) {
username = username.childNodes[0].nodeValue.replace(/ /g, "%20").replace(/&/g, "%26").replace(/\"/g, "%22").replace(/\+/g, "%2B");
if (lis[i].getAttribute('class') == 'mw-logline-suppress') username = username.replace(/[^\:]*\:/,'');
if (lis[i].getAttribute('class') == 'mw-logline-globalauth') username = username.replace(/User\:/,'').replace(/\@global/,'');
} else {
continue;
}
if(username.search(/\d+\.\d+\.\d+\.\d+/) == -1) {
if (lis[i].getAttribute('class') == 'mw-logline-suppress') {
var placetoadd = lis[i].getElementsByTagName("a")[4];
} else if (lis[i].getAttribute('class') == 'mw-logline-globalauth') {
var placetoadd = lis[i].getElementsByTagName("a")[5];
} else {
var placetoadd2 = lis[i].getElementsByTagName("span")[1].getElementsByTagName('a');
var placetoadd = placetoadd2[placetoadd2.length-1];
}
} else {
continue;
}
} else {
continue;
}
}
var newlink = document.createElement('a');
newlink.setAttribute('href', 'https://secure.wikimedia.org/wikipedia/meta/w/index.php?title=Special:CentralAuth&target=' + username);
var EditTextNode = document.createTextNode("LinkToCA");
newlink.appendChild(EditTextNode);
placetoadd.parentNode.insertBefore( newlink, placetoadd.nextSibling );
if((mw.config.get('wgCanonicalSpecialPageName') != 'GlobalUsers') && (mw.config.get('wgCanonicalSpecialPageName') != 'Listusers')) placetoadd.parentNode.insertBefore( document.createTextNode(' | '), placetoadd.nextSibling );
}
}
if ( ( mw.config.get('wgCanonicalSpecialPageName') == 'Log' ) || ( mw.config.get('wgCanonicalSpecialPageName') == 'Listusers' ) || ( mw.config.get('wgCanonicalSpecialPageName') == 'GlobalUsers' ) || ( mw.config.get('wgCanonicalSpecialPageName') == 'Ipblocklist' ) )
$(addLinkToCentralAuth);
// </nowiki>