User:Kofirs2634/global.js

importArticles({	type: 'script',	articles: [		'u:dev:MediaWiki:PortableCSSPad/code.js',		'u:dev:MediaWiki:QuickDiff/code.js',		'u:dev:MediaWiki:FirstEditDate.js'	] })

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

const c = mw.config.get(['wgPageName', 'wgNamespaceNumber']), api = new mw.Api;

if (c.wgNamespaceNumber % 2 != 0 || c.wgNamespaceNumber == -1) return;

api.get({       action: 'query',        prop: 'revisions',        rvlimit: 2,        rvprop: 'size',        titles: c.wgPageName    }) .done(render) .fail(function(e) {       console.error('Pages\' Length caught an error:', e);        $('.page-header__main').prepend($(' ').css('color', '#F00').text('При загрузке Pages\' Length произошла ошибка.'))    }) function render(d) { var r = d.query.pages[Object.keys(d.query.pages)[0]].revisions, diff, percent, el = $(' ', { class: 'page-length' }), co = $(' '); if (d.missing == '') diff = percent = 0; if (r.length) { if (r.length == 1) { diff = r[0].size; percent = 100 } else { diff = r[0].size - r[1].size; percent = ((r[0].size / r[1].size - 1) * 100).toFixed(2) }       }

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

$('.page-header__main').prepend(el.append(co)) } })*/

// WhileYouWereAway $(function {	if (window.WhileYouWereAway) return;	window.WhileYouWereAway = true;	const c = mw.config.get('wgCanonicalSpecialPageName');	var storage = localStorage.getItem('WYWATimemark');	if (c != 'Recentchanges') return;

var mark = findEntry('table'), firstTable = $('table.mw-changeslist-line').eq(0).attr('data-mw-ts'), submark = findEntry('tr'), firstTr = $('tr.mw-changeslist-line').eq(0).attr('data-mw-ts') function findEntry(el) { return $(el + '.mw-changeslist-line') .map(function(n, e) { return $(e).attr('data-mw-ts') }) .toArray.find(function(e) { return e < storage }) }	function toggleMark(e) { var state = $(e.target).parents.eq(3).hasClass('mw-collapsed'); $('.wywa-mark').css('display', state ? 'block' : 'none') }

if (!mark) $('.mw-changeslist').append($(' ', { class: 'wywa-mark' })) else if (firstTable != mark) $('table[data-mw-ts="' + mark + '"]').before($(' ', { class: 'wywa-mark' }))

if (submark && firstTr != submark) { $('tr[data-mw-ts="' + submark + '"]').before($(' ', { class: 'wywa-submark' }).append($(' ', { colspan: 99 }))); $('.wywa-submark').siblings.eq(0).find('.mw-collapsible-toggle').click(toggleMark) }	storage = new Date.toISOString.match(/\d/g).join('').slice(0, 14) localStorage.setItem('WYWATimemark', storage) })