Wikipedia:WikiProject User scripts/Scripts/Unwatch: Difference between revisions
Content deleted Content added
fix bug in enhanced mode |
refactor a little |
||
Line 3:
addOnloadHook(function () {
if (window.___location.href.indexOf("Special:Watchlist") == -1) return;
function unwatchLink(pagename) {
return unwatch;
}
// look for h4 followed by div/ul
Line 18 ⟶ 26:
if (!node.tagName || node.tagName.toLowerCase() != 'a' || node.href.substring(node.href.length-15) != '&action=history')
continue;
var
▲ 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(unwatch, node.nextSibling);
div.insertBefore(document.createTextNode("; "), unwatch);
Line 31 ⟶ 35:
for (var j = 0; j < items.length; j++) {
var links = items[j].getElementsByTagName('a');
var
items[j].insertBefore(unwatch, links[1].nextSibling);
items[j].insertBefore(document.createTextNode(") ("), unwatch);
|