MediaWiki:Gadget-PR-robot.js
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
- Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
- Opera: Strg+F5
function match_callback(text){
var sp = document.getElementById("wpRobot");
if(sp) sp.innerHTML = "";
if(text=="ok") window.location.href=window.location.href;
else alert(text);
}
function do_match(){
var sp = document.getElementById("wpRobot");
if(sp) sp.innerHTML = "matching…";
request_url = "http://toolserver.org/~thomasv/robot.php?cmd=match&title="+mw.config.get('wgPageName')+"&lang="+mw.config.get('wgContentLanguage')+"&user="+mw.config.get('wgUserName');
var scriptObj = document.createElement("script");
scriptObj.setAttribute("type", "text/javascript");
scriptObj.setAttribute("src", request_url);
scriptObj.setAttribute("id", "match_cb");
var headLoc = document.getElementsByTagName("head").item(0);
headLoc.appendChild(scriptObj);
}
function add_match_button(){
var l = document.getElementsByClassName("mw-headline");
for (var i = 0; i < l.length ; i++) {
if( l[i].id.substring(0, 7) == "MATCH_:" ) {
l[i].innerHTML = l[i].innerHTML.replace('__MATCH__:','<span id="wpRobot"><a href="javascript:do_match();">'+ '__MATCH__:' + '</a></span>' ) ;
}
}
}
$(add_match_button);
function do_split(){
var sp = document.getElementById("wpRobot");
if(sp) sp.innerHTML = "splitting…";
request_url = "http://toolserver.org/~thomasv/robot.php?cmd=split&title="+mw.config.get('wgPageName')+"&lang="+mw.config.get('wgContentLanguage')+"&user="+mw.config.get('wgUserName');
var scriptObj = document.createElement("script");
scriptObj.setAttribute("type", "text/javascript");
scriptObj.setAttribute("src", request_url);
scriptObj.setAttribute("id", "match_cb");
var headLoc = document.getElementsByTagName("head").item(0);
headLoc.appendChild(scriptObj);
}
function add_split_button(){
var l = document.getElementsByClassName("mw-headline");
for (var i = 0; i < l.length ; i++) {
if( l[i].id.substring(0, 6) == "Seite:" ) {
if ( self.skin=="vector" ) a = document.getElementById("p-namespaces");
else var a = document.getElementById("p-cactions");
if (!a) return;
var b = a.getElementsByTagName("ul");if (!b) return;
b[0].innerHTML = b[0].innerHTML
+ '<li id="ca-split">'
+ '<span id="wpRobot"><a href="javascript:do_split();">split</a></span></li>';
break;
}
}
}
$(add_split_button);