-
-
Save bjrmatos/84624daca5161e082d88 to your computer and use it in GitHub Desktop.
Lock all media queries in their current state
This file contains 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 process(rule) { | |
if(rule.cssRules) { | |
for(var i=rule.cssRules.length-1; i>=0; i--) { | |
process(rule.cssRules[i]); | |
} | |
} | |
if(rule.type == CSSRule.MEDIA_RULE) { | |
if(window.matchMedia(rule.media.mediaText).matches) { | |
rule.media.mediaText = "all"; | |
} else { | |
rule.media.mediaText = "not all"; | |
} | |
} | |
return rule; | |
} | |
for(var i=0; i<document.styleSheets.length; i++) { | |
process(document.styleSheets[i]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment