User:MusikAnimal/xtools2.js

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 $(" .  ").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 );