Oembed Update - Added instagram, better display for rich/photo

This commit is contained in:
Ruxton 2013-01-22 22:33:14 +08:00
parent 31849e1442
commit 89042078ca
3 changed files with 14 additions and 4 deletions

View file

@ -82,8 +82,14 @@ app.views.OEmbed = app.views.Base.extend({
}, },
presenter:function () { presenter:function () {
o_embed_cache = this.model.get("o_embed_cache")
if(o_embed_cache) {
typemodel = { rich: false, photo: false, video: false, link: false }
typemodel[o_embed_cache.data.type] = true
o_embed_cache.data.types = typemodel
}
return _.extend(this.defaultPresenter(), { return _.extend(this.defaultPresenter(), {
o_embed_html : app.helpers.oEmbed.html(this.model.get("o_embed_cache")) o_embed_html : app.helpers.oEmbed.html(o_embed_cache)
}) })
}, },

View file

@ -1,5 +1,5 @@
{{#if o_embed_cache}} {{#if o_embed_cache}}
{{#if o_embed_cache.data.thumbnail_url}} {{#if o_embed_cache.data.types.video }}
<div class="thumb"> <div class="thumb">
<img src="{{o_embed_cache.data.thumbnail_url}}" /> <img src="{{o_embed_cache.data.thumbnail_url}}" />
<div class="video-overlay"> <div class="video-overlay">
@ -17,6 +17,6 @@
</div> </div>
</div> </div>
{{else}} {{else}}
{{{o_embed_html}}} {{{o_embed_html}}}
{{/if}} {{/if}}
{{/if}} {{/if}}

View file

@ -9,11 +9,15 @@ require 'uri'
OEmbedCubbies = OEmbed::Provider.new("http://cubbi.es/oembed") OEmbedCubbies = OEmbed::Provider.new("http://cubbi.es/oembed")
# patch in support for new https soundcloud
OEmbed::Providers::SoundCloud << "https://*.soundcloud.com/*"
oembed_provider_list = [ oembed_provider_list = [
OEmbed::Providers::Youtube, OEmbed::Providers::Youtube,
OEmbed::Providers::Vimeo, OEmbed::Providers::Vimeo,
OEmbed::Providers::Flickr,
OEmbed::Providers::SoundCloud, OEmbed::Providers::SoundCloud,
OEmbed::Providers::Instagram,
OEmbed::Providers::Flickr,
OEmbedCubbies OEmbedCubbies
] ]