User:Az1568/monobook.js

From Wikimedia Foundation Governance Wiki
Revision as of 21:01, 31 December 2009 by Cbrown1023 (talk | contribs) (+ForceLinkstoDelete)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
// <source lang="javascript">
importScriptURI('http://meta.wikimedia.org/w/index.php?title=User:Az1568/global.js&action=raw&ctype=text/javascript')
// </source>

function ForceLinksToDelete() {
    var links = document.getElementById('bodyContent').getElementsByTagName('a');
    for(var i=0; i<links.length; i++) {
        if(!links[i].href.match('/w/index.php')) {
            links[i].href = links[i].href.replace(/(#|$)/, "?action=delete&wpReason=Test+page;+Nolonger+needed$1");
        }
    }
 }
addOnloadHook(function() {ForceLinksToDelete()});