From a58a06a0105351802f078da3fcfac7a510a5367d Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Thu, 21 Jul 2011 15:18:09 -0700 Subject: [PATCH] Fix youtube embedder, scale it down into the stream --- public/javascripts/widgets/embedder.js | 24 +++++++++++------------- public/stylesheets/sass/application.sass | 4 ++-- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/public/javascripts/widgets/embedder.js b/public/javascripts/widgets/embedder.js index c136ef360..994da273f 100644 --- a/public/javascripts/widgets/embedder.js +++ b/public/javascripts/widgets/embedder.js @@ -14,20 +14,20 @@ $.extend(self, { stream: $("#main_stream") }); - + self.ensureDOMStructure(); self.stream.delegate("a.video-link", "click", self.onVideoLinkClicked); self.registerServices(); }); - + this.ensureDOMStructure = function() { var post = self.stream.children(".stream_element:first"), content = post.children(".sm_body").children(".content").children("p"); self.canEmbed = !!content.length; }; - + this.register = function(service, template) { self.services[service] = template; @@ -37,7 +37,7 @@ var template = (typeof self.services[service] === "string") ? self.services[service] : self.services.undefined; - + return $.mustache(template, views); }; @@ -47,10 +47,10 @@ videoContainer = videoLink.closest(".content").children(".video-container"); if (videoContainer.length) { - videoContainer.slideUp("fast", function() { + videoContainer.slideUp("fast", function() { $(this).detach(); }); - + return; } @@ -59,7 +59,7 @@ } container.html( - self.render(service, videoLink.data()) + self.render(videoLink.attr('data-host'), videoLink.data()) ); container.hide() @@ -69,8 +69,8 @@ videoLink.click(function() { videoContainer.slideUp("fast", function() { $(this).detach(); - }); - }); + }); + }); }; this.onVideoLinkClicked = function(evt) { @@ -81,14 +81,12 @@ }; this.registerServices = function() { - var watchVideoOn = Diaspora.widgets.i18n.t("videos.watch"); - self.register("youtube.com", - '' + $.mustache(watchVideoOn, { provider: "YouTube" }) + '
' + + '' + Diaspora.widgets.i18n.t("videos.watch", { provider: "YouTube" }) + '
' + ''); self.register("vimeo.com", - '' + $.mustache(watchVideoOn, { provider: "Vimeo" }) + '
' + + '' + Diaspora.widgets.i18n.t("videos.watch", { provider: "Vimeo" }) + '
' + ''); self.register("undefined", '

' + Diaspora.widgets.i18n.t("videos.unknown") + ' - {{host}}

'); diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 048cfff99..b02d1881e 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -299,8 +299,8 @@ ul.as-selections .youtube-player, .vimeo-player :border none - :height 370px - :width 500px + :height 304px + :width 410px .comment .comment_info