Remove the initialized ivar and just check whether the error has been set.
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 14 Nov 2010 17:57:00 +0000 (12:57 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 14 Nov 2010 17:57:00 +0000 (12:57 -0500)
web_frontend/main.js

index e030c1cbece77834e99392a77dda98c2c473ae2d..fa9c970d841f260d29033297aaab5c677aa9b031 100644 (file)
@@ -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();
 };
 
 /**