added overlayed "play" icon to thumb,

made the "loader" gif background for oembed container
make videos autoplay after click
This commit is contained in:
Florian Staudacher 2012-03-07 00:52:26 +01:00
parent 98d1e29055
commit 2976f7d7d1
5 changed files with 47 additions and 22 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -19,9 +19,13 @@
{{#if o_embed_cache}}
<div class="oembed">
{{#if o_embed_cache.data.thumbnail_url}}
<img src="{{o_embed_cache.data.thumbnail_url}}" class="thumb" />
{{/if}}
<div class="thumb">
<img src="{{o_embed_cache.data.thumbnail_url}}" />
<div class="video-overlay"></div>
</div>
{{else}}
{{{o_embed_html}}}
{{/if}}
</div>
{{/if}}
</div>

View file

@ -1,20 +1,25 @@
app.views.Content = app.views.StreamObject.extend({
events: {
"click .oembed .thumb": "showOembedContent"
},
presenter : function(){
return _.extend(this.defaultPresenter(), {
text : app.helpers.textFormatter(this.model),
o_embed_html : embedHTML(this.model),
o_embed_html : this.embedHTML(),
largePhoto : this.largePhoto(),
smallPhotos : this.smallPhotos()
})
});
},
function embedHTML(model){
if(!model.get("o_embed_cache")) { return ""; }
var data = model.get("o_embed_cache").data;
if(data.type == "photo") {
return '<img src="'+data.url+'" width="'+data.width+'" height="'+data.height+'" />';
} else {
return data.html || ""
}
embedHTML: function(){
if(!this.model.get("o_embed_cache")) { return ""; }
var data = this.model.get("o_embed_cache").data;
if(data.type == "photo") {
return '<img src="'+data.url+'" width="'+data.width+'" height="'+data.height+'" />';
} else {
return data.html || ""
}
},
@ -28,6 +33,14 @@ app.views.Content = app.views.StreamObject.extend({
var photos = this.model.get("photos")
if(!photos || photos.length < 2) { return }
return photos.slice(1,8)
},
showOembedContent: function() {
var oembed = $(this.el).find(".oembed");
var embedHTML = $( this.embedHTML() );
var paramSeparator = ( /\\?/.test(embedHTML.attr("href")) ) ? "&" : "?";
embedHTML.attr("src", embedHTML.attr("src") + paramSeparator + "autoplay=1");
oembed.html( embedHTML );
}
})

View file

@ -61,13 +61,9 @@ app.views.Stream = Backbone.View.extend({
oembed = elem.find('.oembed'),
thumb = oembed.find('.thumb');
if( thumb.length > 0 && oembed.is(':visible') ) {
thumb.click(function(){
oembed.find('*').toggle();
$(this).hide();
});
oembed.find('*').toggle();
}
if( thumb.length > 0 /*&& oembed.is(':visible')*/ ) {
thumb.show();
}
});
},

View file

@ -1828,9 +1828,21 @@ ul#press_logos
:color #777
.collapsible
.oembed .thumb
:display none
:cursor pointer
.oembed
:background url('/images/ajax-loader2.gif') no-repeat center center
.thumb
:position relative
:display none
:cursor pointer
.video-overlay
:background url('/images/video-overlay.png') no-repeat center center
:position absolute
:top 0
:left 0
:right 0
:bottom 0
.conversation_participants
:z-index 3