Wikipedia:WikiProject User scripts/Scripts/Unwatch
// 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; // look for h4 followed by div/ul var headings = document.getElementById('content').getElementsByTagName('h4'); for (var i = 0; i < headings.length; i++) { var div = headings[i].nextSibling; while (div && div.nodeType == 3) div = div.nextSibling; // skip text nodes if (!div || !div.tagName) continue; if (div.tagName.toLowerCase() == 'div') { // enchanced recent changes // this is all tag soup, we just have to wade through it :-( var pagename = ""; for (var node = div.firstChild; node; node = node.nextSibling) { // grab the title of the first link on each line if (!pagename && node.tagName && node.tagName.toLowerCase() == 'a') pagename = node.title; if (pagename && node.tagName && node.tagName.toLowerCase() == 'br') pagename = ""; // add the (unwatch) link after diff and hist (look for distinctive text node) if (pagename && node.nodeType == 3 && node.nodeValue.substring(0, 5) == ") . .") { var unwatch = document.createElement('a'); unwatch.href = "/w/index.php?title=Special:Watchlist&action=submit&remove=1&id[]="+encodeURIComponent(pagename); unwatch.title = "Unwatch "+pagename; unwatch.appendChild(document.createTextNode("unwatch")); div.insertBefore(document.createTextNode("; "), node); div.insertBefore(unwatch, node); } } // XXX: might want to double check that pagename is null here, but I'll ignore it for now } else if (div.tagName.toLowerCase() == 'ul') { // unenchanced recent changes var items = div.getElementsByTagName('li'); for (var j = 0; j < items.length; j++) { var links = items[j].getElementsByTagName('a'); var pagename = links[0].title; var unwatch = document.createElement('a'); unwatch.href = "/w/index.php?title=Special:Watchlist&action=submit&remove=1&id[]="+encodeURIComponent(pagename); unwatch.title = "Unwatch "+pagename; unwatch.appendChild(document.createTextNode("unwatch")); items[j].insertBefore(unwatch, links[1].nextSibling); items[j].insertBefore(document.createTextNode(") ("), unwatch); } } } }); //