Skip to content

Commit

Permalink
wait for images to load in burn
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislas Duprey committed Apr 4, 2012
1 parent 235d2c8 commit 5b0a958
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 24 deletions.
24 changes: 13 additions & 11 deletions build/javascripts/burn.js
Expand Up @@ -384,17 +384,20 @@ o.$LAB=J();
}
$(":visible").each(function(){ tryadd(this, true); });
$(":visible").each(function(){ tryadd(this, false); });
console.log($els.length);
console.log("burning "+$els.length+" elements on the page");
$els.append(htmlTemplate);
$(".huge-bookmarklet-burn").each(function(){
var $this = $(this);
var $parent = $this.parent();
$this.animate({height: $parent.outerHeight()-minHeight}, 2000);
});
$(".flamme2").each(function(){
var $this = $(this);
var $parent = $this.parent();
$this.animate({bottom: $parent.outerHeight()-minHeight}, 2000);
$els.load(function(){
$("#huge-bookmarklet-loader").fadeOut(200);
$(".huge-bookmarklet-burn").each(function(){
var $this = $(this);
var $parent = $this.parent();
$this.animate({height: $parent.outerHeight()-minHeight}, 2000);
});
$(".flamme2").each(function(){
var $this = $(this);
var $parent = $this.parent();
$this.animate({bottom: $parent.outerHeight()-minHeight}, 2000);
});
});
}

Expand All @@ -404,7 +407,6 @@ o.$LAB=J();
$LAB
.script("https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js")
.wait(function(){
$("#huge-bookmarklet-loader").fadeOut(200);
burn();
});
})();
2 changes: 1 addition & 1 deletion build/stylesheets/burn.css
Expand Up @@ -17,6 +17,6 @@

.burn-bookmarklet.huge-bookmarklet-burn {
bottom: 0 !important;
background: url("../images/burned_paper.png") !important;
background: #9d7950 url("../images/burned_paper.png") !important;
opacity: 0.7 !important;
padding: 0 !important; }
27 changes: 16 additions & 11 deletions source/javascripts/burn.js
Expand Up @@ -383,17 +383,23 @@ o.$LAB=J();
}
$(":visible").each(function(){ tryadd(this, true); });
$(":visible").each(function(){ tryadd(this, false); });
console.log($els.length);
var loaded = false;
console.log("burning "+$els.length+" elements on the page");
$els.append(htmlTemplate);
$(".huge-bookmarklet-burn").each(function(){
var $this = $(this);
var $parent = $this.parent();
$this.animate({height: $parent.outerHeight()-minHeight}, 2000);
});
$(".flamme2").each(function(){
var $this = $(this);
var $parent = $this.parent();
$this.animate({bottom: $parent.outerHeight()-minHeight}, 2000);
var $cacheImgs = $("<div style='display:none'><img src='"+serverUrl+"images/flamme2.gif'/><img src='"+serverUrl+"images/burned_paper.png'/></div>");
$cacheImgs.find("img").load(function(){
console.log("images loaded");
$("#huge-bookmarklet-loader").fadeOut(200);
$(".huge-bookmarklet-burn").each(function(){
var $this = $(this);
var $parent = $this.parent();
$this.animate({height: $parent.outerHeight()-minHeight}, 2000);
});
$(".flamme2").each(function(){
var $this = $(this);
var $parent = $this.parent();
$this.animate({bottom: $parent.outerHeight()-minHeight}, 2000);
});
});
}

Expand All @@ -403,7 +409,6 @@ o.$LAB=J();
$LAB
.script("https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js")
.wait(function(){
$("#huge-bookmarklet-loader").fadeOut(200);
burn();
});
})();
2 changes: 1 addition & 1 deletion source/stylesheets/burn.css.scss
Expand Up @@ -17,7 +17,7 @@
}
.burn-bookmarklet.huge-bookmarklet-burn {
bottom: 0 !important;
background: url('../images/burned_paper.png') !important;
background: #9D7950 url('../images/burned_paper.png') !important;
opacity: 0.7 !important;
padding: 0 !important;
}

0 comments on commit 5b0a958

Please sign in to comment.