MediaWiki:Gadget-MakeMobileCollapsible.js

In this article we are going to delve into the fascinating world of MediaWiki:Gadget-MakeMobileCollapsible.js, exploring its origins, evolution and relevance today. MediaWiki:Gadget-MakeMobileCollapsible.js has been the subject of interest and debate for many years, and its influence extends to various areas of society. Along these lines, we will analyze in depth the different aspects that make MediaWiki:Gadget-MakeMobileCollapsible.js such an exciting topic, from its impact on popular culture to its importance in the academic and scientific field. Get ready to discover all the fascinating aspects of MediaWiki:Gadget-MakeMobileCollapsible.js and immerse yourself in a journey that will lead you to better understand its relevance in today's world.
// MakeMobileCollapsible, enables collapsible templates/infoboxes on the mobile site.
// This is a spinoff from Factotum. (https://en.wikipedia.orghttps://wikifreehand.com/en/User:Alexis_Jazz/Factotum)
// MakeMobileCollapsible is public domain, irrevocably released as WTFPL Version 2 by its author, Alexis Jazz.

/*globals $:false,mw:false*/
var MMCollap = {};
MMCollap.do = function(classes,int) {
	MMCollap.els = $('.mw-collapsible');
	if ( MMCollap.els ) {
		if ( MMCollap.els.length > 1 ) {
			// the "autocollapse" class is handled by code in Common.js on enwiki, but Common.js isn't loaded on mobile.
			$('.autocollapse').addClass('mw-collapsed');
		}
		mw.loader.using().then( function () {
			mw.loader.addStyleTag('.mw-parser-output .mw-collapsible-toggle{font-weight:normal;min-width:6em}');
			$(MMCollap.els).makeCollapsible(); //T111565 FTFY
		});
	}
};
//make collapsible content collapsible whenever the page is rendered, on load but also e.g. after saving an edit
mw.hook( 'wikipage.content' ).add( MMCollap.do );