MediaWiki:Gadget-MobileScript.js: Difference between revisions
From Halopedia, the Halo wiki
mNo edit summary |
mNo edit summary |
||
Line 32: | Line 32: | ||
if ($.trim($('section:nth-last-of-type(2) .succession-box').first().prev().text()) == '') | if ($.trim($('section:nth-last-of-type(2) .succession-box').first().prev().text()) == '') | ||
$('section:nth-last-of-type(2) .succession-box').first().prev().css('display', 'none'); | $('section:nth-last-of-type(2) .succession-box').first().prev().css('display', 'none'); | ||
$('section:nth-last-of-type(2) > .succession-box').detach().appendTo('.navbox-section'); | |||
$('section:nth-last-of-type(2) > .navbox').detach().appendTo('.navbox-section'); | |||
} | } | ||
}); | }); |
Latest revision as of 16:09, March 23, 2025
/* Any JavaScript here will be loaded for users of the mobile site */
/* Expand single talk section */
$(function() {
setTimeout(function() {
if ($('.ns-talk .collapsible-heading').length === 1)
$('.collapsible-heading:not(.open-block)').click();
}, 100);
});
/* Collapse boxes on smaller devices */
function mwMobileCollapse($collapsibleContent) {
if ($(window).width() < 720)
$.each($collapsibleContent, function(index, element) {
$(element).data('mw-collapsible').collapse();
});
}
mw.hook('wikipage.collapsibleContent').add(mwMobileCollapse);
/* Add mobile options toolbox link on Timeless */
$(function() {
if (mw.config.get('wgMFMode') && mw.config.get('skin') === 'timeless') {
var optionsLink = '/Special:MobileOptions';
var optionsDesc = 'Settings for the mobile site';
mw.util.addPortletLink('p-tb', optionsLink, 'Mobile options', 't-options', optionsDesc);
}
});
/* Move navboxes to dedicated section */
$(function() {
if ($('.navbox-section').length) {
if ($.trim($('section:nth-last-of-type(2) .succession-box').first().prev().text()) == '')
$('section:nth-last-of-type(2) .succession-box').first().prev().css('display', 'none');
$('section:nth-last-of-type(2) > .succession-box').detach().appendTo('.navbox-section');
$('section:nth-last-of-type(2) > .navbox').detach().appendTo('.navbox-section');
}
});