<!-- thumbnail: https://i.sstatic.net/PSXjI.png -->
<!-- excerpt: The script you never knew you needed. -->

*This userscript is part of [SOMU (SO-mod-userscripts)](https://github.com/samliew/SO-mod-userscripts)*

# [Post Headers & Question TOC](https://github.com/samliew/SO-mod-userscripts/blob/master/PostHeadersQuestionToc.user.js)

- Sticky post headers to help when scrolling long posts / comment threads
  - User, revision history, post timeline links
  - Clicking on middle area of post header scrolls to start of post (replaces URL hash)
  
<br>![screenshot](https://raw.githubusercontent.com/samliew/SO-mod-userscripts/master/images/Screenshot_2018-08-07_150823.png)

- Dynamic anchors for header-level text in posts
  - Clicking on header levels 1, 2, 3 will scroll to and replace hash in address bar, which can be copied/used to bookmark an important section in long Q&A pages

- Sticky Question Table of Contents of Answers in sidebar below Featured Posts module
  - Only shown when there are five or more answers
  - Answer score, accepted, user display name, indicates mods and deleted users, datetime
  - Sorted by current answer sort order (active/oldest/votes)
  - Clicking on answer links scrolls to start of post (replaces URL hash)
  - Toggle deleted answers in ToC
  
    ![screenshot](https://raw.githubusercontent.com/samliew/SO-mod-userscripts/master/images/Screenshot_2018-08-07_150848.png)

- Sticky Candidate table of contents on election page

   ![screenshot](https://raw.githubusercontent.com/samliew/SO-mod-userscripts/master/images/Screenshot_2021-10-18_081030.png)


## License

[MIT][1]


## Download

**[View source][2] ([Install][3])**

Userscripts require [Tampermonkey][4] to be installed on your browser.

If you are on Android, your browser options are [Firefox][5] *(recommended)* or [Dolphin][6].


## Code

This userscript is part of [SOMU (SO-mod-userscripts)](https://github.com/samliew/SO-mod-userscripts)

[Bug reports][7], Forks, and PRs welcome!


  [1]: https://github.com/samliew/SO-mod-userscripts/blob/master/LICENCE
  [2]: https://github.com/samliew/SO-mod-userscripts/blob/master/PostHeadersQuestionToc.user.js
  [3]: https://github.com/samliew/SO-mod-userscripts/raw/master/PostHeadersQuestionToc.user.js
  [4]: http://tampermonkey.net
  [5]: https://play.google.com/store/apps/details?id=org.mozilla.firefox
  [6]: https://play.google.com/store/apps/details?id=mobi.mgeek.TunnyBrowser
  [7]: https://github.com/samliew/SO-mod-userscripts/issues