Skip to content

Instantly share code, notes, and snippets.

@ivan
Last active June 16, 2022 19:20
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 ivan/9a7d950f4f8d9b5011008bde7f3bf3bb to your computer and use it in GitHub Desktop.
Save ivan/9a7d950f4f8d9b5011008bde7f3bf3bb to your computer and use it in GitHub Desktop.
bookmarklet to read a page with a reduced width

save with a bookmark keyword (Firefox) or search engine shortcut (Chrome), e.g. "readw" and then run with "readw 30"

javascript:(function() { var width = %s || 40; var styles=`div, p { line-height: 135% } body { margin: 0 auto 0 auto !important; max-width: ${width}em }`; var newSS=document.createElement('link'); newSS.rel='stylesheet'; newSS.href='data:text/css,' + escape(styles); document.getElementsByTagName("head")[0].appendChild(newSS); })();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment