User:Rodejong/unwatch.js

//Unwatchlink- // // Unwatchlink per item on watchlist === // På "overvågningsliste" bliver tilføjet "unwatch" ved hver artikel $(function { // Only for "Special:Watchlist":    if (window.location.href.indexOf("Special:Watchlist") == -1) return;     // not for "Watchlist view and edit":    if (window.location.href.indexOf("Special:Watchlist/edit") > 0) return;    // Idem, via link on "Edit Raw Watchlist":    if (window.location.href.indexOf("Special:Watchlist/raw") > 0) return;     var query_prefix = "&action=unwatch";    var count = 0;    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');        count++;        if (count>35) {         break;        }        unwatch.href = "/w/index.php?title=" + encodeURIComponent(links[i].title) + query_prefix;        unwatch.title = "Remove "+links[i].title+" from your Watchlist"; unwatch.appendChild(document.createTextNode("unwatch")); links[i].parentNode.insertBefore(unwatch, links[i].nextSibling); // kluge to handle case where "diff" is unlinked: var delim = links[i].previousSibling; delim = (delim.nodeType == 3 ? delim.nodeValue : ""); links[i].parentNode.insertBefore(document.createTextNode(delim.replace(/^.*diff/, "")), unwatch); }

});