diff options
| author | Aymeric Augustin | 2013-11-11 20:37:38 +0100 |
|---|---|---|
| committer | Aymeric Augustin | 2013-11-11 20:37:38 +0100 |
| commit | 54e69c49100be7205d1e8533ffa9373af074ed36 (patch) | |
| tree | 7102247ff7dc4916ab5cd43e238d790a624d8a12 /debug_toolbar | |
| parent | 84c336830a3b01a94e9d0e2661ccad1de4545150 (diff) | |
| download | django-debug-toolbar-54e69c49100be7205d1e8533ffa9373af074ed36.tar.bz2 | |
Preserve handle position when the toolbar is shown.
Diffstat (limited to 'debug_toolbar')
| -rw-r--r-- | debug_toolbar/static/debug_toolbar/js/toolbar.js | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/debug_toolbar/static/debug_toolbar/js/toolbar.js b/debug_toolbar/static/debug_toolbar/js/toolbar.js index 7d1bfa8..add8298 100644 --- a/debug_toolbar/static/debug_toolbar/js/toolbar.js +++ b/debug_toolbar/static/debug_toolbar/js/toolbar.js @@ -156,9 +156,7 @@ return false; }); $('#djShowToolBarButton').click(function() { - if (djdt.handleDragged) { - djdt.handleDragged = false; - } else { + if (!djdt.handleDragged) { djdt.show_toolbar(); } return false; @@ -176,11 +174,16 @@ }); $(document).on('mouseup', function () { $(document).off('mousemove'); - var top = handle.offset().top; - $.cookie('djdttop', top, { - path: '/', - expires: 10 - }); + if (djdt.handleDragged) { + var top = handle.offset().top; + $.cookie('djdttop', top, { + path: '/', + expires: 10 + }); + setTimeout(function () { + djdt.handleDragged = false; + }, 10); + } return false; }); $(document).bind('close.djDebug', function() { @@ -201,10 +204,6 @@ return; } }); - var handleTop = $.cookie('djdttop'); - if (handleTop) { - handle.css({top: handleTop + 'px'}); - } if ($.cookie('djdt')) { djdt.hide_toolbar(false); } else { @@ -240,6 +239,11 @@ // finally close toolbar $('#djDebugToolbar').hide('fast'); $('#djDebugToolbarHandle').show(); + // set handle position + var handleTop = $.cookie('djdttop'); + if (handleTop) { + $('#djDebugToolbarHandle').css({top: handleTop + 'px'}); + } // Unbind keydown $(document).unbind('keydown.djDebug'); if (setCookie) { |
