MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
/* | /* | ||
* GladiusRO permanent sidebar configuration. | |||
* GladiusRO | |||
*/ | */ | ||
(function ( | jQuery(function ($) { | ||
'use strict'; | 'use strict'; | ||
function configureGladiusSidebar() { | |||
var $toc = $('#toc'); | |||
var $tools = $('#p-tb'); | |||
var $sidebar = $('#mw-panel'); | |||
function | |||
var sidebar = | |||
/* | /* | ||
* | * Move Contents into the left sidebar. | ||
*/ | */ | ||
var | 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); | |||
if ( | |||
} else { | } 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(); | |||
var | /* | ||
* 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); | |||
}); | |||
Revision as of 03:35, 2 August 2026
/*
* 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);
});