MediaWiki:Gadget-Navbox.js

/* JavaScript enhancements for Template:Navbox.



$(document).ready(function {

// Automatically expand navbox when there is only one const navboxes = $(".zw-navbox"); if (navboxes.length == 1) { navboxes.removeClass("mw-collapsed"); }

// If there are multiple navboxes generated by Template:Categories but only one manually curated one, uncollapse that one const curatedNavboxes = navboxes.not(".zw-categories__navboxes .zw-navbox"); if (curatedNavboxes.length == 1) { curatedNavboxes.removeClass("mw-collapsed"); }

// Automatically expand navbox if it is the link target const targetedNavbox = navboxes.filter(":target"); if (targetedNavbox.length == 1) { targetedNavbox.removeClass("mw-collapsed"); } });