Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Citizen.js: Difference between revisions

MediaWiki interface page
No edit summary
No edit summary
Line 24: Line 24:
});
});


// Helper: Expand citizen-section that contains the heading
// Helper: Expand any collapsed parent citizen-section containing the heading
function expandCitizenSectionFromHeading(heading) {
function expandCitizenSectionFromHeading(heading) {
   if (!heading) return;
   if (!heading) return;
Line 30: Line 30:
   let current = heading;
   let current = heading;


  // Walk upward through parents to find the section-heading
   while (current) {
   while (current) {
    // If we find a collapsed citizen-section content block, expand it
    if (current.classList && current.classList.contains('citizen-section') && current.hidden) {
      current.hidden = false;
    }
    // If we reach a section heading, stop
     if (current.classList && current.classList.contains('citizen-section-heading')) {
     if (current.classList && current.classList.contains('citizen-section-heading')) {
      const sectionContent = current.nextElementSibling;
      if (sectionContent && sectionContent.classList.contains('citizen-section') && sectionContent.hidden) {
        sectionContent.hidden = false; // Expand hidden content
      }
       break;
       break;
     }
     }
     current = current.parentElement;
     current = current.parentElement;
   }
   }
}
}


// === Handle direct URL loads with a hash (on page load) ===
// === Handle direct URL loads with a hash (on page load) ===