diff options
| author | Phil Crosby | 2009-12-31 02:07:47 -0500 |
|---|---|---|
| committer | Phil Crosby | 2009-12-31 02:07:47 -0500 |
| commit | 4ec7c8e25c04204c568abbc5acbc75ab672f5d0b (patch) | |
| tree | 8d2bae7b2f1a8564f30ff9a4393abfffdcb97567 | |
| parent | a8b0a87252fde722eae1672409bee30bf79c1bbb (diff) | |
| download | vimium-4ec7c8e25c04204c568abbc5acbc75ab672f5d0b.tar.bz2 | |
Fix broken behavior when calling hide and then immediately calling show on the HUD. Fixes #37.
| -rw-r--r-- | vimiumFrontend.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/vimiumFrontend.js b/vimiumFrontend.js index d3345053..b5490471 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -393,6 +393,8 @@ function exitFindMode() { * Note: you cannot interact with the HUD until document.body is available. */ HUD = { + _tweenId: -1, + showForDuration: function(text, duration) { HUD.show(text); HUD._showForDurationTimerId = setTimeout(function() { HUD.hide(); }, duration); @@ -401,10 +403,9 @@ HUD = { show: function(text) { clearTimeout(HUD._showForDurationTimerId); HUD.displayElement().innerHTML = text; - if (HUD.displayElement().style.opacity == 0) { - Tween.fade(HUD.displayElement(), 1.0, 150); - HUD.displayElement().style.display = ""; - } + clearInterval(HUD._tweenId); + HUD._tweenId = Tween.fade(HUD.displayElement(), 1.0, 150); + HUD.displayElement().style.display = ""; }, updatePageZoomLevel: function(pageZoomLevel) { @@ -447,7 +448,9 @@ HUD = { }, hide: function() { - Tween.fade(HUD.displayElement(), 0, 150, function() { HUD.displayElement().display == "none"; }); + clearInterval(HUD._tweenId); + HUD._tweenId = Tween.fade(HUD.displayElement(), 0, 150, + function() { HUD.displayElement().display == "none"; }); }, isReady: function() { return document.body != null; } |
