AI Studio - Auto-Collapse Code Blocks

Auto-collapses code blocks in Google AI Studio by interacting natively with Angular Material components.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu betiği yüklemek için bir betik yöneticisi eklentisi yüklemeniz gerekecektir.

(Zaten bir betik yöneticim var, hadi yükleyelim!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

Yazar
csanchez
Günlük kurulumlar
0
Toplam kurulumlar
0
Değerlendirmeler
0 0 0
Versiyon
1.0
Oluşturulma
09.08.2026
Güncellenme
09.08.2026
Boyut
2,24 KB
Lisans
MIT
Geçerli

Description

A simple yet essential userscript to keep your interface clean and organized in Google AI Studio.

💡 Why use this script?

When interacting with the AI to write entire programs, refactor functions, or build complex scripts, responses often contain massive blocks of code. This clutters the chat, breaks your reading flow, and forces you to do endless scrolling just to read the AI's explanations or find previous messages in the conversation.

This script solves that problem by automatically collapsing all code blocks as soon as they appear on the screen. If you need to review, copy, or download the generated code, simply click the header to expand it back out.

⚙️ Technical Details

Google AI Studio is a Single Page Application (SPA) built on Angular using Angular Material UI components. Trying to hide code blocks by injecting crude CSS styles (like display: none or hacking max-heights) often causes visual glitches or breaks constantly due to dynamic streaming (as the AI generates text token by token and re-renders the Virtual DOM).

Instead of fighting against the framework, this script works in harmony with it:

  1. It uses a lightweight MutationObserver to detect the creation of new <mat-expansion-panel> components.
  2. It waits a fraction of a second to allow Angular to finish rendering the component and attach its internal event listeners.
  3. It triggers a native click event directly on the panel header.

As a result, Angular handles closing the block using its own internal logic and native animations, ensuring that the entire UI (including copy and download buttons) stays completely intact and functional, no matter how much code the AI streams in the background.