MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

/* Remove mobile title tags on desktop main page */ $(function {	if (mw.config.get('wgTitle') === 'Main Page') {		$('div[id^="mf-"]').each(function(i, obj) { $(this).removeAttr('title'); });	} });

/* Add subpages toolbox link on user pages */ $(function {	var title = mw.config.get('wgTitle');	if (mw.config.get('wgCanonicalNamespace') === 'User' && !title.includes('/') && mw.config.get('skin') !== 'timeless') {		var subpagesLink = '/Special:PrefixIndex/User:' + title + '/';		mediaWiki.util.addPortletLink('p-tb', subpagesLink, 'User subpages', 't-subpages', 'Subpages of this page');	} });

/* Add autocollapse support to mw-collapsible */ function mwCollapsibleSetup($collapsibleContent) { var $element, autoCollapseThreshold = 2; $.each($collapsibleContent, function (index, element) {		$element = $(element);		if ($collapsibleContent.length >= autoCollapseThreshold && $element.hasClass('autocollapse'))			$element.data('mw-collapsible').collapse;	}); } mw.hook('wikipage.collapsibleContent').add(mwCollapsibleSetup);

/* HiddenAppearances gadget helper functions */ function toggleAppearancesPane(eid) { e = document.getElementById(eid); if (e) { e.className = (e.className == "hiddenlist") ? "visiblelist" : "hiddenlist"; } } function showAppearancesPane(eid) { e = document.getElementById(eid); if (e) { e.className = "visiblelist"; } } function hideAppearancesPane(eid) { e = document.getElementById(eid); if (e) { e.className = "hiddenlist"; } }