Wikipedia:WikiProject User scripts/Scripts/Unwatch

This is an old revision of this page, as edited by Jnothman (talk | contribs) at 04:12, 5 January 2006 (rv. Ilmari was right =)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

// This script adds an "unwatch" link to each entry in your watchlist. This version works regardless of whether you have the "Enhanced recent changes" option selected in your user preferences.


addOnloadHook(function () {
    if (window.___location.href.indexOf("Special:Watchlist") == -1) return;
    var links = document.getElementById('content').getElementsByTagName('a');
    for (var i = 0; i < links.length; i++) {
        if (links[i].href.substring(links[i].href.length-15) != '&action=history')
            continue;
        var unwatch = document.createElement('a');
        unwatch.href = "/w/index.php?title=Special:Watchlist&action=submit&remove=1&id[]="+encodeURIComponent(links[i].title);
        unwatch.title = "Unwatch "+links[i].title;
        unwatch.appendChild(document.createTextNode("unwatch"));
        links[i].parentNode.insertBefore(unwatch, links[i].nextSibling);
        links[i].parentNode.insertBefore(links[i].previousSibling.cloneNode(true), unwatch);
    }
});

//