This app runs inside the BotSurf browser. Don't have it yet? Get the app or extension now!

Hacker News Comment Collapse-All

Utilities · All
0 installs · Verified BotGentz app
Launch App
Opens in BotSurf — try it free, no account needed.
CategoryUtilities
PlatformAll
Pricing Free
Installs0
Download BotSurf to use — free
No account needed for free apps. Once BotSurf is open, find this app in Apps from the + menu.

About this app

WHAT IT DOES

Hacker News Comment Collapse-All scans the current page for Hacker News comment threads, detecting comment trees and their nesting levels. The floating panel provides controls to collapse or expand all comments in the thread, with options to collapse by depth level. A "collapse all" button collapses every comment thread, a "show top-level only" button collapses nested replies, and a depth slider collapses comments beyond a selected nesting depth. A comment count summary is displayed, and collapse state is maintained across page navigation. Keyboard shortcuts (Alt+C, Alt+E) and preferences for default collapse behavior are supported.

WHERE IT RUNS

Works exclusively on Hacker News (news.ycombinator.com) comment pages. The script detects comment threads using HN-specific selectors and comment tree structures. It works best on HN discussion pages and can also detect comments on related HN domains.

HOW TO USE

The panel appears on any Hacker News comment page with controls to manage comment visibility. Use "Collapse All" to hide all nested replies, showing only top-level comments. Use "Expand All" to show all comments. "Top-Level Only" collapses all replies, showing only root comments. The depth slider lets you collapse comments beyond a certain depth—for example, collapse all comments nested deeper than level 2. Individual comment toggles appear next to each comment header, allowing per-thread collapse/expand. Keyboard shortcuts Alt+C (collapse all) and Alt+E (expand all) work anywhere on the page. Collapse state is remembered across page navigation.

MECHANISM — COMMENT TREE DETECTION WITH DEPTH-BASED COLLAPSE

The script detects comment threads using HN-specific selectors (.comment-tree, .athing.comment). Each comment's nesting depth is calculated by measuring the indent width of child comments (40px per level). Comments are grouped by parent-child relationships, and collapsing a parent hides all its children using CSS display:none. The depth slider collapses all comments with a depth greater than the selected value, allowing users to reduce visual clutter. Comment count is calculated by traversing the comment tree and counting all visible comments. The script injects individual toggle buttons into each comment header, and uses a MutationObserver to handle dynamic content updates from HN's pjax-like navigation. Settings are saved locally and applied automatically if configured.

THE PANEL

The floating panel is fully draggable and remembers its position per domain. Click the minimize button to collapse it to a small bubble, or press Escape to hide it. The panel automatically adjusts to different screen sizes and can be resized to show more content. All settings, including default behavior and preferred depth, are saved per domain. The panel integrates smoothly with any page layout using the BGPanel framework, maintaining clean separation from page content.

PLEASE NOTE

This script requires the free BotGentz extension to run. It does not send any data to external servers; all settings and preferences remain entirely local to your browser using GM_setValue. The script never reads password fields, hidden inputs, or file inputs. It stores only user preferences for collapse behavior, depth settings, and keyboard shortcut toggles. The script works exclusively on Hacker News and detects pages by hostname. Comment structure detection depends on HN's HTML; if the layout changes, the script may need updating. Data persists across browser sessions and is isolated per browser profile.

Similar Apps

Log in to BotGentz

Suggest an App

Tell us what you'd find useful — if we build it, we'll email you the moment it's ready.