Created
November 6, 2012 10:29
-
-
Save mikermcneil/4023909 to your computer and use it in GitHub Desktop.
Bookmarklet to toggle transparent black veil over current interface
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
// *Usage* | |
// Include the following as a bookmark: | |
// javascript: var gistSrc = "https://raw.github.com/gist/4022488/d8b31cf4fb663ce2b1afee89f3bd6bf72479c10c/quick-veil.js";console.log("Toggling veil, please wait...");function loadScript(src, optionalCallback) { var s = document.createElement("script"); s.type = "text/javascript"; s.src = src; var context = document.getElementsByTagName('script')[0]; context.parentNode.insertBefore(s, context); s.async = true; s.addEventListener('load', optionalCallback);}if(typeof veil_liev !== "undefined" && veil_liev) { jQuery("#veil-liev").stop().fadeTo(250, 0, function() { console.log("Veil lifted."); veil_liev = false; jQuery("#veil-liev").remove(); });} else { function afterLoadScript() { drawVeil(0.65, function(v) { veil = v; console.log("Veil dropped."); veil_liev = true; }); } if(typeof veil_liev !== "undefined") { afterLoadScript(); } else { loadScript(gistSrc, afterLoadScript); }} | |
// Source: | |
var gistSrc = "https://raw.github.com/gist/4022488/d8b31cf4fb663ce2b1afee89f3bd6bf72479c10c/quick-veil.js"; | |
console.log("Toggling veil, please wait..."); | |
function loadScript(src, optionalCallback) { | |
var s = document.createElement("script"); | |
s.type = "text/javascript"; | |
s.src = src; | |
var context = document.getElementsByTagName('script')[0]; | |
context.parentNode.insertBefore(s, context); | |
s.async = true; | |
s.addEventListener('load', optionalCallback); | |
} | |
if(typeof veil_liev !== "undefined" && veil_liev) { | |
jQuery("#veil-liev").stop().fadeTo(250, 0, function() { | |
console.log("Veil lifted."); | |
veil_liev = false; | |
jQuery("#veil-liev").remove(); | |
}); | |
} else { | |
function afterLoadScript() { | |
drawVeil(0.65, function(v) { | |
veil = v; | |
console.log("Veil dropped."); | |
veil_liev = true; | |
}); | |
} | |
if(typeof veil_liev !== "undefined") { | |
afterLoadScript(); | |
} else { | |
loadScript(gistSrc, afterLoadScript); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Before:
After: