diff options
| author | Rob Hudson | 2009-08-28 14:49:10 -0700 |
|---|---|---|
| committer | Rob Hudson | 2009-08-28 14:49:10 -0700 |
| commit | f25ec5bb9998f26c75fccf85c880c23502c9e165 (patch) | |
| tree | fc6228b0fa10e2a6d2474357eac44b2fa8b0c6c0 | |
| parent | 96966b8e86ca8a4a12359312d5ab7351d3788dfd (diff) | |
| download | django-debug-toolbar-f25ec5bb9998f26c75fccf85c880c23502c9e165.tar.bz2 | |
Fixed so key bindings are setup on init, regardless of toolbar cookie.
| -rw-r--r-- | debug_toolbar/media/debug_toolbar/toolbar.js | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/debug_toolbar/media/debug_toolbar/toolbar.js b/debug_toolbar/media/debug_toolbar/toolbar.js index ccd0185..8155e2f 100644 --- a/debug_toolbar/media/debug_toolbar/toolbar.js +++ b/debug_toolbar/media/debug_toolbar/toolbar.js @@ -14,13 +14,13 @@ jQuery(function($j) { current = $j('#djDebug #' + this.className); if (current.is(':visible')) { $j(document).trigger('close.djDebug'); - $j(this).parent().removeClass("active"); + $j(this).parent().removeClass('active'); } else { $j('.panelContent').hide(); // Hide any that are already open current.show(); $j.djDebug.open(); - $j('#djDebugToolbar li').removeClass("active"); - $j(this).parent().addClass("active"); + $j('#djDebugToolbar li').removeClass('active'); + $j(this).parent().addClass('active'); } return false; }); @@ -58,7 +58,7 @@ jQuery(function($j) { if ($j.cookie(COOKIE_NAME)) { $j.djDebug.hide_toolbar(false); } else { - $j('#djDebugToolbar').show(); + $j.djDebug.show_toolbar(false); } }, open: function() { @@ -80,10 +80,12 @@ jQuery(function($j) { $j('#djDebugWindow').hide(); // close all panels $j('.panelContent').hide(); - $j('#djDebugToolbar li').removeClass("active"); + $j('#djDebugToolbar li').removeClass('active'); // finally close toolbar - $j('#djDebugToolbar').hide("fast"); + $j('#djDebugToolbar').hide('fast'); $j('#djDebugToolbarHandle').show(); + // Unbind keydown + $j(document).unbind('keydown.djDebug'); if (setCookie) { $j.cookie(COOKIE_NAME, 'hide', { path: '/', @@ -91,7 +93,7 @@ jQuery(function($j) { }); } }, - show_toolbar: function() { + show_toolbar: function(animate) { // Set up keybindings $j(document).bind('keydown.djDebug', function(e) { if (e.keyCode == 27) { @@ -99,7 +101,11 @@ jQuery(function($j) { } }); $j('#djDebugToolbarHandle').hide(); - $j('#djDebugToolbar').show("fast"); + if (animate) { + $j('#djDebugToolbar').show('fast'); + } else { + $j('#djDebugToolbar').show(); + } $j.cookie(COOKIE_NAME, null, { path: '/', expires: -1 @@ -125,7 +131,6 @@ jQuery(function($j) { // Otherwise, just minimize the toolbar if ($j('#djDebugToolbar').is(':visible')) { $j.djDebug.hide_toolbar(true); - $j(document).unbind('keydown.djDebug'); return; } }); |
