Skip to content

Instantly share code, notes, and snippets.

@nbogie
Last active May 29, 2020 09:53
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 nbogie/1b288cf35b246903c95184ea74a5c56e to your computer and use it in GitHub Desktop.
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)
(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