Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */ $(document).ready(function() { // Wait for collapsible elements to be initialized by MediaWiki mw.hook('wikipage.content').add(function() { var $sections = $('.accordion-section'); // Initialize: disable links in collapsed sections $sections.each(function() { if ($(this).hasClass('mw-collapsed')) { $(this).find('.mw-headline a').css('pointer-events', 'none'); } }); // Handle clicks on headers $sections.on('click', '.mw-headline', function(e) { var $section = $(this).closest('.accordion-section'); var isCollapsed = $section.hasClass('mw-collapsed'); if (isCollapsed) { // Collapse all other sections $sections.not($section).addClass('mw-collapsed'); // Expand this section $section.removeClass('mw-collapsed'); // Enable links in this section $section.find('.mw-headline a').css('pointer-events', 'auto'); // Disable links in all other sections $sections.not($section).find('.mw-headline a').css('pointer-events', 'none'); } else { // Collapse this section $section.addClass('mw-collapsed'); // Disable links in this section $section.find('.mw-headline a').css('pointer-events', 'none'); } // Prevent link click from propagating if collapsed if (e.target.tagName === 'A' && $section.hasClass('mw-collapsed')) { e.preventDefault(); } }); }); });