User:Avenue/monobook.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
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 of whether the code is safe, you can ask at the help desk.
// [[User:Lupin/popups.js]] - please include this line 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>'); // For Interiot's tool document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); // This will add an [edit top] link at the top of all pages except preview pages // by User:Pile0nades // Add an [edit top] link to pages addOnloadHook(function () { // if this is preview page or generated page, stop if(document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -1) return; // get the page title var pageTitle = document.title.split(" - ")[0].replace(" ", "_"); // create div and set innerHTML to link var divContainer = document.createElement("div"); divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-right:15px;margin-top:3px;">[<a href="/w/index.php?title='+pageTitle+'&action=edit§ion=0" title="'+document.title.split(" - ")[0]+'">edit top</a>]</div>'; // insert divContainer into the DOM before the h1 if(window.location.href.indexOf("&action=edit") == -1) document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]); if(window.location.href.indexOf("&action=edit§ion=0") != -1) document.getElementById("wpSummary").value = "/* Intro */ "; }); // annoyMe (from [[Wikipedia:Recovering from Wikipediholism/reminder]]) function annoyMe() { var time = +(new Date()); var remainder = time % annoy.freq; if ( remainder < annoy.duration ) return rileMeUp( annoy.duration - remainder ); annoy_runOnce( function() { rileMeUp( annoy.duration ); }, annoy.freq - remainder ); } function rileMeUp( length ) { for (var i=0; i<document.links.length; ++i) { document.links[i].oldhref=document.links[i].href; document.links[i].href=annoy.target; } annoy_runOnce( deRile, length ); } function deRile() { for (var i=0; i<document.links.length; ++i) { document.links[i].href=document.links[i].oldhref; } annoy_runOnce( function() { rileMeUp( annoy.duration ) }, annoy.freq - annoy.duration ); } window.annoy={ freq: 1000*60*60, duration: 1000*60, target: 'http://en.wikipedia.org/wiki/Wikipedia:Recovering_from_Wikipediholism' } addOnloadHook( annoyMe ); window.annoy_runOnce=function(f, time) { var i=annoy_runOnce.timers.length; var ff = function () { clearInterval(annoy_runOnce.timers[i]); f() }; var timer=setInterval(ff, time); annoy_runOnce.timers.push(timer); } annoy_runOnce.timers=[];