Added support for spotify embeds
Closes #734 Thanks to @leolabs for the original PR.
This commit is contained in:
parent
8d5c17be21
commit
a39c14e751
@ -1399,6 +1399,10 @@ div.im_message_video_thumb {
|
|||||||
.im_message_soundcloud_embed {
|
.im_message_soundcloud_embed {
|
||||||
padding-bottom: 56.25%; /* 16/9 ratio */
|
padding-bottom: 56.25%; /* 16/9 ratio */
|
||||||
}
|
}
|
||||||
|
.im_message_spotify_embed {
|
||||||
|
width: 300px;
|
||||||
|
height: 80px;
|
||||||
|
}
|
||||||
.im_message_media_embed iframe,
|
.im_message_media_embed iframe,
|
||||||
.im_message_media_embed webview {
|
.im_message_media_embed webview {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -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"></' + embedTag + '></div>';
|
'&auto_play=false&hide_related=true&show_comments=false&show_user=true&show_reposts=false&visual=true"></' + embedTag + '></div>';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'spotify':
|
||||||
|
var spotifyUrl = embedData[1];
|
||||||
|
html = '<div class="im_message_media_embed im_message_spotify_embed"><' + embedTag + ' type="text/html" frameborder="0" allowtransparency="true" ' +
|
||||||
|
'src="https://embed.spotify.com/?uri=spotify:' + encodeEntities(encodeURIComponent(spotifyUrl)) +
|
||||||
|
'"></' + embedTag + '></div>';
|
||||||
|
break;
|
||||||
|
|
||||||
case 'twitter':
|
case 'twitter':
|
||||||
html = '<div class="im_message_twitter_embed"><blockquote class="twitter-tweet" lang="en"><a href="' + embedData[1] + '"></a></blockquote></div>';
|
html = '<div class="im_message_twitter_embed"><blockquote class="twitter-tweet" lang="en"><a href="' + embedData[1] + '"></a></blockquote></div>';
|
||||||
|
|
||||||
|
@ -3798,6 +3798,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
var facebookRegex = /^https?:\/\/(?:www\.)?facebook\.com\/.+?\/posts\/\d+/i;
|
var facebookRegex = /^https?:\/\/(?:www\.)?facebook\.com\/.+?\/posts\/\d+/i;
|
||||||
var gplusRegex = /^https?:\/\/plus\.google\.com\/\d+\/posts\/[a-zA-Z0-9\-\_]+/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 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 {
|
return {
|
||||||
wrapRichText: wrapRichText,
|
wrapRichText: wrapRichText,
|
||||||
@ -4022,6 +4024,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
return ['soundcloud', embedUrlMatches[0]];
|
return ['soundcloud', embedUrlMatches[0]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (embedUrlMatches = url.match(spotifyRegex)) {
|
||||||
|
return ['spotify', embedUrlMatches[3].replace('/', ':')];
|
||||||
|
}
|
||||||
|
|
||||||
if (!Config.Modes.chrome_packed) { // Need external JS
|
if (!Config.Modes.chrome_packed) { // Need external JS
|
||||||
if (embedUrlMatches = url.match(twitterRegex)) {
|
if (embedUrlMatches = url.match(twitterRegex)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user