Wikipedia:WikiProject User scripts/Scripts/Unwatch: Difference between revisions

Content deleted Content added
rv. Ilmari was right =)
allow user to choose either type of URL
Line 1:
// 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 [[Special:Preferences|user preferences]]. By default the links take you back to [[Special:Watchlist|your watchlist]]. If you'd prefer them to take you to a "Removed from watchlist" page like the unwatch links at the top of the watched pages, uncomment the second line in the function. <pre><nowiki>
 
addOnloadHook(function () {
var query_prefix = "title=Special:Watchlist&action=submit&remove=1&id[]=";
//var query_prefix = "action=unwatch&title=";
 
if (window.___location.href.indexOf("Special:Watchlist") == -1) return;
var links = document.getElementById('content').getElementsByTagName('a');
Line 8 ⟶ 11:
continue;
var unwatch = document.createElement('a');
unwatch.href = "/w/index.php?title=Special:Watchlist&action=submit&remove=1&id[]=" + query_prefix + encodeURIComponent(links[i].title);
unwatch.title = "Unwatch "+links[i].title;
unwatch.appendChild(document.createTextNode("unwatch"));