User:Floydian/callwatchlist.js

importScript('User:Luasóg bot/framework.js'); if (typeof jQuery == 'undefined') mw.loader.load('//bits.wikimedia.org/skins-1.5/common/jquery.min.js'); addOnloadHook(function { var watchlistElem = document.getElementById('transclude-watchlist');  if (watchlistElem != null)  {    if (typeof transcludeWatchlistLimit == 'undefined')      transcludeWatchlistLimit = 10;    watchlistElem.innerHTML = ' Loading … ';    var luasog = new Luasog("http://en.wikipedia.org/w/api.php");    var requestParams = {action:"query", list: "watchlist", wlexcludeuser: mw.config.get('wgUserName'), wlprop: "ids|title|timestamp|user|parsedcomment|flags", wllimit: transcludeWatchlistLimit};    var callback = function(data) {      var result = document.createElement("table");      result.setAttribute("width", "100%");      for (var i = 0; i < data.query.watchlist.length; i++) {        var edit = data.query.watchlist[i];        edit.timestamp = /[0-9]{2}:[0-9]{2}:[0-9]{2}/.exec(edit.timestamp);        if (edit.parsedcomment == )            {            result.innerHTML += '  ¤  (diff...hist) '' + (edit.minor == undefined ? '' : 'm') + (edit.bot == undefined ? '' : 'b') + ' ' + edit.title + ' ' +  (parseInt(/[0-9]{2}/.exec(edit.timestamp))+24-5)%24 + /:[0-9]{2}:[0-9]{2}/.exec(edit.timestamp)  + '    ' + edit.user + '  ';            }        else            {            result.innerHTML += '  ¤  (diff...hist) ' + (edit.minor == undefined ? '' : 'm') + (edit.bot == undefined ?  : 'b') + '' ' + edit.title + ' ' +  (parseInt(/[0-9]{2}/.exec(edit.timestamp))+24-5)%24 + /:[0-9]{2}:[0-9]{2}/.exec(edit.timestamp)  + '    ' + edit.user + ' (' + edit.parsedcomment + ')  ';            }      }      var watchlistElem = document.getElementById('transclude-watchlist');      watchlistElem.replaceChild(result, watchlistElem.firstChild);    }    luasog.request(requestParams, callback);  } });