From 4ec7c8e25c04204c568abbc5acbc75ab672f5d0b Mon Sep 17 00:00:00 2001 From: Phil Crosby Date: Thu, 31 Dec 2009 02:07:47 -0500 Subject: Fix broken behavior when calling hide and then immediately calling show on the HUD. Fixes #37. --- vimiumFrontend.js | 13 ++++++++----- 1 file 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; } -- cgit v1.2.3