Created
June 23, 2014 04:32
-
-
Save Elbone/702c7cf418a4a27e9ffe to your computer and use it in GitHub Desktop.
metaQuery Bookmarklet
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
<!-- Bookmarklet --> | |
<a href='javascript:var _metaQueryDiv = document.createElement("div");_metaQueryDiv.id = "_metaQueryBookmarklet";document.getElementsByTagName("body")[0].appendChild(_metaQueryDiv);var _metaQuery_style = document.createElement("style");_metaQuery_style.type = "text/css";_metaQuery_style.innerHTML = "#_metaQueryBookmarklet{position:fixed; bottom:-1px;right: -1px;border-radius:3px 0 0 0;background-color:#ddd;color:#666;border:1px solid;padding:8px;font-family:sans-serif;font-size:12px;}";document.getElementsByTagName("body")[0].appendChild(_metaQuery_style);metaQuery.onBreakpointChange( function (activeBreakpoints) {document.getElementById( "_metaQueryBookmarklet").innerHTML = activeBreakpoints.join(", ");});'>metaQuery Bookmarklet</a> | |
<!-- Source --> | |
<script> | |
// Create the div | |
var _metaQueryDiv = document.createElement("div"); | |
_metaQueryDiv.id = "_metaQueryBookmarklet"; | |
document.getElementsByTagName("body")[0].appendChild(_metaQueryDiv); | |
// Create the style element | |
var _metaQuery_style = document.createElement("style"); | |
_metaQuery_style.type = "text/css"; | |
_metaQuery_style.innerHTML = "#_metaQueryBookmarklet{position:fixed; bottom:-1px;right: -1px;border-radius:3px 0 0 0;background-color:#ddd;color:#666;border:1px solid;padding:8px;font-family:sans-serif;font-size:12px;}"; | |
document.getElementsByTagName("body")[0].appendChild(_metaQuery_style); | |
// Update values | |
metaQuery.onBreakpointChange( function (activeBreakpoints) { | |
document.getElementById( "_metaQueryBookmarklet").innerHTML = activeBreakpoints.join(', '); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ugly as sin, dumb as a box of hammers, but working for me for now.