Last active
December 10, 2015 06:08
-
-
Save evansolomon/4392118 to your computer and use it in GitHub Desktop.
Close Debug Bar with escape key
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
// Generated by CoffeeScript 1.4.0 | |
(function() { | |
(function($) { | |
return $(function() { | |
var db; | |
db = window.wpDebugBar; | |
return $(document).keydown(function(event) { | |
var _ref, _ref1; | |
if (((_ref = db.body) != null ? _ref.hasClass('debug-bar-visible') : void 0) && 27 === event.keyCode) { | |
return (_ref1 = db.actions) != null ? _ref1.close() : void 0; | |
} | |
}); | |
}); | |
})(jQuery); | |
}).call(this); |
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
( ( $ ) -> | |
$ -> | |
# Short reference to the debug bar object | |
db = window.wpDebugBar | |
# Close the debug bar with escape when its open | |
$( document ).keydown ( event ) -> | |
db.actions?.close() if db.body?.hasClass( 'debug-bar-visible' ) and 27 == event.keyCode | |
) jQuery |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment