Last active
June 25, 2025 12:35
-
-
Save bobbykjack/af6f1221b3ff0921189d9e683918fb2f to your computer and use it in GitHub Desktop.
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
| function set_stylesheet_disable(val) { | |
| for (let i = 0; i < document.styleSheets.length; i++) { | |
| document.styleSheets.item(i).disabled = val; | |
| } | |
| } | |
| function disable_stylesheets_hold() { | |
| document.addEventListener("keydown", function (e) { | |
| if (e.key === "Escape") { | |
| set_stylesheet_disable(true); | |
| } | |
| }); | |
| document.addEventListener("keyup", function (e) { | |
| if (e.key === "Escape") { | |
| set_stylesheet_disable(false); | |
| } | |
| }); | |
| } | |
| function disable_stylesheets_toggle() { | |
| document.addEventListener("keyup", function (e) { | |
| if (e.key === "Escape" && document.styleSheets.length) { | |
| set_stylesheet_disable(!document.styleSheets.item(0).disabled); | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment