User:PlushBoy/global.js

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:PortableCSSPad/code.js',        'u:ru.koffee:MediaWiki:SyntaxRecolor.js',        'u:dev:MediaWiki:PreventTheLimbo.js',    ] });

/* "Pages' Length" by Kofirs2634 (original: "https://community.fandom.com/wiki/User:Kofirs2634/global.js") */ // Page's length mw.loader.using('mediawiki.api', function {   var config = mw.config.get(['wgPageName', 'wgNamespaceNumber', 'wgScriptPath']);    if (config.wgNamespaceNumber % 2 != 0 || config.wgNamespaceNumber == -1) return;    $.ajax({ type: 'get', url: config.wgScriptPath + '/api.php?action=query&format=json&prop=info|revisions&rvlimit=2&rvprop=size&titles=' + config.wgPageName, success: function(data) { var length = data.query.pages[Object.keys(data.query.pages)[0]].length, lengthBefore = 0, text = ' Размер: ' + length + ' байт'; if (data.query.pages[Object.keys(data.query.pages)[0]].revisions[1]) lengthBefore = data.query.pages[Object.keys(data.query.pages)[0]].revisions[1].size; diff = length - lengthBefore; if (length % 10 == 2 || length % 10 == 3 || length % 10 == 4) { if (diff > 0) text += 'а (+' + diff + ') ' else if (diff < 0) text += 'а (' + diff + ') ' else text += 'а (0) ' } else { if (diff > 0) text += ' (+' + diff + ') ' else if (diff < 0) text += ' (' + diff + ') ' else text += ' (0) ' }           $('.page-header__main').prepend(text); if (Math.abs(diff) > 500) $('.page-length #size').css('font-weight', 'bold') },       error: function { $('.page-header__main').prepend(' Произошла ошибка ') }   }) })