User:Ryan Postlethwaite/Rollback.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:Ryan Postlethwaite/Rollback. |
// This is a modified, customised version of [[User:DerHexer/rollback.js]]. It was created by [[User:DerHexer]].
// 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]);
}
}
if(!usersignature) var usersignature = '\~\~\~\~' //Standardsignatur
function fillActionPageRevert() {
if (UrlParameters["diff"] > "") {
function searchRollbackLink() {
var tds = document.getElementsByTagName("td");
for (var i=0; i<tds.length; i++) {
var td = tds[i];
if (td.className != "diff-ntitle") continue;
var as = td.getElementsByTagName("a");
for (var j=0; j<as.length; j++) {
var a = as[j];
if (!/.*action=rollback.*/(a.href)) continue;
var newlink = document.createElement('a');
newlink.setAttribute('href', a.href);
var EditTextNode = document.createTextNode("normal rollback");
newlink.appendChild(EditTextNode);
as[j].parentNode.insertBefore( newlink, as[j].nextSibling );
as[j].parentNode.insertBefore( document.createTextNode(' | '), as[j].nextSibling );
return a;
}
}
return tds;
}
function RollAndSpam(rolluri) {
location.href = rolluri;
var backrolled = rolluri.split("from=")[1].split("&token=")[0];
var vandalizedpage = wgPageName;
var uri = "http://wiki.riteme.site/w/index.php?title=User talk:" + backrolled + "&vandalizedpage=" + vandalizedpage + "&action=edit&spam=1";
window.setTimeout(function() { location.href = uri; }, 500);
}
var revlink = searchRollbackLink();
revlink.onclick = function() { RollAndSpam(revlink.href); return false; }
}
if ( (UrlParameters["spam"] > "") && (UrlParameters["vandalizedpage"] > "") ) {
document.editform.wpMinoredit.checked=true;
if (document.forms["editform"].wpTextbox1.value == "") {
document.editform.wpSummary.value = "Note Editing tests on \[\[" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\]\]";
document.forms["editform"].wpTextbox1.value = "\{\{subst\:uw-test1\|" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\}\} " + usersignature;
window.setTimeout(function() { window.close(); }, 1000);
} else {
var now = new Date();
var actual_time = now.getTime();
var splitted = document.forms["editform"].wpTextbox1.value.split("<!--");
var last_time = splitted[splitted.length-1].match(/([\:\d]+)\, (\d+) ([^\d]+) (\d+)/);
var last_timestamp = Date.parse(RegExp.$2 + " " + RegExp.$3 + " " + RegExp.$4 + " " + RegExp.$1 + ":00 GMT");
var difftime = last_timestamp + 86400000 - actual_time;
if (difftime < 0) {
document.editform.wpSummary.value = "Note: Editing tests on \[\[" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\]\]";
document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\n\n\{\{subst\:uw-test1\|" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\}\} " + usersignature;
window.setTimeout(function() { window.close(); }, 1000);
} else {
if ((splitted[splitted.length-1].search(/uw\-[^\d]*(\d)/) != -1) || (splitted[splitted.length-1].search(/Template\:Test/) != -1)) {
var matchedtemplate = splitted[splitted.length-1].match(/uw\-[^\d]*(\d)/);
var matchednumber = RegExp.$1;
var matchedtemplate2 = splitted[splitted.length-1].match(/Template\:Test(\d)/);
var matchednumber2 = RegExp.$1;
if ((matchednumber == 4) || (matchednumber2 == 4)) {
if (wgTitle.match(/\d+\.\d+\.\d+\.\d+/)) {
var blockurl = "http://wiki.riteme.site/w/index.php?title=Special:Blockip/" + wgTitle;
} else {
var blockurl = "http://wiki.riteme.site/w/index.php?title=Special:Blockip/" + wgTitle;
}
window.setTimeout(function() { location.href = blockurl; }, 1000);
} else if ((matchednumber == 3) || (matchednumber2 == 3)) {
document.editform.wpSummary.value = "Final warning: Vandalism on \[\[" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\]\]";
document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\n\n\{\{subst\:uw-vandalism4\|" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\}\} " + usersignature;
window.setTimeout(function() { window.close(); }, 1000);
} else {
document.editform.wpSummary.value = "Warning: Vandalism on \[\[" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\]\]";
document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\n\n\{\{subst\:uw-vandalism3\|" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\}\} " + usersignature;
window.setTimeout(function() { window.close(); }, 1000);
}
} else {
document.editform.wpSummary.value = "Note: Editing tests on \[\[" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\]\]";
document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\n\n\{\{subst\:uw-test1\|" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\}\} " + usersignature;
window.setTimeout(function() { window.close(); }, 1000);
}
}
}
}
}
if ( (UrlParameters["diff"] > "") || ( (UrlParameters["spam"] > "") && (UrlParameters["vandalizedpage"] > "") ) || (UrlParameters["addtemplate"] > '') ) {
addOnloadHook(fillActionPageRevert);
}