Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// [[User:Quarl/watchlist.js]] - adds buttons to watchlist: "unwatch", "diff// since"// UNWATCH button asynchronously unwatches and crosses the entry off the// watchlist.//// DIFF SINCE button shows differences since last edited.// quarl 2006-01-09 added asynchronous feature.// quarl 2006-02-03 factored; added diff since.// requires: wikipage.js, util.js, wikiwatch.js, diffsince.js// originally based on http://en.wikipedia.org/wiki/User:Omegatron/monobook.js// see also http://en.wikipedia.org/wiki/User:Matthewmayer/monobook.js// see also Bug 424 http://bugzilla.wikipedia.org/show_bug.cgi?id=424// <pre><nowiki>varwatchlist=newObject();watchlist.wp={};watchlist.unwatchAsync=function(pagename){varwp=watchlist.wp[pagename];if(!wp){alert("## internal error 72192d74-ab57-4a98-917f-8c6ca03b0559");return;}wikiwatch.unwatchAsync(wp,watchlist._unwatchSuccess,wp.unwatchSpan);returnfalse;}watchlist.watchAsync=function(pagename){varwp=watchlist.wp[pagename];if(!wp){alert("## internal error 72192d74-ab57-4a98-917f-8c6ca03b0559");return;}wikiwatch.watchAsync(wp,watchlist._watchSuccess,wp.unwatchSpan);returnfalse;}watchlist.diffSince=function(pagename){varwp=watchlist.wp[pagename];if(!wp){alert("## internal error 72192d74-ab57-4a98-917f-8c6ca03b0559");return;}returndiffsince.diffPageAsync(wp,wp.diffsinceSpan);}watchlist._addStrikeThrough=function(node){// return node && insertNode(node, document.createElement('s'));if(!node)return0;addClass(ensureSpan(node),'history-deleted');return1;}watchlist._removeStrikeThrough=function(node){if(!node)return0;removeClass(ensureSpan(node),'history-deleted');return1;}watchlist._unwatchSuccess=function(wp){varwpNT=wp.notalkPage();varwpT=wp.talkPage();if(0==(watchlist._addStrikeThrough(findHref(wpNT.url))+watchlist._addStrikeThrough(findHref(wpT.url)))){alert("Unwatched article '"+wp.page+"', but couldn't annotate current page.");return;}watchlist._updateWuwLink(wpT,'watch');watchlist._updateWuwLink(wpNT,'watch');}watchlist._watchSuccess=function(wp){varwpNT=wp.notalkPage();varwpT=wp.talkPage();if(0==(watchlist._removeStrikeThrough(findHref(wpNT.url))+watchlist._removeStrikeThrough(findHref(wpT.url)))){alert("Watched article '"+wp.page+"', but couldn't annotate current page.");return;}watchlist._updateWuwLink(wpT,'unwatch');watchlist._updateWuwLink(wpNT,'unwatch');}// Update a watch/unwatch link. Returns 1 on success, 0 if not found.//// wuw must be 'watch' or 'unwatch'watchlist._updateWuwLink=function(wpX,wuw){wp=watchlist.wp[wpX.page];if(!wp)return0;varlink="javascript:return watchlist."+wuw+"Async("+string_quote_escape(wp.page)+")";varurl=wp.qurl+'&action='+wuw;wp.unwatchSpan.innerHTML='<a onclick="'+link+'" href="'+url+'">'+wuw+'</a>';return1;}watchlist._load=function(){if(wikiPage.page=="Special:Watchlist")watchlist._annotatePage();}watchlist._annotatePage=function(){varlinks=copyArray(document.getElementById('bodyContent').getElementsByTagName('a'));for(iinlinks){varlink=links[i];if(link.href&&link.href.match(/action=history$/)){varwp=newWikiPage(link.href);watchlist.wp[wp.page]=wp;wp.unwatchSpan=document.createElement('span');varunwatchLink="javascript:return watchlist.unwatchAsync("+string_quote_escape(wp.page)+")";varunwatchUrl=wp.qurl+'&action=unwatch';wp.unwatchSpan.innerHTML='<a onclick="'+unwatchLink+'" href="'+unwatchUrl+'">unwatch</a>';add_after(link,wp.unwatchSpan);add_after(link,document.createTextNode('; '));wp.diffsinceSpan=document.createElement('span');diffsinceLink="javascript:return watchlist.diffSince("+string_quote_escape(wp.page)+")";vardiffsinceUrl=diffsince.makeUrl(wp);wp.diffsinceSpan.innerHTML='<a onclick="'+diffsinceLink+'" href="'+diffsinceUrl+'">since</a>';add_before(link,wp.diffsinceSpan);add_before(link,document.createTextNode('; '));}}}$(watchlist._load);// </nowiki></pre>