From c61f19ff8eaa7f66a73cd7ef3288206129aaccd6 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 14 Nov 2010 12:57:00 -0500 Subject: [PATCH] Remove the initialized ivar and just check whether the error has been set. --- web_frontend/main.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/web_frontend/main.js b/web_frontend/main.js index e030c1c..fa9c970 100644 --- a/web_frontend/main.js +++ b/web_frontend/main.js @@ -30,12 +30,6 @@ armadillo.App = function() { this.hashChanged_, false, this); this.clearError(false); - /** - * If this is the first load, we don't want to flash the error animating - * out. This will be set to true in the list callback. - * @type {bool} - */ - this.initialized_ = false; var version = goog.string.format('Armadillo %d.%d (%d)', armadillo.Version.MAJOR, armadillo.Version.MINOR, @@ -67,7 +61,7 @@ armadillo.App.prototype.list = function(path) { app.showError(data['message']); return; // Error. } else { - app.clearError(app.initialized_); + app.clearError(true); } // Update the listing. @@ -86,8 +80,6 @@ armadillo.App.prototype.list = function(path) { var fileObject = new armadillo.File(file, path); goog.dom.appendChild(list, fileObject.draw()); }); - - app.initialized_ = true; } this.sendRequest('list', {'path':path}, callback); }; @@ -171,13 +163,14 @@ armadillo.App.prototype.joinPath = function() { armadillo.App.prototype.clearError = function(animate) { var elm = goog.dom.getElement('error'); var anim = new goog.fx.dom.FadeOutAndHide(elm, 500); - if (animate) - anim.play(); - else + if (!goog.dom.getTextContent(elm) || !animate) { anim.hide(); + return; + } goog.events.listenOnce(anim, goog.fx.Animation.EventType.END, function() { goog.dom.setTextContent(elm, ''); }); + anim.play(); }; /** -- 2.43.5