User:WikiDwarf/ArticleInfo.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
var xpagehistory = {
loadinganimation : 0,
execute : function () {
if (mw.config.get('wgArticleId') === 0) return; // no deleted articles, no special pages
if (mw.config.get('wgCurRevisionId') != mw.config.get('wgRevisionId')) return; // only current revision
$("<div id='xtools' style='font-size:84%; line-height:1.2em; margin:0 0 0.4em 0.2em; width:auto;'><span id='xtoolsresult'></span><span id='xtoolsloading'>.</span></div>").insertBefore("#contentSub");
loadinganimation = window.setInterval( function() { if ($("#xtoolsloading").html() == ". ") $("#xtoolsloading").html(" . "); else if ($("#xtoolsloading").html() == " . ") $("#xtoolsloading").html(" ."); else $("#xtoolsloading").html(". "); }, 300);
mw.loader.load("//tools.wmflabs.org/xtools/api.php?pageid=" + mw.config.get('wgArticleId') + "&pagetitle=" + mw.config.get('wgPageName') + "&project=" + mw.config.get('wgServer').slice(2) + "&uselang=" + mw.config.get('wgContentLanguage') );
},
resultloaded : function( res ) {
$("#xtoolsresult").html(res);
this.stoploading();
},
stoploading : function() {
clearInterval(loadinganimation);
$('#xtoolsloading').remove();
}
};
if ( (mw.config.get('wgAction') == "view") ) $( xpagehistory.execute );