ChatGPT | Table of Contents / TOC

Floating Table of Contents sidebar for ChatGPT conversations. Uses backend API for 100% accuracy (no lazy-loading gaps). Draggable toggle button, expandable message headers, click-to-navigate, persistent state.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

作者
piknockyou
今日安裝
1
安裝總數
17
評價
0 0 0
版本
3.3
建立日期
2025-12-01
更新日期
2025-12-31
尺寸
27.4 KB
授權條款
AGPL-3.0
腳本執行於

See screenshots at the bottom

ChatGPT | TOC (Table of Contents)

Adds a floating Table of Contents sidebar for navigating long ChatGPT conversations. Built on the backend API for 100% accuracy—no lazy-loading gaps.

Why You Need This

Long ChatGPT conversations become difficult to navigate:

  • Lost context: Hard to find that one message from 50 turns ago.
  • No overview: ChatGPT provides no way to see conversation structure at a glance.
  • DOM limitations: Other TOC scripts miss messages due to ChatGPT's lazy-loading/virtualization.

This script fetches the full conversation tree directly from ChatGPT's internal API, ensuring every message appears in the TOC.

Key Features

  • Complete Accuracy: Uses backend-api instead of DOM scraping—no missing messages from virtualization.
  • Expandable Headers: Messages with markdown headers (# H1, ## H2, etc.) or bold text (**Header**) show nested sub-navigation.
  • Distinct Icons: User messages and AI responses have different icons for quick visual scanning.
  • Draggable Toggle Button: Right-drag to reposition the toggle button anywhere on screen (position persists across sessions).
  • Smart Sidebar Positioning: Sidebar positions itself relative to the button, always staying within viewport bounds.
  • Click-to-Navigate: Click any TOC entry to scroll directly to that message with a subtle highlight flash.
  • Header Deep-Links: Expand a message's headers and click to jump directly to that specific section.
  • Persistent State: Open/closed state and button position saved via GM storage.
  • Auto-Refresh: Automatically updates when new messages are added or you switch conversations.

How to Use

Action Result
Left-click toggle button Open/close the TOC sidebar
Right-drag toggle button Move button anywhere (only when TOC is closed)
Click TOC entry Scroll to that message
Click arrow on entry Expand/collapse sub-headers
Click sub-header Scroll directly to that heading within the message

Architecture Difference

Unlike DOM-scraping approaches, this script:

  1. Fetches the full conversation from /backend-api/conversation/{uuid}
  2. Walks the message tree from current_node back to root
  3. Extracts headers from raw message text

This bypasses ChatGPT's virtualization entirely—messages that aren't rendered in the DOM still appear in the TOC.

Installation

  1. Install Violentmonkey, Tampermonkey, or Greasemonkey.
  2. Install this script.
  3. Visit chatgpt.com.

Works immediately. A toggle button (☰) appears in the top-right corner.