Skip to content

Commit 98fd2e7

Browse files
committed
feat(twitter, custom-icons): Added support for custom font icons and triggered a renedered event wit
1 parent c1ca9d3 commit 98fd2e7

21 files changed

Lines changed: 2118 additions & 506 deletions

File tree

dist/embed.min.js

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/embed.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/embed.js

Lines changed: 1987 additions & 397 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/embed.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/js/embed.es6

Lines changed: 52 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121

2222
const utils = require('./modules/utils.es6');
2323

24-
if(build.EMOJI) var Emoji = require('./modules/emoticons/emoji.es6');
25-
if(build.SMILEY) var Smiley = require('./modules/emoticons/smiley.es6');
26-
if(build.LINK) var Url = require('./modules/url.es6');
24+
if (build.EMOJI) var Emoji = require('./modules/emoticons/emoji.es6');
25+
if (build.SMILEY) var Smiley = require('./modules/emoticons/smiley.es6');
26+
if (build.LINK) var Url = require('./modules/url.es6');
2727

28-
if(build.TWITTER) var Twitter = require('./modules/twitter/twitter.es6');
28+
if (build.TWITTER) var Twitter = require('./modules/twitter/twitter.es6');
2929

3030
const Code = require('./modules/code/code.es6');
3131
const Video = require('./modules/video/video.es6');
@@ -40,58 +40,59 @@ const helper = require('./modules/video/helper.es6');
4040
var defaultOptions = {
4141
link: true,
4242
linkOptions: {
43-
target: 'self',
44-
exclude: ['pdf']
43+
target : 'self',
44+
exclude : ['pdf']
4545
},
46-
emoji: true,
47-
customEmoji: [],
48-
fontIcons: true,
49-
highlightCode: true,
50-
videoJS: false,
46+
emoji : true,
47+
customEmoji : [],
48+
fontIcons : true,
49+
customFontIcons : [],
50+
highlightCode : true,
51+
videoJS : false,
5152
videojsOptions: {
52-
fluid: true,
53-
preload: 'metadata'
53+
fluid : true,
54+
preload : 'metadata'
5455
},
5556
tweetsEmbed: true,
5657
tweetOptions: {
57-
maxWidth: 550,
58-
hideMedia: false,
59-
hideThread: false,
60-
align: 'none',
61-
lang: 'en'
58+
maxWidth : 550,
59+
hideMedia : false,
60+
hideThread : false,
61+
align : 'none',
62+
lang : 'en'
6263
},
63-
imageEmbed: true,
64-
videoEmbed: true,
65-
videoHeight: null,
66-
videoWidth: null,
67-
videoDetails: true,
68-
audioEmbed: true,
69-
excludeEmbed: [],
70-
codeEmbedHeight: 500,
64+
imageEmbed : true,
65+
videoEmbed : true,
66+
videoHeight : null,
67+
videoWidth : null,
68+
videoDetails : true,
69+
audioEmbed : true,
70+
excludeEmbed : [],
71+
codeEmbedHeight : 500,
7172
vineOptions: {
72-
maxWidth: null,
73-
type: 'postcard', //'postcard' or 'simple' embedding
74-
responsive: true,
75-
width: 350,
76-
height: 460
73+
maxWidth : null,
74+
type : 'postcard', //'postcard' or 'simple' embedding
75+
responsive : true,
76+
width : 350,
77+
height : 460
7778
},
78-
googleAuthKey: 'AIzaSyCqFouT8h5DKAbxlrTZmjXEmNBjC69f0ts',
79+
googleAuthKey : '',
7980
soundCloudOptions: {
80-
height: 160,
81-
themeColor: 'f50000', //Hex Code of the player theme color
82-
autoPlay: false,
83-
hideRelated: false,
84-
showComments: true,
85-
showUser: true,
86-
showReposts: false,
87-
visual: false, //Show/hide the big preview image
88-
download: false //Show/Hide download buttons
81+
height : 160,
82+
themeColor : 'f50000', //Hex Code of the player theme color
83+
autoPlay : false,
84+
hideRelated : false,
85+
showComments : true,
86+
showUser : true,
87+
showReposts : false,
88+
visual : false, //Show/hide the big preview image
89+
download : false //Show/Hide download buttons
8990
},
90-
beforeEmbedJSApply: function() {},
91-
afterEmbedJSApply: function() {},
92-
onVideoShow: function() {},
93-
onTweetsLoad: function() {},
94-
videojsCallback: function() {}
91+
beforeEmbedJSApply : function() {},
92+
afterEmbedJSApply : function() {},
93+
onVideoShow : function() {},
94+
onTweetsLoad : function() {},
95+
videojsCallback : function() {}
9596
};
9697

