plugins: add Vine support
This commit adds support for Vine embeddable content.
This commit is contained in:
parent
e56acbc923
commit
ab260cb5a7
2 changed files with 30 additions and 1 deletions
|
@ -391,8 +391,28 @@ plugins.factory('userPlugins', function() {
|
|||
);
|
||||
tweetPlugin.name = 'Tweet';
|
||||
|
||||
/*
|
||||
* Vine plugin
|
||||
*/
|
||||
var vinePlugin = new Plugin(function(message) {
|
||||
|
||||
var regexp = /https?:\/\/(www\.)?vine.co\/v\/([a-zA-Z0-9]+)(\/.*)?/g;
|
||||
var content = [];
|
||||
var match;
|
||||
|
||||
// Iterate over all matches
|
||||
while ((match = regexp.exec(message)) !== null) {
|
||||
var id = match[2];
|
||||
var embedurl = "https://vine.co/v/" + id + "/embed/simple?audio=1";
|
||||
content.push('<iframe class="vine-embed" src="' + embedurl + '" width="600" height="600" frameborder="0"></iframe><script async src="//platform.vine.co/static/scripts/embed.js" charset="utf-8"></script>');
|
||||
}
|
||||
|
||||
return content;
|
||||
});
|
||||
vinePlugin.name = "Vine";
|
||||
|
||||
return {
|
||||
plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin, gistPlugin, tweetPlugin]
|
||||
plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin, gistPlugin, tweetPlugin, vinePlugin]
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -138,5 +138,14 @@ describe('filter', function() {
|
|||
plugins);
|
||||
}));
|
||||
|
||||
it('should recognize vines', inject(function(plugins) {
|
||||
expectTheseMessagesToContain([
|
||||
'https://vine.co/v/hWh262H9HM5',
|
||||
'https://vine.co/v/hWh262H9HM5/embed',
|
||||
],
|
||||
'Vine',
|
||||
plugins);
|
||||
}));
|
||||
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue