User:Skagedal/monobook.js
From Wikipedia, the free encyclopedia
If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure whether the code is safe, you can ask at the appropriate village pump.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
// for easy reverts // document.write('<SCRIPT SRC="http://sam.zoy.org/wikipedia/godmode-light.js"><\/SCRIPT>'); // From [[User:Cryptic/oldrevisiontodiffs.js]]: // (slightly edited so that diff links don't show as external links) //<pre><nowiki> // Like document.getElementsByTagName, but finds only direct children of a given node function node_getElementsByTagName(node, tag) { var arr = new Array; tag = tag.toUpperCase(); for (node = node.firstChild; node; node = node.nextSibling) if (node.tagName == tag) arr[arr.length] = node; return arr; } addOnloadHook(function () { var node = document.getElementById('contentSub'); // monobook-like skins if (!node) // classic-like skins { var h1s = document.getElementsByTagName('h1'); for (var i = 0; i < h1s.length; ++i) if (h1s[i].className && h1s[i].className.indexOf('pagetitle') >= 0) { node = h1s[i].nextSibling; break; } } if (node && node.firstChild && node.firstChild.nodeType == Node.TEXT_NODE && node.firstChild.data.indexOf("Revision as of") >= 0) { var as = node_getElementsByTagName(node, 'a'); if (as[0].firstChild.data == "view current revision") { var a = document.createElement('a'); a.style.background = "none"; a.style.padding = "0"; a.href = as[1].href.replace(/&direction=prev&oldid=/, '&diff=prev&oldid='); a.appendChild(document.createTextNode('(diff) ')); node.insertBefore(a, as[1]); a = document.createElement('a'); a.style.background = "none"; a.style.padding = "0"; a.href = as[2].href.replace(/&direction=next&oldid=/, '&diff=next&oldid='); a.appendChild(document.createTextNode(' (diff)')); node.appendChild(a); } } }); // [[User:Lupin/popups.js]] document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //</nowiki></pre>

