Rewrite vine plugin with urlPlugin
This commit is contained in:
parent
18c0db6c4f
commit
beaa3426dd
1 changed files with 11 additions and 16 deletions
|
@ -400,22 +400,17 @@ plugins.factory('userPlugins', function() {
|
||||||
/*
|
/*
|
||||||
* Vine plugin
|
* Vine plugin
|
||||||
*/
|
*/
|
||||||
var vinePlugin = new Plugin(function(message) {
|
var vinePlugin = new Plugin(
|
||||||
|
urlPlugin(function (url) {
|
||||||
var regexp = /https?:\/\/(www\.)?vine.co\/v\/([a-zA-Z0-9]+)(\/.*)?/g;
|
var regexp = /^https?:\/\/(www\.)?vine.co\/v\/([a-zA-Z0-9]+)(\/.*)?/i,
|
||||||
var content = [];
|
match = url.match(regexp);
|
||||||
var match;
|
if (match) {
|
||||||
|
var id = match[2], embedurl = "https://vine.co/v/" + id + "/embed/simple?audio=1";
|
||||||
// Iterate over all matches
|
return '<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>';
|
||||||
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';
|
||||||
vinePlugin.name = "Vine";
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin, gistPlugin, tweetPlugin, vinePlugin]
|
plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin, gistPlugin, tweetPlugin, vinePlugin]
|
||||||
|
|
Loading…
Reference in a new issue