User:Sumurai8/adddelbutton.js

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.
/* Request by Abigor to add del-button to rc-list */

function addDelToRc() {
    //This will fail when not using a real browser...
    l = document.getElementsByClassName('special')[0].getElementsByTagName('li')
    for ( i = 0 ; i < l.length ; i++ ) {
        y = l[i].getElementsByTagName('a')[0].innerText
        if ( y == "diff" || y == "hist" ) {
            //It's not a logentry
            x = l[i].getElementsByTagName('a')[0]
            t = x.href.replace(RegExp('http://meta.wikimedia.org/w/index.php[?]title=', 'g'), '').replace(RegExp('&curid=.*', 'g'), '')
            //t contains the title ; please note the [?] is a workaround
            b = ""
            if (y == "hist") {
                b = "diff | "
            }
            x.outerHTML = "<a href=\"http://meta.wikimedia.org/w/index.php?acion=delete&wpReason=please%20read%20Meta's%20[[WM:IP|inclusion%20policy]]&title="+t+"\">del</a> | "+b+x.outerHTML
            l[i].innerHTML = l[i].innerHTML.replace("(diff | ", "(")
        }
    }
}

$(addDelToRc)