User:The Earwig/common.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
The accompanying .css page for this skin is at User:The Earwig/common.css. |
// Script imports
mw.loader.load('/w/index.php?title=User:The_Earwig/copy-section-link.js&action=raw&ctype=text/javascript'); // [[User:The Earwig/copy-section-link.js]]
mw.loader.load('/w/index.php?title=User:The_Earwig/copyvios.js&action=raw&ctype=text/javascript'); // [[User:The Earwig/copyvios.js]]
mw.loader.load('/w/index.php?title=User:The_Earwig/replytemplates.js&action=raw&ctype=text/javascript'); // [[User:The Earwig/replytemplates.js]]
mw.loader.load('/w/index.php?title=User:The_Earwig/revdel-responder.js&action=raw&ctype=text/javascript'); // [[User:The Earwig/revdel-responder.js]]
mw.loader.load('/w/index.php?title=User:Ale_jrb/Scripts/csdhelper.js&action=raw&ctype=text/javascript'); // [[User:Ale jrb/Scripts]]
mw.loader.load('/w/index.php?title=User:Anomie/linkclassifier.js&action=raw&ctype=text/javascript'); // [[User:Anomie/linkclassifier.js]]
mw.loader.load('/w/index.php?title=User:BrandonXLF/FFUHelper.js&oldid=1150066115&action=raw&ctype=text/javascript'); // [[User:BrandonXLF/FFUHelper.js]]
mw.loader.load('/w/index.php?title=User:Enterprisey/delsort.js&action=raw&ctype=text/javascript'); // [[User:Enterprisey/delsort.js]]
mw.loader.load('/w/index.php?title=User:Enterprisey/fancy-diffs.js&action=raw&ctype=text/javascript'); // [[User:Enterprisey/fancy-diffs.js]]
mw.loader.load('/w/index.php?title=User:Enterprisey/link-deleted-revs.js&action=raw&ctype=text/javascript'); // [[User:Enterprisey/link-deleted-revs.js]]
mw.loader.load('/w/index.php?title=User:Enterprisey/offset-history-link.js&action=raw&ctype=text/javascript'); // [[User:Enterprisey/offset-history-link.js]]
mw.loader.load('/w/index.php?title=User:Enterprisey/search-shortcuts.js&action=raw&ctype=text/javascript'); // [[User:Enterprisey/search-shortcuts.js]]
mw.loader.load('/w/index.php?title=User:Enterprisey/undelete-backlink.js&action=raw&ctype=text/javascript'); // [[User:Enterprisey/undelete-backlink.js]]
mw.loader.load('/w/index.php?title=User:Enterprisey/url-select-revdel.js&action=raw&ctype=text/javascript'); // [[User:Enterprisey/url-select-revdel.js]]
mw.loader.load('/w/index.php?title=User:Enterprisey/user-tabs-on-contribs.js&action=raw&ctype=text/javascript'); // [[User:Enterprisey/user-tabs-on-contribs.js]]
mw.loader.load('/w/index.php?title=User:Evad37/duplinks-alt.js&action=raw&ctype=text/javascript'); // [[User:Evad37/duplinks-alt.js]]
mw.loader.load('/w/index.php?title=User:Evad37/MoveToDraft.js&action=raw&ctype=text/javascript'); // [[User:Evad37/MoveToDraft.js]]
mw.loader.load('/w/index.php?title=User:Evad37/rater.js&action=raw&ctype=text/javascript'); // [[User:Evad37/rater.js]]
mw.loader.load('/w/index.php?title=User:Ohconfucius/dashes.js&action=raw&ctype=text/javascript'); // [[User:Ohconfucius/dashes.js]]
mw.loader.load('/w/index.php?title=User:SD0001/StubSorter.js&oldid=967983307&action=raw&ctype=text/javascript'); // [[User:SD0001/StubSorter.js]]
mw.loader.load('/w/index.php?title=User:Shubinator/DYKcheck.js&oldid=951444118&action=raw&ctype=text/javascript'); // [[User:Shubinator/DYKcheck]]
mw.loader.load('/w/index.php?title=User:Suffusion_of_Yellow/filterDiff.js&oldid=1013457086&action=raw&ctype=text/javascript'); // [[User:Suffusion of Yellow/filterDiff.js]]
mw.loader.load('/w/index.php?title=User:Suffusion_of_Yellow/filterTest.js&oldid=1013456740&action=raw&ctype=text/javascript'); // [[User:Suffusion of Yellow/filterTest.js]]
mw.loader.load('/w/index.php?title=User:SuperHamster/CiteUnseen.js&action=raw&ctype=text/javascript'); // [[User:SuperHamster/CiteUnseen.js]]
mw.loader.load('https://meta.wikimedia.org/w/index.php?title=User:SMcCandlish/userinfo.js&oldid=19571934&action=raw&ctype=text/javascript'); // [[User:PleaseStand/User info]]
mw.loader.load('/w/index.php?title=User:William_Avery/taxoboxalyzer.js&oldid=1022666345&action=raw&ctype=text/javascript'); // [[User:William Avery/taxoboxalyzer.js]]
window.filterSignature = 'Earwig';
mw.loader.load('/w/index.php?title=User:Suffusion_of_Yellow/filterNotes.js&oldid=1013457931&action=raw&ctype=text/javascript'); // [[User:Suffusion of Yellow/filterNotes.js]]
inspectText = 'inspect';
mw.loader.load('/w/index.php?title=User:Writ_Keeper/Scripts/commonHistory.js&action=raw&ctype=text/javascript'); // [[User:Writ Keeper/Scripts/commonHistory.js]]
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'); // [[User:SD0001/RFUD-helper.js]]
}
// Script config
// <nowiki>
window.popupFixDabs = true;
// Fix sandbox link
$.when(mw.loader.using(['mediawiki.util']), $.ready).then(function() {
const uname = mw.util.wikiUrlencode(mw.config.get('wgUserName'));
const url = '/wiki/User:' + uname + '/Sandbox';
$('#pt-sandbox a').attr('href', url).removeClass('new');
});
// Add a [[Special:PrefixIndex]] portlet link for subpages
$.when(mw.loader.using(['mediawiki.util']), $.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(['ext.visualEditor.core']), $.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(['mediawiki.util']), $.ready).then(function() {
if (mw.config.get('wgNamespaceNumber') & ~1 != 2) {
return;
}
const parts = mw.config.get('wgPageName').split('/', 1)[0].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(['mediawiki.util']), $.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[i].textContent > elems[i + 1].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[0], {childList: true});
update();
});
// [[Special:Permalink/1003394963#Stop the editor from launching automatically when clicking on a red link]]
$(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[1]);
}
});
});
// "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>