added overlayed "play" icon to thumb,
made the "loader" gif background for oembed container make videos autoplay after click
This commit is contained in:
parent
98d1e29055
commit
2976f7d7d1
5 changed files with 47 additions and 22 deletions
BIN
public/images/video-overlay.png
Normal file
BIN
public/images/video-overlay.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
|
|
@ -19,9 +19,13 @@
|
||||||
{{#if o_embed_cache}}
|
{{#if o_embed_cache}}
|
||||||
<div class="oembed">
|
<div class="oembed">
|
||||||
{{#if o_embed_cache.data.thumbnail_url}}
|
{{#if o_embed_cache.data.thumbnail_url}}
|
||||||
<img src="{{o_embed_cache.data.thumbnail_url}}" class="thumb" />
|
<div class="thumb">
|
||||||
{{/if}}
|
<img src="{{o_embed_cache.data.thumbnail_url}}" />
|
||||||
|
<div class="video-overlay"></div>
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
{{{o_embed_html}}}
|
{{{o_embed_html}}}
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,26 @@
|
||||||
app.views.Content = app.views.StreamObject.extend({
|
app.views.Content = app.views.StreamObject.extend({
|
||||||
|
|
||||||
|
events: {
|
||||||
|
"click .oembed .thumb": "showOembedContent"
|
||||||
|
},
|
||||||
|
|
||||||
presenter : function(){
|
presenter : function(){
|
||||||
return _.extend(this.defaultPresenter(), {
|
return _.extend(this.defaultPresenter(), {
|
||||||
text : app.helpers.textFormatter(this.model),
|
text : app.helpers.textFormatter(this.model),
|
||||||
o_embed_html : embedHTML(this.model),
|
o_embed_html : this.embedHTML(),
|
||||||
largePhoto : this.largePhoto(),
|
largePhoto : this.largePhoto(),
|
||||||
smallPhotos : this.smallPhotos()
|
smallPhotos : this.smallPhotos()
|
||||||
})
|
});
|
||||||
|
},
|
||||||
|
|
||||||
function embedHTML(model){
|
embedHTML: function(){
|
||||||
if(!model.get("o_embed_cache")) { return ""; }
|
if(!this.model.get("o_embed_cache")) { return ""; }
|
||||||
var data = model.get("o_embed_cache").data;
|
var data = this.model.get("o_embed_cache").data;
|
||||||
if(data.type == "photo") {
|
if(data.type == "photo") {
|
||||||
return '<img src="'+data.url+'" width="'+data.width+'" height="'+data.height+'" />';
|
return '<img src="'+data.url+'" width="'+data.width+'" height="'+data.height+'" />';
|
||||||
} else {
|
} else {
|
||||||
return data.html || ""
|
return data.html || ""
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
largePhoto : function() {
|
largePhoto : function() {
|
||||||
|
|
@ -28,6 +33,14 @@ app.views.Content = app.views.StreamObject.extend({
|
||||||
var photos = this.model.get("photos")
|
var photos = this.model.get("photos")
|
||||||
if(!photos || photos.length < 2) { return }
|
if(!photos || photos.length < 2) { return }
|
||||||
return photos.slice(1,8)
|
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 );
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,12 +61,8 @@ app.views.Stream = Backbone.View.extend({
|
||||||
oembed = elem.find('.oembed'),
|
oembed = elem.find('.oembed'),
|
||||||
thumb = oembed.find('.thumb');
|
thumb = oembed.find('.thumb');
|
||||||
|
|
||||||
if( thumb.length > 0 && oembed.is(':visible') ) {
|
if( thumb.length > 0 /*&& oembed.is(':visible')*/ ) {
|
||||||
thumb.click(function(){
|
thumb.show();
|
||||||
oembed.find('*').toggle();
|
|
||||||
$(this).hide();
|
|
||||||
});
|
|
||||||
oembed.find('*').toggle();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1828,10 +1828,22 @@ ul#press_logos
|
||||||
:color #777
|
:color #777
|
||||||
|
|
||||||
.collapsible
|
.collapsible
|
||||||
.oembed .thumb
|
.oembed
|
||||||
|
:background url('/images/ajax-loader2.gif') no-repeat center center
|
||||||
|
|
||||||
|
.thumb
|
||||||
|
:position relative
|
||||||
:display none
|
:display none
|
||||||
:cursor pointer
|
: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
|
.conversation_participants
|
||||||
:z-index 3
|
:z-index 3
|
||||||
:background
|
:background
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue