Last active
May 29, 2020 09:53
-
-
Save nbogie/1b288cf35b246903c95184ea74a5c56e to your computer and use it in GitHub Desktop.
An example one-liner to annotate all 'p' and 'a' tags in the current page. Paste it into the devtools. (if you trust the 'rough-notation' module)
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
(async () => { | |
const RoughNotation = await import('https://unpkg.com/rough-notation?module'); | |
const pick = (arr) => arr[Math.floor(Math.random() * arr.length)]; | |
const colorNames = "#66FF66 #FD5B78 #FF9966 #FFFF66 #50BFE6 #FF00CC".split(" "); | |
document.querySelectorAll('p').forEach(elem => { | |
RoughNotation.annotate(elem, { type: 'box', color: 'black', strokeWidth: pick([1, 2, 10]) }).show(); | |
}); | |
document.querySelectorAll('a').forEach(elem => { | |
RoughNotation.annotate(elem, { type: 'highlight', color: pick(colorNames) }).show(); | |
elem.style.color = 'black'; | |
}); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment