4 ms·
Show HN: User Script to fold HN comment subtrees
- pdkl95 11y agoWarning: I left a few ugly hacks[1][2] in it (and not nearly enough comments), and I've only tested it under a recent-ish firefix+greasemonkey. There could easily be bugs, especially in the layout. That said, I think I'm using features that should be standard everywhere (e.g. querySelect). The icon for the voting triangle is repurposed with a 90deg rotation and some opacity. This could probably use it's own icon(s)? I'm not sure. Anyway, I wanted a quick method to collapse comment theads, and I ended up with a tool that lets you fold/unfold any subtree (as determined by the indent width). [1] I'm sure there are better ways to handle the CSS for the fold-icon. The <div style="width: ..."> hack seems to be necessary or the icon wraps to the next line. This might be completely unnecessary if the icon was placed somewhere saner. [2] I should be binding the click handler once above all the posts. Probably not a hard change, but for now the per-comment closure seems to work fine.