Revert "load small-res images initially in small frames and load full res asynchronously to cut down on inital network time. this should make masonry do its thing faster. [ci skip]"
we don't process images with the same aspect ratio at smaller
resolutions.
This reverts commit 6d038d6225.
This commit is contained in:
parent
6d038d6225
commit
55cfc0a367
2 changed files with 2 additions and 24 deletions
|
|
@ -35,28 +35,6 @@ app.views.Post.SmallFrame = app.views.Post.extend({
|
||||||
|
|
||||||
postRenderTemplate : function() {
|
postRenderTemplate : function() {
|
||||||
this.addStylingClasses()
|
this.addStylingClasses()
|
||||||
this.loadHighResImage()
|
|
||||||
},
|
|
||||||
|
|
||||||
/* preload high-res images; small res are loaded initially in the template
|
|
||||||
* to help with initial load times (see: facebook mobile, soundcloud's new desktop webapp, etc) */
|
|
||||||
loadHighResImage : function() {
|
|
||||||
if(this.model.get("photos").length == 0) { return }
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
_.each(this.$("img[data-preload=true]"), function(element){
|
|
||||||
|
|
||||||
/* compensate for multiple photo postings */
|
|
||||||
_.find(self.model.get("photos"), function(photo){
|
|
||||||
if(photo.guid == $(element).attr("id")){
|
|
||||||
|
|
||||||
/* create a new image tag here and wait for the load() callback to switch */
|
|
||||||
$("<img>").attr({src : photo.sizes.large}).load(function(){
|
|
||||||
$(element).attr("src", photo.sizes.large)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addStylingClasses : function() {
|
addStylingClasses : function() {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
{{#if photos}}
|
{{#if photos}}
|
||||||
<div class="image-container">
|
<div class="image-container">
|
||||||
{{#each photos}}
|
{{#each photos}}
|
||||||
<img src="{{sizes.small}}" {{#if ../../adjustedImageHeight}}style="height:{{../../adjustedImageHeight}}px;"{{/if}} data-preload=true id="{{guid}}" />
|
<img src="{{sizes.large}}" {{#if ../../adjustedImageHeight}}style="height:{{../../adjustedImageHeight}}px;"{{/if}} />
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
{{#if object_url}}
|
{{#if object_url}}
|
||||||
<div class="image-container">
|
<div class="image-container">
|
||||||
<a href="{{object_url}}" class="stream-photo-link">
|
<a href="{{object_url}}" class="stream-photo-link">
|
||||||
<img src="{{image_url}}" class="stream-photo" />
|
<img src="{{image_url}}" data-small-photo="{{image_url}}" data-full-photo="{{image_url}}" class="stream-photo" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue