diff --git a/app/css/app.css b/app/css/app.css index 881f7aa3..3a7ed48a 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -1399,6 +1399,10 @@ div.im_message_video_thumb { .im_message_soundcloud_embed { padding-bottom: 56.25%; /* 16/9 ratio */ } +.im_message_spotify_embed { + width: 300px; + height: 80px; +} .im_message_media_embed iframe, .im_message_media_embed webview { position: absolute; diff --git a/app/js/directives.js b/app/js/directives.js index 20cb7b1d..70d1d9c9 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -225,6 +225,13 @@ angular.module('myApp.directives', ['myApp.filters']) '&auto_play=false&hide_related=true&show_comments=false&show_user=true&show_reposts=false&visual=true">'; break; + case 'spotify': + var spotifyUrl = embedData[1]; + html = '
<' + embedTag + ' type="text/html" frameborder="0" allowtransparency="true" ' + + 'src="https://embed.spotify.com/?uri=spotify:' + encodeEntities(encodeURIComponent(spotifyUrl)) + + '">
'; + break; + case 'twitter': html = '
'; diff --git a/app/js/services.js b/app/js/services.js index 8e09910e..70b31445 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -3798,6 +3798,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) var facebookRegex = /^https?:\/\/(?:www\.)?facebook\.com\/.+?\/posts\/\d+/i; var gplusRegex = /^https?:\/\/plus\.google\.com\/\d+\/posts\/[a-zA-Z0-9\-\_]+/i; var soundcloudRegex = /^https?:\/\/(?:soundcloud\.com|snd\.sc)\/([a-zA-Z0-9%\-\_]+)\/([a-zA-Z0-9%\-\_]+)/i; + var spotifyRegex = /(https?:\/\/(open\.spotify\.com|play\.spotify\.com|spoti\.fi)\/(.+)|spotify:(.+))/i; + return { wrapRichText: wrapRichText, @@ -4022,6 +4024,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) return ['soundcloud', embedUrlMatches[0]]; } } + else if (embedUrlMatches = url.match(spotifyRegex)) { + return ['spotify', embedUrlMatches[3].replace('/', ':')]; + } if (!Config.Modes.chrome_packed) { // Need external JS if (embedUrlMatches = url.match(twitterRegex)) {