Skip to content

Instantly share code, notes, and snippets.

@stucox
Created March 26, 2013 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stucox/5245589 to your computer and use it in GitHub Desktop.
Save stucox/5245589 to your computer and use it in GitHub Desktop.
Blacks out / reveals the window. Useful as a bookmark (it toggles) — copy the minified version and stick `javascript:` in front of it.
(function () {
var cover = document.getElementById('__cover');
if(cover) {
document.body.removeChild(cover);
}
else {
cover = document.createElement('div');
cover.id = '__cover';
cover.setAttribute('style', 'background:#000;position:fixed;top:0;left:0;width:100%;height:100%;z-index:999999');
document.body.appendChild(cover);
}
}());
(function(){var e=document.getElementById("__cover");if(e){document.body.removeChild(e)}else{e=document.createElement("div");e.id="__cover";e.setAttribute("style","background:#000;position:fixed;top:0;left:0;width:100%;height:100%;z-index:999999");document.body.appendChild(e)}})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment