From 1cee8867d466b7458c57fed55bfb5c41fcf9bb85 Mon Sep 17 00:00:00 2001 From: portshner Date: Fri, 24 May 2013 18:45:26 -0300 Subject: [PATCH] Update mediamessage.js Changed the way we retrieve the video --- client/assets/src/views/mediamessage.js | 26 ++++++------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/client/assets/src/views/mediamessage.js b/client/assets/src/views/mediamessage.js index c8defe8..eb12989 100644 --- a/client/assets/src/views/mediamessage.js +++ b/client/assets/src/views/mediamessage.js @@ -90,25 +90,11 @@ _kiwi.view.MediaMessage = Backbone.View.extend({ return $('
Loading Reddit thread..
'); }, - youtube: function () { + youtube: function () { + var ytid = this.$el.data('ytid'); var that = this; - - $.ajax({ - url: 'http://query.yahooapis.com/v1/public/yql', - data: { - q: "select * from json where url ='http://www.youtube.com/oembed?url="+ this.url + "&format=json'", - format: "json" - }, - dataType: "jsonp", - success: function (data) { - that.$content.find('.content').html(data["query"]["results"]["json"]["html"]); - }, - error: function (result) { - console.log("Sorry no data found."); - } - }); - - return $('
Loading video..
'); + var yt_html = ''; + that.$content.find('.content').html(yt_html); } } @@ -136,9 +122,9 @@ _kiwi.view.MediaMessage = Backbone.View.extend({ } // Is youtube? - matches = (/youtube\.com\/watch\?v\=([a-zA-Z0-9_\-]+)?/gi).exec(url); + matches = (/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/gi).exec(url); if (matches) { - html += ''; + html += ''; } return html; } -- 2.25.1