User:Chris-martin/monobook.js

/** * Generic functions used in scripts */ function addOnload(func) { if ( window.addEventListener ) window.addEventListener( 'load', func, false ); else if ( window.attachEvent ) window.attachEvent( 'onload', func ); } function clearElement(e) { while(e.firstChild) e.removeChild(e.firstChild); } function replaceText(e, text) { clearElement(e); e.appendChild(document.createTextNode(text)); } function getArticleHeader { var h1 = document.getElementsByTagName("h1"); for (var i=0; i<h1.length; i++) if (h1[i].className == "firstHeading") return h1[i]; return false; }

//-

/** * Detects 'wrongtitle' template, removes it, and changes the article title */ function titleFix { var dd = document.getElementsByTagName("dd"); if (dd.length==0) return false; dd = dd[0]; // the dd element if (!dd.firstChild) return false; var italic = dd.firstChild; // the italics element if (italic.firstChild.nodeValue.substring(0,32) == "The title of this article should"     || italic.firstChild.nodeValue.substring(0,32) == "The correct title of this articl" ) { bold = italic.childNodes[1] // the bold element replaceText(getArticleHeader, bold.firstChild.nodeValue); dd.parentNode.style.visibility = "collapse"; } } addOnload(titleFix);

//-

/** * Interiot's javascript edit counter */ if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) { mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js'         + '&action=raw&ctype=text/javascript'); }

//-

/** * User:Lupin/popups.js */ mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' + '&action=raw&ctype=text/javascript');