src/static/js/table-of-contents.js
function TOC(enabled){
		if (!(this instanceof TOC)) return new TOC(enabled);
		this.enabled = !!enabled;
		this._items = {all:[],h1:[],h2:[],h3:[],h4:[]};
		this._last = {h1:null,h2:null,h3:null,h4:null};
	}
function TOC(enabled){
		if (!(this instanceof TOC)) return new TOC(enabled);
		this.enabled = !!enabled;
		this._items = {all:[],h1:[],h2:[],h3:[],h4:[]};
		this._last = {h1:null,h2:null,h3:null,h4:null};
	}
function TOC ( enabled ) { if ( ! ( this instanceof TOC ) ) return new TOC ( enabled ) ; this . enabled = ! ! enabled ; this . _items = { all : [ ] , h1 : [ ] , h2 : [ ] , h3 : [ ] , h4 : [ ] } ; this . _last = { h1 : null , h2 : null , h3 : null , h4 : null } ; }
While this is called `TOC` it actually performs a few functions related to anchors and scrolling.

1. It parses the page for all `H1`, `H2`, `H3` and `H4` elements and ensures they have an id, using either the existing one or generating one by slugifying the headers' text.
2. It adds an `A` element with a link icon that appears on hover to all parsed headers that when clicked simply links back to the current symbol allowing a user to easily get a link to specific documentation.
3. It builds the Table of Contents from the parsed headers and provides the underlying logic for that component.
4. It listens to the `hashchange` event and hijacks all anchor element clicks in the page to ensure when navigating the browser correctly offsets itself.

When disabled by setting the `showTableOfContents` option, the above steps 1, 2 and 4 are still performed to ensure anchor clicks are handled correctly.
@summary Used to parse the page for headers to build the Table of Contents.
@constructor TOC
@param {boolean} enabled - Whether or not the Table of Contents is enabled for this doclet.
@example {@caption The following shows the ready callback that is registered when this script is loaded. The `DOCLET_TOC_ENABLED` variable is set by the template on `window` object.}
$(function(){

var toc = new TOC(DOCLET_TOC_ENABLED);
toc.parse();
if (toc.enabled && toc.any()) {
toc.init();
} else {
toc.fixColumns();
}
toc.offsetScroll(60);

});
While this is called TOC it actually performs a few functions related to anchors and scrolling .