MediaWiki:Common.js
From Artifacts of Capitalism
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
mw.loader.using('mediawiki.util', function () {
$(function () {
// Only proceed if user is logged in
if (!mw.config.get('wgUserName')) return;
// Target the dropdown container (the blue guy menu)
const personalToolsList = $('.cmln-personal-tools ul');
if (personalToolsList.length) {
// Define custom links
const links = [
{
href: '/index.php?title=Special:Upload',
label: 'Upload a File'
},
{
href: '/index.php?title=Special:ListFiles',
label: 'All Files'
},
{
href: '/index.php?title=Help:Contents',
label: 'Help'
},
{
href: '/index.php?title=Special:SpecialPages',
label: 'Special pages'
}
];
// Inject each link into the dropdown
links.forEach(link => {
const li = $('<li>')
.addClass('mw-list-item')
.append(
$('<a>')
.attr('href', link.href)
.text(link.label)
);
personalToolsList.append(li);
});
}
});
});