MediaWiki:Minerva.js: Difference between revisions
From Destinypedia, the Destiny wiki
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for users of the Minerva skin */ | /* Any JavaScript here will be loaded for users of the Minerva skin */ | ||
/* Collapse the navbox section by default */ | /* Collapse the navbox section by default */ | ||
Line 15: | Line 6: | ||
$('.navbox-heading').click(); | $('.navbox-heading').click(); | ||
}); | }); | ||
/* Destinypedia: 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:Games', 'Games').getElementsByTagName('a')[0]; | |||
mw.util.addPortletLink(menu, '/Category:Products', 'Other media').getElementsByTagName('a')[0]; | |||
mw.util.addPortletLink(menu, '/Category:Gameplay_mechanics', 'Gameplay').getElementsByTagName('a')[0]; | |||
mw.util.addPortletLink(menu, '/Category:Destiny_universe', 'The universe').getElementsByTagName('a')[0]; | |||
mw.util.addPortletLink(menu, '/Category:Lore', 'Lore database').getElementsByTagName('a')[0]; | |||
} ); |
Revision as of 08:55, February 22, 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();
});
/* Destinypedia: 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:Games', 'Games').getElementsByTagName('a')[0];
mw.util.addPortletLink(menu, '/Category:Products', 'Other media').getElementsByTagName('a')[0];
mw.util.addPortletLink(menu, '/Category:Gameplay_mechanics', 'Gameplay').getElementsByTagName('a')[0];
mw.util.addPortletLink(menu, '/Category:Destiny_universe', 'The universe').getElementsByTagName('a')[0];
mw.util.addPortletLink(menu, '/Category:Lore', 'Lore database').getElementsByTagName('a')[0];
} );