MediaWiki:Common.js
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.
/*
* GladiusRO permanent sidebar configuration.
*/
jQuery(function ($) {
'use strict';
function configureGladiusSidebar() {
var $toc = $('#toc');
var $tools = $('#p-tb');
var $sidebar = $('#mw-panel');
/*
* Move Contents into the left sidebar.
*/
if ($toc.length && $sidebar.length) {
var $container = $('#gladius-sidebar-toc');
if (!$container.length) {
$container = $('<div>', {
id: 'gladius-sidebar-toc',
class: 'portal mw-portlet'
});
}
$container.append($toc);
/*
* Place Contents below Tools.
* If Tools cannot be found, place Contents
* at the bottom of the sidebar.
*/
if ($tools.length) {
$container.insertAfter($tools);
} else {
$container.appendTo($sidebar);
}
}
/*
* Hide technical links from logged-out players.
* Logged-in administrators can still see everything.
*/
if (mw.config.get('wgUserName') === null) {
$('#p-tb').hide();
$('#n-recentchanges').hide();
$('#n-randompage').hide();
$('#n-help').hide();
/*
* Fallback for this older MediaWiki skin.
*/
$('#mw-panel a').each(function () {
var $link = $(this);
var text = $.trim($link.text()).toLowerCase();
var hiddenLinks = [
'recent changes',
'random page',
'help about mediawiki',
'what links here',
'related changes',
'special pages',
'printable version',
'permanent link',
'page information'
];
if ($.inArray(text, hiddenLinks) !== -1) {
var $row = $link.closest('li');
if ($row.length) {
$row.hide();
} else {
$link.hide();
}
}
});
}
}
/*
* Apply immediately and repeat after the older
* MediaWiki skin has finished loading.
*/
configureGladiusSidebar();
window.setTimeout(configureGladiusSidebar, 250);
window.setTimeout(configureGladiusSidebar, 1000);
});