User:MateyY/global.js

/* All code on this page has been written by MateyY unless specified differently. Ask for permission before using. * This code affect all wikis MateyY goes to. */

//Shipping pages get some of their content hidden importScriptPage('User:MateyY/ShippingsRemoval.js', 'c');

//Insures pages with disabled comments have a button that states so importScriptPage('User:MateyY/CommentsDisabled.js', 'c');

//Adds on extra options on bar on the bottom of pages; the script was created by developers on Dev wiki importScriptPage('OasisToolbarButtons/code.js', 'dev');

//Extra buttons for admins (and above) importScriptPage('User:MateyY/ExtraAdminButtons.js', 'c');

/* Extra rollback links * By Monchoman45 * Button and load talk altered */

function CustomRollbacks { var Buttons = [{ //Your buttons go here. You can copy and paste this to make more than three text: 'spam', title: 'Revert spam', summary: 'Spam.' }, {		text: 'vandalism', title: 'Revert vandalism.', summary: 'Vandalism.' }, {		text: 'unneeded', title: 'Revert unneeded.', summary: 'Unneeded.' }, {		text: 'consensus needed', title: 'Revert consensus needed', summary: 'Consensus needed.' }, {		text: 'per forum', title: 'Revert per forum consensus', summary: 'Per previous forum consensus.' }, {		text: 'clutter', title: 'Revert image clutter', summary: 'Clutter.' }, {		text: 'bad image', title: 'Revert bad image', summary: 'Bad image.' }, {		text: 'speculation', title: 'Revert speculation', summary: 'Speculation.' }, {		text: 'null', title: 'Revert with no summary', summary: ' ' //This one has no summary }];

var list = document.getElementsByTagName('span'); for(i in list) { if(list[i].className == 'mw-rollback-link') { var link = list[i]; var rollback = link.innerHTML; for(j in Buttons) { var customlink = document.createElement('span'); customlink.innerHTML = rollback; customlink.className = 'customrollback'; //we do this to avoid an infinite loop, because when we insert a into the DOM, the list variable includes it				customlink.getElementsByTagName('a')[0].title = Buttons[j].title; customlink.getElementsByTagName('a')[0].href += '&summary=' + Buttons[j].summary; customlink.getElementsByTagName('a')[0].innerHTML = Buttons[j].text; if(wgPageName == 'Special:RecentChanges' || wgPageName == 'Special:Contributions') { link.parentElement.appendChild(customlink); customlink.outerHTML = ' ' + customlink.outerHTML; }				else { //assumes you're on history link.parentElement.insertBefore(customlink, link.nextSibling); customlink.outerHTML = ' | ' + customlink.outerHTML; }			}		}	}	for(i in list) { //why another one of these? we're fixing the class that we set to avoid an infinite loop if(list[i].className == 'customrollback') { list[i].className = 'mw-rollback-link'; }	} } addOnloadHook(CustomRollbacks);

/* See other JavaScript sheets I have written: ModuleStyle.js     Sample use: var gradient = true, startColor = "#000000", endColor = "#FFFFFF", borderRadiusPresent = true, borderRadiusLength = "10px"; importScriptPage('User:MateyY/ModuleStyle.js', 'c'); What you get is gradient and border radius on module boxes. Cross-browser support. All in two elementary lines of code.