-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
36 lines (31 loc) · 837 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function getHtml5Video(block) {
var url = block.body;
var width = block.kwargs.width || '100%';
var height = block.kwargs.height || '100%';
var items = [];
items.push("src='" + url + "'");
items.push("width='" + width + "'");
items.push("height='" + height + "'");
if (block.kwargs.poster) {
items.push("poster='" + block.kwargs.poster + "'")
}
if (block.kwargs.autoplay) {
items.push('autoplay')
}
if (block.kwargs.controls) {
items.push('controls')
}
if (block.kwargs.loop) {
items.push('loop')
}
return '<video ' + items.filter(v => !!v).join(' ') + '></video>';
}
module.exports = {
blocks: {
video: {
process: function (block) {
return getHtml5Video(block);
}
}
}
};