Collapse/expand all code blocks with dual toolbar buttons, auto-collapse mode, and lazy loading support.
See screenshot at the bottom
Adds two toolbar buttons in Google AI Studio to collapse all or expand all code blocks instantly, plus an optional Auto‑Collapse mode for newly generated / lazy-loaded blocks.
AI Studio chats can get clogged with long code snippets. This script gives you quick, native-feeling controls to manage code block visibility:
MutationObserver to catch code blocks loaded later (scrolling, navigation, generation).GM_setValue / GM_getValue).