Skip to content

Commit ce4c944

Browse files
committed
feat(dailymotion): Support for dailymotion embedding added
1 parent 2b84036 commit ce4c944

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/modules/video/dailymotion.es6

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Video from './video.es6';
2+
3+
class Dailymotion extends Video{
4+
constructor(input,options, embeds){
5+
super(input, options, embeds);
6+
this.regex = /dailymotion.com\/video\/[a-zA-Z0-9-_]+/gi;
7+
}
8+
9+
template(match){
10+
let dimensions = this.dimensions();
11+
let id = match.split('/')[2];
12+
let template =
13+
`<div class="ejs-video">
14+
<iframe src="http://www.dailymotion.com/embed/video/${id}" height="${dimensions.height}" width="${dimensions.width}"></iframe>
15+
</div>`
16+
return template;
17+
}
18+
}
19+
20+
module.exports = Dailymotion;

src/modules/video/videoEmbed.es6

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import utils from '../utils.es6';
22

33
import Ted from './ted.es6';
4+
import Dailymotion from './dailymotion.es6';
45

56
class VideoEmbed {
67
constructor(input, output, options, embeds) {
@@ -16,6 +17,7 @@ class VideoEmbed {
1617
let output = this.output;
1718
let embeds = this.embeds;
1819
embeds = utils.ifEmbed(this.options, 'ted') ? await (new Ted(input, this.options, embeds).process()) : output;
20+
embeds = utils.ifEmbed(this.options, 'dailymotion') ? await (new Dailymotion(input, this.options, embeds).process()) : output;
1921

2022
return [output, embeds];
2123
} catch (error) {

0 commit comments

Comments
 (0)