Jump to content

User:Castor Gravy/common.js

From Wikipedia, the free encyclopedia
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:IagoQnsi/ipareader.js'); // [[User:IagoQnsi/ipareader.js]]
//User:IagoQnsi/ipareader


mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:BrandonXLF/FindSources.js&action=raw&ctype=text/javascript');
// https://en.wikipedia.org/wiki/User:BrandonXLF/FindSources

importScript('User:Þjarkur/Show number of active watchers & monthly views on every page.js');
//User:Þjarkur/Show number of active watchers & monthly views on every page


//importScript('User:Golmore/XTools.js');

window.LiveClockTimeZone = 'Europe/Paris';
// timezone for clock gadget https://www.mediawiki.org/wiki/MediaWiki:Gadget-UTCLiveClock.js


/*
 * XTools ArticleInfo gadget
 * Based on meta.wikimedia.org/wiki/User:Hedonil/XTools
 * Documentation: mediawiki.org/wiki/XTools/ArticleInfo_gadget
 * Released under GPL 3.0+ license
 * For updates, please copy and paste from https://xtools.wmcloud.org/articleinfo-gadget.js
 */
$(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 $result,
        markup = "<div id='xtools' style='font-size:84%; line-height:1.2em;" +
        "width:auto;'><span id='xtools_result'>.</span></div>";
    $(markup).insertBefore('#contentSub');
    $result = $('#xtools_result');

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

    $.get(
        'https://xtools.wmcloud.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);
    });
});