addOnloadHook(function () {
if (window.___location.href.indexOf("Special:Watchlist") == -1) return;
var headingslinks = document.getElementById('content').getElementsByTagName(' h4a'); ▼
for (var i = 0; i < headingslinks.length; i++) { ▼
function unwatchLink(pagename) {
if ( !node.tagName || node.tagName.toLowerCase() != 'a' || nodelinks[i].href.substring( nodelinks[i].href.length-15) != '&action=history') ▼
var unwatch = document.createElement('a');
unwatch.href = "/w/index.php?title=Special:Watchlist&action=submit&remove=1&id[]="+encodeURIComponent(pagenamelinks[i].title);
unwatch.title = "Unwatch "+pagenamelinks[i].title;
unwatch.appendChild(document.createTextNode("unwatch"));
return links[i].parentNode.insertBefore(unwatch, links[i].nextSibling);
links[i].parentNode.insertBefore(links[i].previousSibling.cloneNode(true), unwatch);
}
// 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') { // enhanced recent changes
// this is all tag soup, we just have to wade through it :-(
for (var node = div.firstChild; node; node = node.nextSibling) {
// locate the history link
▲ if (!node.tagName || node.tagName.toLowerCase() != 'a' || node.href.substring(node.href.length-15) != '&action=history')
var unwatch = unwatchLink(node.title);
div.insertBefore(unwatch, node.nextSibling);
div.insertBefore(document.createTextNode("; "), unwatch);
}
}
else if (div.tagName.toLowerCase() == 'ul') { // unenhanced recent changes
var items = div.getElementsByTagName('li');
for (var j = 0; j < items.length; j++) {
var links = items[j].getElementsByTagName('a');
var unwatch = unwatchLink(links[0].title);
items[j].insertBefore(unwatch, links[1].nextSibling);
items[j].insertBefore(document.createTextNode(") ("), unwatch);
}
}
}
});
|