Skip to content

Instantly share code, notes, and snippets.

@brandonjp
Created August 21, 2013 18:01
Show Gist options
  • Save brandonjp/6297802 to your computer and use it in GitHub Desktop.
Save brandonjp/6297802 to your computer and use it in GitHub Desktop.
hides the Barley editor until ESC (or whatever key you choose) is pressed 3 times in a sec
function barleyBarHider(keyCode) { // need the keyCode? try whatthekeycode.com
var bb = jQuery('#barley-bar').children('#barley-logo').slideUp().end().hide();
var pressCount = 0;
var keyCode = typeof keyCode==="number" && ~~keyCode>0 ? ~~keyCode : 27; // use ESC key if error or NaN
jQuery(document).keyup(function(e) {
if (e.keyCode == keyCode) {
pressCount++;
if (pressCount==3) bb.show().children('#barley-logo').slideDown();
setTimeout(function(){pressCount=0},1000);
}
});
}
barleyBarHider();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment