Skip to content

Instantly share code, notes, and snippets.

@Elbone
Created June 23, 2014 04:32
Show Gist options
  • Save Elbone/702c7cf418a4a27e9ffe to your computer and use it in GitHub Desktop.
Save Elbone/702c7cf418a4a27e9ffe to your computer and use it in GitHub Desktop.
metaQuery Bookmarklet
<!-- 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>
@Elbone
Copy link
Author

Elbone commented Jun 23, 2014

Ugly as sin, dumb as a box of hammers, but working for me for now.

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