9798
class EmbedJS {
@@ -117,9 +118,9 @@ const helper = require('./modules/video/helper.es6');
117118

118119
this.options.beforeEmbedJSApply();
119120

120-
let output = options.link && build.LINK ? (new Url(input, options).process()) : output;
121-
output = options.emoji && build.EMOJI ? (new Emoji(output, options).process()) : output;
122-
output = options.fontIcons && build.SMILEY ? (new Smiley(output, options).process()) : output;
121+
let output = options.link && build.LINK ? (new Url(input, options).process()) : output;
122+
output = options.emoji && build.EMOJI ? (new Emoji(output, options).process()) : output;
123+
output = options.fontIcons && build.SMILEY ? (new Smiley(output, options).process()) : output;
123124
[output, embeds] = (new Code(input, output, options, embeds).process());
124125
[output, embeds] = await (new Video(input, output, options, embeds).process());
125126

@@ -148,15 +149,8 @@ const helper = require('./modules/video/helper.es6');
148149
let result = await this.process();
149150
this.options.element.innerHTML = result;
150151

151-
if (twttr && build.TWITTER) {
152-
//Load twitter data with styling
153-
twttr.widgets.load(this.options.element);
154-
155-
//Execute the function after the widget is loaded
156-
twttr.events.bind('loaded', () => {
157-
this.options.onTweetsLoad();
158-
});
159-
}
152+
let event = new Event('rendered');
153+
this.options.element.dispatchEvent(event);
160154

161155
helper.applyVideoJS(this.options);
162156

src/js/modules/base.es6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import utils from './utils.es6';
1+
const utils = require('./utils.es6');
22

33
class Base{
44
constructor(input,options, embeds){

src/js/modules/code/code.es6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var utils = require('../utils.es6');
1+
const utils = require('../utils.es6');
22

33
if(build.HIGHLIGHTCODE) var Highlight = require('./highlight.es6');
44
if(build.IDEONE) var Ideone = require('./ideone.es6');

src/js/modules/code/codepen.es6

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Base from '../base.es6';
1+
let Base = require('../base.es6');
22

33
class CodePen extends Base{
44
constructor(input,options, embeds){
@@ -9,7 +9,7 @@ class CodePen extends Base{
99
template(id){
1010
let template =
1111
`<div class="ejs-embed ejs-codepen">
12-
<iframe scrolling="no" height="${this.options.codeEmbedHeight}" src="${id.replace(/\/pen\//, '/embed/')}/?height=${this.options.codeEmbedHeight}"></iframe>'
12+
<iframe scrolling="no" height="${this.options.codeEmbedHeight}" src="${id.replace(/\/pen\//, '/embed/')}/?height=${this.options.codeEmbedHeight}"></iframe>'
1313
</div>`;
1414
return template;
1515
}

src/js/modules/code/gist.es6

Whitespace-only changes.

src/js/modules/code/ideone.es6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Base from '../base.es6';
1+
let Base = require('../base.es6');
22

33
class Ideone extends Base{
44
constructor(input,options, embeds){

0 commit comments

Comments
 (0)