XTools/ArticleInfo.js

/** * XTools ArticleInfo gadget * Based on meta.wikimedia.org/wiki/User:Hedonil/XTools * Documentation: mediawiki.org/wiki/XTools * Released under GPL v3 license */ $(function {    if (mw.config.get('wgArticleId') === 0 || // no deleted articles, no special pages mw.config.get('wgCurRevisionId') !== mw.config.get('wgRevisionId') || // only current revision mw.config.get('wgAction') !== 'view') { // only when viewing a page, not editing       return;    }

var markup = ". ", $result = $('#xtools_result'); $(markup).insertBefore('#contentSub');

var loadinganimation = window.setInterval(function {        if ($result.html === '. ') {           $result.html('. ');       } else if ($result.html === '. ') {           $result.html('  .');        } else {            $result.html('. ');       }    }, 300);

$.get(       'http://xtools.wmflabs.org' +        '/api/page/articleinfo/' +        mw.config.get('wgServerName') + '/' +        mw.config.get('wgPageName').replace(/["?%&+]/g, escape) + '?format=html' +        '&uselang=' + mw.config.get('wgUserLanguage')    ).done(function (result) {        $result.html(result);        clearInterval(loadinganimation);    }); });