Created
November 12, 2020 21:05
-
-
Save tomhodgins/db4d3b8eea4598aa150ba490052f3b0c to your computer and use it in GitHub Desktop.
Revisions
-
tomhodgins renamed this gist
Nov 12, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
tomhodgins created this gist
Nov 12, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ function html(strings, ...expressions) { return document.createRange().createContextualFragment( strings.reduce((output, string, index) => output + expressions[index - 1] + string ) ) } document.body.append( html` <style> [data-overview] { position: fixed; top: 0; left: 0; background: rgba(255, 255, 255, .8); padding: 1em; max-height: 100vh; overflow-y: auto; } [data-overview] a { color: black; } :target { background: rgba(255, 255, 0, .1); } </style> <nav data-overview> <ul> ${ Array.from( document.querySelectorAll('[id]'), ({id}) => `<li><a href="#${id}">${id}</a>` ).join('') } </ul> </nav> ` )