User:Morton devonshire/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// Script from [[User:Lupin/recent2.js]]
mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');

function addDeleteLink() {
    var targetSpan = document.getElementById('specialDeleteTarget');
    var linkSpan = document.getElementById('specialDeleteLink');
    if (targetSpan == null || linkSpan == null) return;

    var targetLink = targetSpan.getElementsByTagName("A")[0];
    if (targetLink == null) return;

    var targetTitle = targetLink.childNodes[0].data;

    var deleteHref = "http://en.wikipedia.org/w/index.php?action=delete&title=" + escape(targetTitle);

    var deleteSpan = null;
    with (easyDom) {
        deleteSpan = span({ "class": "plainlinks" }, " (", a({ "href": deleteHref, "class": "external text" }, "delete"), ")");
    }

    linkSpan.appendChild(deleteSpan);
}
addOnloadHook(addDeleteLink);

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Mike_Dillon/easydom.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');