MediaWiki:Gadget-MobileScript.js

/* Any JavaScript here will be loaded for users of the mobile site */

/* Expand section when only one */ $(function {	setTimeout(function { if ($('.collapsible-heading').length === 1) $('.collapsible-heading:not(.navbox-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('skin') === 'timeless') {		var optionsLink = '/Special:MobileOptions';		var optionsDesc = 'Settings for the mobile site';		mediaWiki.util.addPortletLink('p-tb', optionsLink, 'Mobile options', 't-options', optionsDesc);	} });

/* SmashWiki: Move navboxes to dedicated section */ $(function {	if ($('.navbox-section').length) {		if ($.trim($('section:nth-last-of-type(2) .moveset-nav').first.prev.text) == )			$('section:nth-last-of-type(2) .moveset-nav').first.prev.css('display', 'none');		if ($.trim($('section:nth-last-of-type(2) .sm-single').first.prev.text) == )			$('section:nth-last-of-type(2) .sm-single').first.prev.css('display', 'none');		if ($.trim($('section:nth-last-of-type(2) > .navbox').first.prev.text) == '')			$('section:nth-last-of-type(2) > .navbox').first.prev.css('display', 'none');		if ($('section:nth-last-of-type(2) > *:not(.moveset-nav):not(.mw-empty-elt)').length > 0)			$('section:nth-last-of-type(2) > .moveset-nav').detach.appendTo('.navbox-section');		if ($('section:nth-last-of-type(2) > *:not(.special-moves):not(.mw-empty-elt)').length > 0)			$('section:nth-last-of-type(2) .sm-single').detach.appendTo('.navbox-section'); if ($('section:nth-last-of-type(2) > *:not(.navbox):not(.mw-empty-elt)').length > 0		 || $('.section-heading:nth-last-of-type(2) > .mw-headline#References').length > 0		  || $('.section-heading:nth-last-of-type(2) > .mw-headline#Sources').length > 0) $('section:nth-last-of-type(2) > .navbox').detach.appendTo('.navbox-section'); $('.nav-right').clone.appendTo('.navbox-section'); $('section:nth-last-of-type(2) .sm-multiple').css('display', 'none'); if ($.trim($('.navbox-section').text) == '') { $('.navbox-heading').attr('style', 'display:none !important'); $('.navbox-section').attr('style', 'display:none !important'); }	} });