User:The Voidwalker/setWatchlistTo.js

if( mw.config.get('wgPageName') === 'Special:Watchlist' ) { var button = ' '; $('#mw-watchlist-resetbutton').after(button); $('#watchlist-select-ts').click(function { createSelectLinks; } ); }

function createSelectLinks { for(var i = 0; i < $('.mw-changeslist-line').length; i++) { $('.mw-changeslist-line')[i].id = 'mw-changeslist-line'; $('#mw-changeslist-line').prepend('Sel ').click( function(event) { setTS(event.originalEvent.target.dataset.ts);} ); $('.mw-changeslist-line')[i].id = ''; } }

function setTS (ts) { $.ajax( {   	url: mw.util.wikiScript('api'),    	type: 'post',    	dataType: 'json',    	data: {        	action: 'setnotificationtimestamp',        	format: 'json',			entirewatchlist: 1,        	timestamp: ts,        	token: mw.user.tokens.get('csrfToken'),    	}	}); $('.changeslist-select-ts').replaceWith; }