Skip to content

Instantly share code, notes, and snippets.

@nakulj
Last active March 15, 2023 03:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nakulj/88c33935947140e93587fce4f39f8382 to your computer and use it in GitHub Desktop.
Save nakulj/88c33935947140e93587fce4f39f8382 to your computer and use it in GitHub Desktop.
Make bloomberg footnotes readable
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