forked from a5mith/nodebb-plugin-vine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrary.js
More file actions
20 lines (16 loc) · 749 Bytes
/
library.js
File metadata and controls
20 lines (16 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(function(module) {
"use strict";
var Vine = {},
embed = '<iframe class="vine-embed" src="https://vine.co/v/$1/embed/postcard?related=0" width="480" height="480" frameborder="0"></iframe><script async src="//platform.vine.co/static/scripts/embed.js" charset="utf-8"></script>';
var link = /<a href="(?:https?:\/\/)?(?:vine\.co)\/v\/?(.+)">.+<\/a>/g;
Vine.parse = function(data, callback) {
if (!data || !data.postData || !data.postData.content) {
return callback(null, data);
}
if (data.postData.content.match(link)) {
data.postData.content = data.postData.content.replace(link, embed);
}
callback(null, data);
};
module.exports = Vine;
}(module));