MediaWiki:PatrolPanel.js

$(function {   if (wgPageName !== "Special:PatrolPanel") {        return;    }    var lis;    var intro = "Howdy " + wgUserGroups[0] + "! Welcome to the hub for managing unpatrolled edits. Here, you can see all edits that have not been patrolled by an administrator/content moderator . This feed doesn't show edits by any of the afformentioned groups; and only shows edits within the main namespace.";    $('title').text("Patrol Panel");    $('.page-header__title').text("Patrol Panel!");    var api = new mw.Uri({ path: '/api.php' });   var request = api.clone.extend({ action: 'query', list: 'recentchanges', rcnamespace: '0', rcprop: 'title|user|sizes|parsedcomment|timestamp|ids', rclimit: '407', rcend: '2017-08-17T19:44:17Z', rcshow: '!patrolled', format: 'json' });   function updateTable {        $.getJSON(request).done(function(data) { console.log(data); var changes = data.query.recentchanges; var lis = $(' Title Change  User  Summary  Timestamp '); $.each(changes, function(i, v) {               var diff;                if ((v.newlen - v.oldlen) > 0) {                    diff = $('+ ' + Math.abs(v.newlen - v.oldlen) + ' ');                } else if ((v.newlen - v.oldlen) == 0) {                    diff = $(' 0 ');                } else {                    diff = $('- ' + Math.abs(v.newlen - v.oldlen) + ' ');                }                var tr = $(' ');                tr.append($(' ' + v.title + '\n' + '(diff)'))                    .append($(' ', {                        html: diff[0]                    }))                    .append($(' ' + v.user + '')) .append($(' ', { html: v.parsedcomment }))                   .append($(' ', { text: v.timestamp.slice(11, -1) }));               lis.append(tr); });           lis.append(' Version 0.2 &middot; Original Authority & Fngplg &middot; Suggest Changes &middot; Last refreshed: ' + new Date.toString.slice(16, -15) + '  ');            $('#mw-content-text').html(lis);            $('#mw-content-text').prepend(intro);            console.log("refreshed");        }); }   updateTable; setInterval(updateTable, 180000); });