User:The Earwig/common.js

In this article, the topic of User:The Earwig/common.js will be addressed from a broad and detailed perspective, in order to provide the reader with a complete and in-depth vision of it. Various facets and aspects related to User:The Earwig/common.js will be explored, analyzing its importance and relevance in different areas. In addition, different points of view and opinions from experts on the topic will be presented, with the aim of enriching knowledge and understanding about User:The Earwig/common.js. Throughout the article, statistical data, examples, case studies and practical exercises will be provided that will allow the reader to delve deeper into the topic and apply the knowledge acquired.
// Script imports

mw.loader.load('/w/index.php?title=User:The_Earwig/copy-section-link.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:The_Earwig/copyvios.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:The_Earwig/replytemplates.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:The_Earwig/revdel-responder.js&action=raw&ctype=text/javascript'); // ]

mw.loader.load('/w/index.php?title=User:Ale_jrb/Scripts/csdhelper.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Anomie/linkclassifier.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:BrandonXLF/FFUHelper.js&oldid=1150066115&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Enterprisey/delsort.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Enterprisey/fancy-diffs.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Enterprisey/link-deleted-revs.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Enterprisey/offset-history-link.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Enterprisey/search-shortcuts.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Enterprisey/undelete-backlink.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Enterprisey/url-select-revdel.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Enterprisey/user-tabs-on-contribs.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Evad37/duplinks-alt.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Evad37/MoveToDraft.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Evad37/rater.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Ohconfucius/dashes.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:SD0001/StubSorter.js&oldid=967983307&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Shubinator/DYKcheck.js&oldid=951444118&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Suffusion_of_Yellow/filterDiff.js&oldid=1013457086&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:Suffusion_of_Yellow/filterTest.js&oldid=1013456740&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:SuperHamster/CiteUnseen.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load('https://meta.wikimedia.org/w/index.php?title=User:SMcCandlish/userinfo.js&oldid=19571934&action=raw&ctype=text/javascript'); // ]
mw.loader.load('/w/index.php?title=User:William_Avery/taxoboxalyzer.js&oldid=1022666345&action=raw&ctype=text/javascript'); // ]

window.filterSignature = 'Earwig';
mw.loader.load('/w/index.php?title=User:Suffusion_of_Yellow/filterNotes.js&oldid=1013457931&action=raw&ctype=text/javascript'); // ]

inspectText = 'inspect';
mw.loader.load('/w/index.php?title=User:Writ_Keeper/Scripts/commonHistory.js&action=raw&ctype=text/javascript'); // ]

if (mw.config.get('wgPageName') === 'Wikipedia:Requests_for_undeletion') {
	mw.loader.load('/w/index.php?title=User:SD0001/RFUD-helper.js&action=raw&ctype=text/javascript'); // ]
}

// Script config
// <nowiki>

window.popupFixDabs = true;

// Fix sandbox link

$.when(mw.loader.using(), $.ready).then(function() {
	const uname = mw.util.wikiUrlencode(mw.config.get('wgUserName'));
	const url = 'https://wikifreehand.com/en/User:' + uname + '/Sandbox';
	$('#pt-sandbox a').attr('href', url).removeClass('new');
});

// Add a ] portlet link for subpages

$.when(mw.loader.using(), $.ready).then(function() {
	mw.util.addPortletLink(
		'p-tb',
		mw.util.getUrl('Special:PrefixIndex/' + mw.config.get('wgPageName')),
		'Prefix index',
		't-prefixindex',
		'List subpages of the current page'
	);
});

// Modifications to edit links

$.when(mw.loader.using(), $.ready).then(function() {
	if ($('#ca-edit a').text().indexOf('Create') >= 0) {
		$('#ca-edit a').text('Create');  // "create this page / create source" -> "create"
	} else {
		$('#ca-edit a').text('Edit');  // "edit this page / edit source" -> "edit"
	}
	$('#ca-addsection a').text('+'); // "new section" -> "+"
	$('#ca-ve-edit a').text('VE'); // "edit this page" -> "ve"
	$('#ca-history a').text('History'); // "view history" -> "history"
	$('.mw-editsection a:first-of-type').text('edit'); // "edit source" -> "edit"
	$('.mw-editsection-visualeditor').text('ve'); // "edit" -> "ve"
});

// Add a SUL info link to userpages

$.when(mw.loader.using(), $.ready).then(function() {
	if (mw.config.get('wgNamespaceNumber') & ~1 != 2) {
		return;
	}
	const parts = mw.config.get('wgPageName').split('/', 1).split(':');
	parts.shift();
	const user = parts.join(':');
	mw.util.addPortletLink(
		'p-tb',
		mw.util.getUrl('Special:CentralAuth/' + user),
		'SUL info',
		't-sulinfo',
		'Show global user account info'
	);
});

// Update names in "More" portlet and hide when empty

$.when(mw.loader.using(), $.ready).then(function() {
	const list = $('#p-cactions ul');
	if (list.length != 1) {
		return;
	}
	const isSorted = function(elems) {
		for (var i = 0; i < elems.length - 1; i++) {
			if (elems.textContent > elems.textContent) {
				return false;
			}
		}
		return true;
	};
	const update = function() {
		if ($('#p-cactions ul li').length > 0) {
			$('#p-cactions').show();
			if ($('#ca-AutoEd').length > 0) {
				$('#ca-AutoEd a').text('Dashes');
			}
			const elems = $('#p-cactions ul li');
			if (!isSorted(elems)) {
				elems.sort(function(a, b) {
					return b.textContent < a.textContent ? 1 : -1;
				});
				elems.detach().appendTo('#p-cactions ul');
			}
		} else {
			$('#p-cactions').hide();
		}
	};
	const observer = new MutationObserver(update);
	observer.observe(list, {childList: true});
	update();
});

// ]

$(function() {
	$('a.new').each(function(i, el) {
		const match = $(el).attr('href').match(/(\/w\/index.php\?title=.+)&action=edit&redlink=1/);
		if (match !== null) {
			$(el).attr('href', match);
		}
	});
});

// "change visibility" -> "revdel"

$(function() {
	$('.mw-revdelundel-link a').text('revdel');
});

// Add styling to inline diffs 

mw.hook('new-diff-table').add(function(table) {
	table.classList.add('diff-editfont-monospace');
});

// </nowiki>