User:Syncategoremata/watchlistnotifier.js

/* Watchlist notifier (User:Syncategoremata/watchlistnotifier.js); displays a message every time a watched page changes. */

switch (skin) { case 'modern': case 'monobook': case 'vector': var query = sajax_init_object;

query.onreadystatechange = function { with (query) { if (readyState == 4 && status == 200) { var api = eval('('+responseText+')'); var subtitle = document.createElement('div'); with (subtitle) { className = 'watchlistnotify'; }		with (api.query.watchlist[0]) { subtitle.appendChild(			document.createTextNode( title+'..'+user+' ('+comment+')' ) ); }		document.getElementById('contentSub').appendChild(subtitle); }	}   }

addOnloadHook(function {	/* Find the top item in the watchlist, and its edit	  summary. We only need one item, so set the limit to 1 to	   ease the load on the server. */	query.open( 'GET', wgServer + wgScriptPath + '/api.php?format=json&action=query&prop=info&list=watchlist&wllimit=1&wldir=older&wlprop=comment|ids|title|user', true);	query.send(null);     }); }