JS script to dynamically generate a table of content from the elements of a page.