Comparing version 0.0.1 to 0.0.2
@@ -11,2 +11,7 @@ var urlExtractor = require('url-extractor'); | ||
var embeds = []; | ||
if (!options) options = {}; | ||
options.width = options.width || '100%'; | ||
options.height = options.height || '400'; | ||
var urls = this.getUrls(text); | ||
@@ -33,4 +38,5 @@ urls.forEach(function (url) { | ||
'provider_name': 'YouTube', | ||
'thumbnail': 'https://img.youtube.com/vi/' + youtubeId + '/sddefault.jpg', | ||
'id': youtubeId, | ||
'embed': this.youtube(url, youtubeId) | ||
'embed': this.youtube(url, youtubeId, options) | ||
} | ||
@@ -43,3 +49,3 @@ } else if (twitchChannel) { | ||
'id': twitchChannel, | ||
'embed': this.twitch(url, twitchChannel) | ||
'embed': this.twitch(url, twitchChannel, options) | ||
} | ||
@@ -52,3 +58,3 @@ } else if (periscopeId) { | ||
'id': periscopeId, | ||
'embed': this.periscope(url, periscopeId) | ||
'embed': this.periscope(url, periscopeId, options) | ||
} | ||
@@ -61,3 +67,3 @@ } else if (soundcloudId) { | ||
'id': soundcloudId, | ||
'embed': this.soundcloud(url, soundcloudId) | ||
'embed': this.soundcloud(url, soundcloudId, options) | ||
} | ||
@@ -70,3 +76,3 @@ } else if (vimeoId) { | ||
'id': vimeoId, | ||
'embed': this.vimeo(url, vimeoId) | ||
'embed': this.vimeo(url, vimeoId, options) | ||
} | ||
@@ -81,4 +87,4 @@ } | ||
SteemEmbed.youtube = function (url, id) { | ||
return '<iframe width="100%" height="400" src="//www.youtube.com/embed/' + id + '" frameborder="0" scrolling="no" allowfullscreen></iframe>'; | ||
SteemEmbed.youtube = function (url, id, options) { | ||
return '<iframe width="' + options.width + '" height="' + options.height + '" src="//www.youtube.com/embed/' + id + '" frameborder="0" scrolling="no" allowfullscreen></iframe>'; | ||
}; | ||
@@ -91,4 +97,4 @@ | ||
SteemEmbed.twitch = function (url, channel) { | ||
return '<iframe width="100%" height="400" src="//player.twitch.tv/?channel=' + channel + '&autoplay=false" frameborder="0" scrolling="no" allowfullscreen></iframe>'; | ||
SteemEmbed.twitch = function (url, channel, options) { | ||
return '<iframe width="' + options.width + '" height="' + options.height + '" src="//player.twitch.tv/?channel=' + channel + '&autoplay=false" frameborder="0" scrolling="no" allowfullscreen></iframe>'; | ||
}; | ||
@@ -103,4 +109,4 @@ | ||
SteemEmbed.periscope = function (url, id) { | ||
return '<iframe width="100%" height="400" src="//www.periscope.tv/w/' + id + '" frameborder="0" scrolling="no" allowfullscreen></iframe>'; | ||
SteemEmbed.periscope = function (url, id, options) { | ||
return '<iframe width="' + options.width + '" height="' + options.height + '" src="//www.periscope.tv/w/' + id + '" frameborder="0" scrolling="no" allowfullscreen></iframe>'; | ||
}; | ||
@@ -113,4 +119,4 @@ | ||
SteemEmbed.soundcloud = function (url, id) { | ||
return '<iframe width="100%" height="400" src="//w.soundcloud.com/player/?url=' + encodeURIComponent(url + '?visual=true') + '" frameborder="0" scrolling="no" allowfullscreen></iframe>'; | ||
SteemEmbed.soundcloud = function (url, id, options) { | ||
return '<iframe width="' + options.width + '" height="' + options.height + '" src="//w.soundcloud.com/player/?url=' + encodeURIComponent(url + '?visual=true') + '" frameborder="0" scrolling="no" allowfullscreen></iframe>'; | ||
}; | ||
@@ -123,4 +129,4 @@ | ||
SteemEmbed.vimeo = function (url, id) { | ||
return '<iframe src="https://player.vimeo.com/video/' + id + '" width="100%" height="400" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'; | ||
SteemEmbed.vimeo = function (url, id, options) { | ||
return '<iframe width="' + options.width + '" height="' + options.height + '" src="https://player.vimeo.com/video/' + id + '" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'; | ||
} | ||
@@ -127,0 +133,0 @@ |
{ | ||
"name": "embedjs", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
var embedjs = require('./../lib/embedjs'); | ||
var text = 'Lorem ipsum dolor sit amet https://www.twitch.tv/johnnydarko420, consectetur adipiscing elit, https://soundcloud.com/liluzivert/do-what-i-want-produced-by-maaly-raw-don-cannon sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in https://www.youtube.com/watch?v=waiCd_CVxdc reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, https://www.google.fr/?gws_rd=ssl sunt in culpa qui officia deserunt mollit anim id est laborum.'; | ||
var embeds = embedjs.getAll(text); | ||
var embeds = embedjs.getAll(text, { width: '100', height: '120'}); | ||
console.log(embeds); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6461
110
1