Last active
March 15, 2023 03:13
-
-
Save nakulj/88c33935947140e93587fce4f39f8382 to your computer and use it in GitHub Desktop.
Make bloomberg footnotes readable
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 characters
const $ = q => document.querySelector(q); | |
const $$ = q => document.querySelectorAll(q); | |
const num_elements = $$('li.html-footnote').length | |
console.log(`replacing ${num_elements} items`); | |
for (i = 1; i <= num_elements; i++) { | |
console.log(`element ${i}`) | |
const footnote = $(`#footnote-${i}`).parentElement.querySelector('p'); | |
const m = document.createElement('blockquote'); | |
m.innerHTML = footnote.innerHTML; | |
const anchor = $(`a[href='#footnote-${i}']`); | |
anchor.href = '#'; | |
anchor.onclick = () => { | |
anchor.replaceWith(m); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment