aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/media/toolbar.js
diff options
context:
space:
mode:
authorReto Aebersold2009-01-17 12:18:19 -0800
committerRob Hudson2009-01-17 12:18:19 -0800
commit9d335bed8c83981370429833d1c5fd7f31b97a5e (patch)
tree0d3f87d2364704f026ffdcb423ab5946b7a7e35a /debug_toolbar/media/toolbar.js
parent9a7eb740ee424bd335701b1a40d860f5fcdc151d (diff)
downloaddjango-debug-toolbar-9d335bed8c83981370429833d1c5fd7f31b97a5e.tar.bz2
Adding ability to show/hide toolbar, using jquery.cookie.js for statefulness.
Signed-off-by: Rob Hudson <rob@cogit8.org>
Diffstat (limited to 'debug_toolbar/media/toolbar.js')
-rw-r--r--debug_toolbar/media/toolbar.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/debug_toolbar/media/toolbar.js b/debug_toolbar/media/toolbar.js
index 455a2fc..dcd52ae 100644
--- a/debug_toolbar/media/toolbar.js
+++ b/debug_toolbar/media/toolbar.js
@@ -1,6 +1,7 @@
var _$ = window.$;
jQuery.noConflict();
jQuery(function($) {
+ var COOKIE_NAME = 'dj_debug_panel';
$.djDebug = function(data, klass) {
$.djDebug.init();
}
@@ -35,6 +36,17 @@ jQuery(function($) {
$('#djDebugTemplatePanel a.djTemplateShowContext').click(function() {
$.djDebug.toggle_content($(this).parent().next());
});
+ $('#djHideToolBarButton').click(function() {
+ $.djDebug.hide_toolbar(true);
+ });
+ $('#djShowToolBarButton').click(function() {
+ $.djDebug.show_toolbar();
+ });
+ if($.cookie(COOKIE_NAME)){
+ $.djDebug.hide_toolbar(false);
+ }else{
+ $('#djDebugToolbar').show();
+ }
},
open: function() {
$(document).bind('keydown.djDebug', function(e) {
@@ -53,6 +65,18 @@ jQuery(function($) {
close: function() {
$(document).trigger('close.djDebug');
return false;
+ },
+ hide_toolbar: function(setCookie) {
+ $('#djDebugToolbar').hide("fast");
+ $('#djDebugToolbarHandle').show();
+ if(setCookie){
+ $.cookie(COOKIE_NAME, 'hide', {path: '/', expires: 10 });
+ }
+ },
+ show_toolbar: function() {
+ $('#djDebugToolbarHandle').hide();
+ $('#djDebugToolbar').show("fast");
+ $.cookie(COOKIE_NAME, null, {path: '/', expires: -1 });
}
});
$(document).bind('close.djDebug', function() {
@@ -64,3 +88,4 @@ jQuery(function() {
jQuery.djDebug();
});
$ = _$;
+