Skip to content

Instantly share code, notes, and snippets.

@gauntface
Last active March 12, 2020 12:56
Show Gist options
  • Star 52 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save gauntface/0c9a02de2ea261aef0ec to your computer and use it in GitHub Desktop.
Save gauntface/0c9a02de2ea261aef0ec to your computer and use it in GitHub Desktop.
A book marklet to toggle styles.
javascript:(function(){var styles = document.querySelectorAll('link[rel=\'stylesheet\']'); for (var s = 0; s < styles.length; s++) {styles[s].mediax = styles[s].media;if (styles[s].media === 'only x') { styles[s].media = styles[s].mediax; } else if (styles[s].media !== 'print') {styles[s].media = 'only x';}}})();
@matthias-vogt
Copy link

Are you ok with me making a Chrome extension from this?


Edit: Never mind, I rewrote this part. The chrome extension is live now, though :) (shameless plug) https://chrome.google.com/webstore/detail/view-crit-css/adbfbeilhdoemcglklgecpkoagnfndhd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment