User:Benwing2/common.js

importScript("User:Ioaxxere/minitoc.js");

// Various fixes for the trees generated by Module:family tree. $(function {	// Show the top toggle.	$('.ft-toptoggle').css('display', '');	var customtogglePrefix = 'ft';	// Initialize the text of the toggles.	$('.ftree').get.forEach(function (tree) { var isCollapsed = tree.classList.contains('mw-collapsed'); var toggles = $(tree).find('.ft-toggle'); if (toggles[0]) { var customToggleClass = Array.prototype.filter.call(toggles[0].classList, function (className) {				return className.indexOf('mw-customtoggle-' + customtogglePrefix) === 0;			})[0]; if (customToggleClass) { var toggledElement = $('#' + customToggleClass.replace('mw-customtoggle', 'mw-customcollapsible')); if (toggledElement) { toggles.html(toggledElement.data(isCollapsed ? 'expandtext' : 'collapsetext')); }			}		}	});	// Change the text in the custom toggles generated by Module:family tree	// when they are clicked.	$('.mw-collapsible').on('beforeExpand.mw-collapsible beforeCollapse.mw-collapsible', function (event) { if (this.id.indexOf('mw-customcollapsible-' + customtogglePrefix) === 0) { var toggle = $('.' + this.id.replace('mw-customcollapsible', 'mw-customtoggle')); if (event.type === 'beforeExpand') { toggle.html(this.dataset.collapsetext); } else { // beforeCollapse toggle.html(this.dataset.expandtext); }           event.stopPropagation; }   }); });