From: portshner Date: Fri, 24 May 2013 21:45:26 +0000 (-0300) Subject: Update mediamessage.js X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1cee8867d466b7458c57fed55bfb5c41fcf9bb85;p=KiwiIRC.git Update mediamessage.js Changed the way we retrieve the video --- 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; }