Created
September 20, 2016 19:59
-
-
Save towerofnix/9cc7a6efc8ad8a26d32662a987c75c5c to your computer and use it in GitHub Desktop.
<sa> - Small <a>s
This file contains 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
// <sa> - small <a> | |
const dictionary = { | |
'congruent': '#definition-of-congruent', | |
'right angle': '#definition-of-right-angle', | |
'right angles': '#definition-of-right-angle', | |
'definition of supplementary': '#definition-of-supplementary', | |
'congruent supplementary angles': '#congruent-supplementary-angles' | |
} | |
for (let sa of document.querySelectorAll('sa')) { | |
const text = sa.textContent.toLowerCase() | |
const a = document.createElement('a') | |
if (dictionary.hasOwnProperty(text)) { | |
a.href = dictionary[text] | |
} | |
a.textContent = sa.textContent | |
sa.parentNode.insertBefore(a, sa) | |
sa.remove() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment