Skip to content

Instantly share code, notes, and snippets.

@fitnr
Last active January 9, 2017 11:31
Show Gist options
  • Save fitnr/8ef668d286d7113afaf8db0468aac2d7 to your computer and use it in GitHub Desktop.
Save fitnr/8ef668d286d7113afaf8db0468aac2d7 to your computer and use it in GitHub Desktop.
Replaces all text on a page with the font size. Useful for debugging the page or just replacing wretched content with something less awful.
javascript:%28function%28%29%7Bvar%20n,walk=document.createTreeWalker%28document.body,NodeFilter.SHOW_TEXT,null,0%29%3Bwhile%28n=walk.nextNode%28%29%29%7Bif(n.textContent.trim%28%29.length>0)n.textContent=window.getComputedStyle(n.parentNode).fontSize%3B%7D%7D%29%28%29
(function() {
var n,
walk = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, 0);
while (n = walk.nextNode()) {
if (n.textContent.trim().length > 0)
n.textContent = window.getComputedStyle(n.parentNode).fontSize;
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment