Last active
May 13, 2025 09:41
-
-
Save davidlu1001/c961cff47d262f994e52050b497df08c to your computer and use it in GitHub Desktop.
expand-all-sections.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Function to expand all collapsed sections | |
function expandAllSections() { | |
// Find all chevron-down icons | |
const chevronDownIcons = document.querySelectorAll('i.pxl-icon-chevron-down'); | |
console.log(`Found ${chevronDownIcons.length} collapsed sections to expand`); | |
// Track how many were successfully expanded | |
let expandedCount = 0; | |
// Click each icon to expand its section | |
chevronDownIcons.forEach((icon, index) => { | |
try { | |
// Find the clickable parent element (usually a button or div) | |
const clickableParent = icon.closest('button, [role="button"], [aria-expanded="false"], [class*="expandable"]'); | |
if (clickableParent) { | |
// Click the parent element to expand the section | |
clickableParent.click(); | |
expandedCount++; | |
// Add a small delay if needed to prevent UI issues | |
if (index % 10 === 0) { | |
setTimeout(() => {}, 100); | |
} | |
} else { | |
// If no clickable parent found, try clicking the icon itself | |
icon.click(); | |
expandedCount++; | |
} | |
} catch (error) { | |
console.warn(`Failed to expand section ${index+1}:`, error); | |
} | |
}); | |
console.log(`✅ Successfully expanded ${expandedCount} out of ${chevronDownIcons.length} sections`); | |
// Check if we need to run again (for nested sections that weren't visible before) | |
const remainingIcons = document.querySelectorAll('i.pxl-icon-chevron-down'); | |
if (remainingIcons.length > 0) { | |
console.log(`Found ${remainingIcons.length} additional sections to expand. Running again...`); | |
setTimeout(expandAllSections, 500); // Run again after a short delay | |
} | |
} | |
// Execute the function | |
expandAllSections(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment