User:Kofirs2634/global.js

// WAM Settings window.railWAM = { lang: 'ru' };

// Some imports importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:PortableCSSPad/code.js',        'u:dev:MediaWiki:RailWAM/code.js',        'u:dev:MediaWiki:GlobalEditcount/code.js',        'u:dev:MediaWiki:EditsShare.js',        'u:dev:MediaWiki:AjaxDiff/code.js',        'u:dev:MediaWiki:MultiUpload/code.js',        'u:dev:MediaWiki:SandboxLink/code.js',        'u:ru.koffee:MediaWiki:EditorInfo.js'    ] });

$(function {   if (window.myPages) return;    window.myPages = true;    var path = mw.config.get('wgArticlePath')    $('.wds-global-navigation__user-menu .wds-list').append($('').append($('', { href: path.replace('$1', 'Special:MyPage/wikia.css'), text: 'Мой CSS' })))   .append($('').append($('', { href: path.replace('$1', 'Special:MyPage/common.js'), text: 'Мой JS' }))) })

// Hide Global Nav Menu $(function($) {   if (window.hideGNM) return;    window.hideGNM = true;    window.hideGlobalNav = function {        $('.wds-global-navigation-wrapper').addClass('hide-it');        $('#wds-global-navigation__unhide').removeClass('hide-it')    }    window.unhideGlobalNav = function {        $('#wds-global-navigation__unhide').addClass('hide-it');        $('.wds-global-navigation-wrapper').removeClass('hide-it')    }    // Hide button    $('.wds-global-navigation__content-bar-right').append(' ');    $('.wds-global-navigation__hide').append('▲');    // Unhide button    $('.wds-global-navigation-wrapper').after(' ');    $('#wds-global-navigation__unhide').append('▼') })

// Pages' length mw.loader.using('mediawiki.api', function {   if (window.PagesLength) return;    window.PagesLength = true;

const c = mw.config.get(['wgPageName', 'wgNamespaceNumber', 'wgVersion']), api = new mw.Api, isUCP = c.wgVersion != '1.19.24'; if (c.wgNamespaceNumber % 2 != 0 || c.wgNamespaceNumber == -1) return;

api.get({       action: 'query',        prop: 'revisions',        rvlimit: 2,        rvprop: 'size',        titles: c.wgPageName    }, function(d) {        var r = d.query.pages[Object.keys(d.query.pages)[0]].revisions,            diff,            el = $(' ', { class: 'page-length' }),            co = $(' ');        if (d.missing == '') diff = 0;        if (r.length) {            if (r.length == 1) diff = r[0].size            else diff = r[1].size - r[0].size        }

el.html(' Размер: ' + (r.length ? r[0].size : diff) + ' байт '); if (diff == 0) co.addClass('mw-plusminus-null').text('(0)') else if (diff > 0) co.addClass('mw-plusminus-pos').text('(+' + diff + ')') else if (diff < 0) co.addClass('mw-plusminus-neg').text('(' + diff + ')'); if (Math.abs(diff) >= 500) co.css('font-weight', 'bold'); $('.page-header__main').prepend(el.append(co)) }) })