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. */

//References for all elements var htmlDocument = document.getElementsByTagName("*"); var $html = $("*");

//Some scripts importArticles({   type: "script",    articles: [        "User:MateyY/CommentsDisabled.js",        "w:dev:OasisToolbarButtons/code.js"    ] });

/* 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);

/* Replace "\-\-\-" with "—" on all text areas and text inputs * By MateyY */ $(function {    $("textarea").keydown(function { for (var i = 0; i < htmlDocument.length; i++) { document.getElementsByTagName("textarea")[i].value = document.getElementsByTagName("textarea")[i].value.replace(/\-\-\-/g,"—"); }    }); });

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