MediaWiki:Minerva.js: Difference between revisions
From Halopedia, the Halo wiki
No edit summary |
No edit summary |
||
Line 6: | Line 6: | ||
$('.navbox-heading').click(); | $('.navbox-heading').click(); | ||
}); | }); | ||
/* Halopedia: Custom menu */ | |||
$.when(mw.loader.using('mediawiki.util'), $.ready).then(function() { | |||
var styleClasses = ['mw-ui-icon', 'mw-ui-icon-before', 'mw-ui-icon-minerva-recentChanges']; | |||
var rcNode = mw.util.addPortletLink('p-navigation', '/Special:RecentChanges', 'Recent changes').getElementsByTagName('a')[0]; | |||
styleClasses.map(function(x) { rcNode.classList.add(x) }); | |||
var menu = 'p-personal'; | |||
if (mw.config.get('wgUserId')) | |||
menu = document.getElementById('p-interaction') ? 'p-interaction' : 'p-navigation'; | |||
mw.util.addPortletLink(menu, '/Category:Video_games', 'Games').getElementsByTagName('a')[0]; | |||
mw.util.addPortletLink(menu, '/Category:Products', 'Other media').getElementsByTagName('a')[0]; | |||
mw.util.addPortletLink(menu, '/Category:Gameplay', 'Gameplay').getElementsByTagName('a')[0]; | |||
mw.util.addPortletLink(menu, '/Category:Universe_and_lore', 'The universe').getElementsByTagName('a')[0]; | |||
mw.util.addPortletLink(menu, '/Archive:Main', 'Halopedia Archive').getElementsByTagName('a')[0]; | |||
} ); |
Revision as of 09:36, February 23, 2023
/* Any JavaScript here will be loaded for users of the Minerva skin */
/* Collapse the navbox section by default */
$(function() {
if ($(window).width() >= 720 && $('.navbox-section:visible').length)
$('.navbox-heading').click();
});
/* Halopedia: Custom menu */
$.when(mw.loader.using('mediawiki.util'), $.ready).then(function() {
var styleClasses = ['mw-ui-icon', 'mw-ui-icon-before', 'mw-ui-icon-minerva-recentChanges'];
var rcNode = mw.util.addPortletLink('p-navigation', '/Special:RecentChanges', 'Recent changes').getElementsByTagName('a')[0];
styleClasses.map(function(x) { rcNode.classList.add(x) });
var menu = 'p-personal';
if (mw.config.get('wgUserId'))
menu = document.getElementById('p-interaction') ? 'p-interaction' : 'p-navigation';
mw.util.addPortletLink(menu, '/Category:Video_games', 'Games').getElementsByTagName('a')[0];
mw.util.addPortletLink(menu, '/Category:Products', 'Other media').getElementsByTagName('a')[0];
mw.util.addPortletLink(menu, '/Category:Gameplay', 'Gameplay').getElementsByTagName('a')[0];
mw.util.addPortletLink(menu, '/Category:Universe_and_lore', 'The universe').getElementsByTagName('a')[0];
mw.util.addPortletLink(menu, '/Archive:Main', 'Halopedia Archive').getElementsByTagName('a')[0];
} );