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

Content deleted Content added
doesn't work :-( — replace with version that does
provide two variations
Line 1:
// This script adds an "unwatch" link to each entry in your watchlist. <pre><nowiki>
 
There are two variations, depending on whether the "Enhanced recent changes" option is selected in your user preferences.
 
__TOC__
 
== No enhanced recent changes ==
 
<pre><nowiki>
// Unwatch link: No enhanced recent changes
// Add Unwatch to watch list
// from [[User:Matthewmayer/monobook.js]]
addOnloadHook(function () {
if (window.___location.href.indexOf("Special:Watchlist")!=-1) {
//correct page, so retrieve watchlist items
var items=document.getElementById('bodyContent').getElementsByTagName('li');
for (var i=0;i<items.length;i++) {
//what is the title of this page?
pagename=items[i].getElementsByTagName('a')[0].title;
//create 'unwatch' element
unwatchelt=document.createElement('a');
unwatchelt.setAttribute('href','/w/index.php?title='+pagename+'&action=unwatch');
unwatchelt.setAttribute('title','Unwatch '+pagename);
unwatchelt.appendChild(document.createTextNode('(unwatch)'));
//add the 'unwatch' element
items[i].appendChild(unwatchelt);
}
}
}
);
//</nowiki></pre>
 
== Enhanced recent changes ==
 
<pre><nowiki>
// Unwatch link: Enhanced recent changes
addOnloadHook(function () {
if (window.___location.href.indexOf("Special:Watchlist") == -1) return;