Skip to content

Commit 34082b7

Browse files
committed
chore(core): removed useless files and some minor css changes
1 parent 555ea1b commit 34082b7

8 files changed

Lines changed: 209 additions & 186 deletions

File tree

src/embed.css

Lines changed: 106 additions & 113 deletions
Large diffs are not rendered by default.

src/embed.es6

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ import Emoji from './modules/emoticons/emoji.es6';
2424
import Smiley from './modules/emoticons/smiley.es6';
2525
import Url from './modules/url.es6';
2626
import CodeEmbed from './modules/code/codeEmbed.es6';
27-
import VideoEmbed from './modules/video/videoEmbed.es6';
27+
import Video from './modules/video/video.es6';
2828
import Twitter from './modules/twitter.es6';
29-
import AudioEmbed from './modules/audio/audioEmbed.es6';
29+
import Audio from './modules/audio/audio.es6';
30+
import Image from './modules/image/image.es6';
3031

3132
(function() {
3233

@@ -47,6 +48,7 @@ import AudioEmbed from './modules/audio/audioEmbed.es6';
4748
align : 'none',
4849
lang : 'en'
4950
},
51+
imageEmbed : true,
5052
excludeEmbed : [],
5153
codeEmbedHeight : 500,
5254
videoHeight : null,
@@ -88,8 +90,9 @@ import AudioEmbed from './modules/audio/audioEmbed.es6';
8890
output = options.emoji ? await (new Emoji(output, options).process()) : output;
8991
output = options.fontIcons ? await (new Smiley(output, options).process()) : output;
9092
[output, embeds] = await (new CodeEmbed(input, output, options, embeds).process());
91-
[output, embeds] = await (new VideoEmbed(input, output, options, embeds).process());
92-
[output, embeds] = await (new AudioEmbed(input, output, options, embeds).process());
93+
[output, embeds] = await (new Video(input, output, options, embeds).process());
94+
[output, embeds] = await (new Audio(input, output, options, embeds).process());
95+
[output, embeds] = await (new Image(input, output, options, embeds).process());
9396
if (options.tweetsEmbed) {
9497
let twitter = new Twitter(input, options, embeds);
9598
embeds = options.tweetsEmbed ? await (twitter.process()) : output;

src/modules/audio/audioEmbed.es6

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/modules/image/basic.es6

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Base from '../base.es6';
2+
3+
class Basic extends Base{
4+
constructor(input,options, embeds){
5+
super(input, options, embeds);
6+
this.regex =/((?:https?):\/\/\S*\.(?:gif|jpg|jpeg|tiff|png|svg|webp))/gi;
7+
}
8+
9+
template(match){
10+
let template =
11+
`<div class="ejs-image">
12+
<div class="ne-image-wrapper">
13+
<img src="${match}"/>
14+
</div>
15+
</div>`;
16+
return template;
17+
}
18+
}
19+
20+
module.exports = Basic;

src/modules/image/flickr.es6

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import utils from '../utils.es6';
2+
3+
import Base from '../base.es6';
4+
5+
class Flickr extends Base{
6+
constructor(input,options, embeds){
7+
super(input, options, embeds);
8+
this.regex = /flickr.com\/[a-z]+\/[a-zA-Z@_$!\d]+\/[\d]+/gi;
9+
}
10+
11+
template(match){
12+
let dimensions = this.dimensions();
13+
let template =
14+
`<div class="ejs-embed">
15+
<div class="ne-image-wrapper">',
16+
<iframe src="${utils.toUrl(match)}/player/" width="${dimensions.width}" height="${dimensions.height}"></iframe>
17+
</div>
18+
</div>`;
19+
return template;
20+
}
21+
}
22+
23+
module.exports = Flickr;

src/modules/image/image.es6

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import utils from '../utils.es6';
2+
3+
import Flickr from './flickr.es6';
4+
import Instagram from './instagram.es6';
5+
import Basic from './basic.es6';
6+
7+
class Image{
8+
constructor(input, output, options, embeds){
9+
this.input = input;
10+
this.output = output;
11+
this.options = options;
12+
this.embeds = embeds;
13+
}
14+
15+
async process(){
16+
try{
17+
let input = this.input;
18+
let output = this.output;
19+
let embeds = this.embeds;
20+
embeds = utils.ifEmbed(this.options, 'flickr') ? await (new Flickr(input, this.options, embeds).process()) : output;
21+
embeds = utils.ifEmbed(this.options, 'instagram') ? await (new Instagram(input, this.options, embeds).process()) : output;
22+
embeds = this.options.imageEmbed ? await (new Basic(input, this.options, embeds).process()) : output;
23+
24+
return [output, embeds];
25+
}catch(error){
26+
console.log(error);
27+
}
28+
}
29+
}
30+
31+
module.exports = Image;

src/modules/image/instagram.es6

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

src/modules/video/videoEmbed.es6

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)