Jump to content

User:JohnnyMrNinja/AppTab.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
importScript('User:Luasóg bot/framework.js');
 
if (typeof jQuery == 'undefined')
  mw.loader.load('//bits.wikimedia.org/skins-1.5/common/jquery.min.js');
 
$(function() {
  var watchlistElem = document.getElementById('transclude-watchlist');
  if (watchlistElem != null)
  {
    if (typeof transcludeWatchlistLimit == 'undefined')
      transcludeWatchlistLimit = 100;
 
    watchlistElem.innerHTML = '<div id="loading">Loading …</div>';
 
    var luasog = new Luasog("http://en.wikipedia.org/w/api.php");
 
    var requestParams = {action:"query", list: "watchlist", wlexcludeuser: wgUserName, wlprop: "ids|title|timestamp|user|parsedcomment|flags", wllimit: transcludeWatchlistLimit};
 
    var callback = function(data) {
      var result = document.createElement("ul");
 
      for (var i = 0; i < data.query.watchlist.length; i++) {
        var edit = data.query.watchlist[i];
        result.innerHTML += '<li>(<a href="/w/index.php?diff=prev&oldid=' + edit.revid + '">diff</a>) <b>' + (edit.minor == undefined ? '' : 'm') + (edit.bot == undefined ? '' : 'b') + '</b> <a href="/wiki/' + escape(edit.title) + '">' + edit.title + '</a> ' + edit.timestamp + ' <a href="/wiki/User:' + escape(edit.user) + '">' + edit.user + '</a> (' + edit.parsedcomment + ')</li>';
      }
      var watchlistElem = document.getElementById('transclude-watchlist');
      watchlistElem.replaceChild(result, watchlistElem.firstChild);
    }
 
    luasog.request(requestParams, callback);
  }
var limit="0:30"

if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh(){
if (!document.images)
return
if (parselimit==1)
window.location.reload()
else{ 
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
else
curtime=cursec+" seconds left until page refresh!"
window.status=curtime
setTimeout("beginrefresh()",1000)
}
}

window.onload=beginrefresh

var all = document.all.tags("a");
for (var i = 0; i < all.length; i++) {
   all[i].target=all[i].target==""?"_new":all[i].target;
}
});