Created
March 4, 2015 15:43
-
-
Save jorupp/2af4d8583bd592b8331f to your computer and use it in GitHub Desktop.
Lock all media queries in their current state
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 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