Google AI Studio | Collapse/Expand All Code Blocks (Manual/Automatic)

Collapse/expand all code blocks with dual toolbar buttons, auto-collapse mode, and lazy loading support.

這裡只顯示彼此間有代碼差異的版本。 顯示所有版本。

  • v2.8 2026-01-01

    v2.9

    • Name change
  • v2.7 2026-01-01

    v2.8:

    • Moved persistence from localStorage → GM userscript storage (GM_getValue / GM_setValue).
    • Added migration from legacy localStorage into GM storage (with cleanup after successful save).
    • Default remains Auto‑Collapse OFF.
  • v2.6 2026-01-01

    v2.6

    • Replaced the single toggle button + “collapse/expand mode” cycling with two dedicated toolbar buttons: Collapse All and Expand All.
    • Added Auto‑Collapse mode (optional) that automatically collapses newly added/lazy-loaded code blocks.
    • Added hold gesture on the Collapse button (press-and-hold) to toggle Auto‑Collapse ON/OFF.
    • Added a custom tooltip system (hover hints + hold feedback + confirmation messages) with smart positioning.
    • Added hold fill animations to make the long-press action obvious.
    • Updated UI styling to be more Material/AI‑Studio-like (circular hover “glow”, light/dark friendly), while keeping blue = collapse and amber = expand.
    • Changed persistence from {isActive, collapseMode} to a simpler settings model: { autoMode: 'off' | 'collapse' }.
    • Implemented automatic localStorage migration from the old v1.x saved state to the new settings format.
    • Observer behavior now focuses on auto-mode application to new blocks rather than continuously enforcing expand/collapse modes globally.
    • Tweaked debounce timing for block toggles (500ms → 300ms) to feel snappier.
  • v1.6 2025-12-29

    Script name changed from "Google AI Studio | Toggle Code Blocks" to "Google AI Studio | Collapse/Expand All Code Blocks Toggle"

  • v1.4 2025-12-22

    Optimized the toolbar MutationObserver to avoid per-node subtree scanning by using a single toolbar lookup per mutation batch, reducing DOM overhead during SPA updates.

  • v1.3 2025-12-21
  • v1.0 2025-12-21