A user script that adds floating widget displaying table of content of current page.
Currently only tailored for some personal most-visited sites. Feel free to tweak the settings or open a PR.
- Use tocbot for toc generation.
- For some sites, there are no ids on header elements so it would be impossible to navigate by clicking the toc link. Toc Bar will generate ids - which are derived from a simple hash of the header textContent, and prefixed with
tocbar-
- for these headers. - A toggle button is offered, if you don't want toc bar to cover current page content.
- For some sites in SPA mode, if you navigate to another article, there is no easy way detecting url change in userscript, so I add a refresh button to refresh TOC contents.
Inspired by github-toc by Mottie.
The logo uses Mexellent font made by Raymond Larabie.
1.9.6 (2024-01-14)
- do some hacks to ensure MDN page toc anchor active as the page scrolls #14 (c071ac1)
- reset font size (910e196)
- add support for 'gitlab.com' and 'juejin.cn/book'
- feat: don't generate 'toc**' header id for github.com (bb37969)
- feat: add support to indepth.dev (e502408)
- feat: hide toc-bar in print mode, close #7 (7b3b149), closes #7
- feat: optimize for github issues, related #2 (27ce1b0), closes #2
- feat: optimize right edge distance while dragging (ca20775)
- make toc-bar text unselectable (b82e4c1) 感谢 MarkDown down down down
- feat: keep header content hash records to prevent id conflict, close #1
- feat: tocbar style top should not be less than 0 (8ffc3c1)
- fix: Toc trigger shrinks outside page when toggling off (4722d05)
- feat: Add match
*://www.zhihu.com/pub/reader/*
, and fix a little style (36269a5)
- fix: isEmpty dysfunctioning (8374ceb)
- feat: Add match
*://learning.oreilly.com/library/view/*
(c6648ce) - feat: Add site ://developer.chrome.com/extensions/ (27eb121)
- optimize: should ignore empty cachedPosition (61b0eab)
- Add @icon for displaying logo (c33e258)
- store tocbar position and toggle status using GM_setValue, read them during init
- add
initialTop
to site setting
- Add logo, and adjust some styles (ba90dac)