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 debugUserMenuInjection() {
if (!mw.config.get('wgUserName')) {
console.log('[UserMenuTest] Not logged in.');
return;
}
const $menu = $('.cmln-personal-tools ul');
if ($menu.length === 0) {
console.log('[UserMenuTest] Menu not found, retrying...');
setTimeout(debugUserMenuInjection, 200);
return;
}
console.log('[UserMenuTest] Menu found. Injecting link.');
const $testLink = $('<li>')
.addClass('mw-list-item')
.append(
$('<a>')
.attr('href', '#')
.text('✅ Injected Link')
.css({
background: 'firebrick',
color: 'white',
padding: '5px',
display: 'block'
})
);
$menu.append($testLink);
}
$(debugUserMenuInjection);
});