User:Kuinyo/watchlist-notice.js

// Bolds watchlist link in toolbar if there are unread entries. // Derived from User:Enterprisey/watchlist-notice.js. mw.loader.using('mediawiki.util', function {   var updateNotice = function {        $.getJSON( mw.util.wikiScript('api'), { format: 'json', action: 'query', list: 'watchlist', wlshow: 'unread', wllimit: 1 // Because we're checking if there are *any* entries }).done(function(data) { if (!data.query) return; if (data.query.watchlist.length) { // There are new watchlist diffs to read, so bold watchlist link if (!$('#watchlist-update-notice').length) { $('#pt-watchlist').css('font-weight', 'Bold'); } else {} } else { // No new watchlist diffs to read, so unbold watchlist link $('#pt-watchlist').css('font-weight', 'Normal'); }       });    };

$(document).ready(function {       updateNotice;        window.setInterval(updateNotice, 120000);    }); });