Jump to content

MediaWiki:Common.js

From nUSA Wiki
Revision as of 00:59, 14 January 2025 by Jord (talk | contribs)

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.
document.addEventListener("DOMContentLoaded", function() {
    // Get all toggle headers (sections)
    const toggleHeaders = document.querySelectorAll('.toggle-header');

    toggleHeaders.forEach(function(header) {
        // Add click event listener to each header
        header.addEventListener('click', function() {
            // Find the content to toggle (it's the next sibling)
            const content = header.nextElementSibling;

            // Toggle the visibility of the content
            if (content && content.classList.contains('toggle-content')) {
                content.style.display = (content.style.display === 'none' || content.style.display === '') ? 'block' : 'none';
            }
        });
    });
});