videojs-playlist-ui
Advanced tools
Comparing version 3.4.1 to 3.4.2
@@ -0,1 +1,12 @@ | ||
<a name="3.4.2"></a> | ||
## [3.4.2](https://github.com/brightcove/videojs-playlist-ui/compare/v3.4.1...v3.4.2) (2018-08-03) | ||
### Bug Fixes | ||
* babel the es dist, by updating the generator ([#65](https://github.com/brightcove/videojs-playlist-ui/issues/65)) ([f63f77b](https://github.com/brightcove/videojs-playlist-ui/commit/f63f77b)) | ||
### Chores | ||
* **package:** update dependencies, enable greenkeeper ([#62](https://github.com/brightcove/videojs-playlist-ui/issues/62)) ([63a89a7](https://github.com/brightcove/videojs-playlist-ui/commit/63a89a7)) | ||
<a name="3.4.1"></a> | ||
@@ -12,2 +23,10 @@ ## [3.4.1](https://github.com/brightcove/videojs-playlist-ui/compare/v3.0.7...v3.4.1) (2018-07-20) | ||
<a name="3.0.8"></a> | ||
## [3.0.8](https://github.com/brightcove/videojs-playlist-ui/compare/v3.0.6...v3.0.8) (2018-07-20) | ||
### Bug Fixes | ||
* update rollup to fix test build ([d329710](https://github.com/brightcove/videojs-playlist-ui/commit/d329710)) | ||
* revert: generator update from 3.0.7 | ||
<a name="3.0.7"></a> | ||
@@ -14,0 +33,0 @@ ## [3.0.7](https://github.com/brightcove/videojs-playlist-ui/compare/v3.4.0...v3.0.7) (2018-07-05) |
@@ -1,2 +0,2 @@ | ||
/*! @name videojs-playlist-ui @version 3.4.1 @license Apache-2.0 */ | ||
/*! @name videojs-playlist-ui @version 3.4.2 @license Apache-2.0 */ | ||
'use strict'; | ||
@@ -9,3 +9,3 @@ | ||
var version = "3.4.1"; | ||
var version = "3.4.2"; | ||
@@ -12,0 +12,0 @@ var classCallCheck = function (instance, Constructor) { |
@@ -1,13 +0,43 @@ | ||
/*! @name videojs-playlist-ui @version 3.4.1 @license Apache-2.0 */ | ||
/*! @name videojs-playlist-ui @version 3.4.2 @license Apache-2.0 */ | ||
import document from 'global/document'; | ||
import videojs from 'video.js'; | ||
var version = "3.4.1"; | ||
var version = "3.4.2"; | ||
const dom = videojs.dom || videojs; | ||
const registerPlugin = videojs.registerPlugin || videojs.plugin; | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
var inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
var possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
var dom = videojs.dom || videojs; | ||
var registerPlugin = videojs.registerPlugin || videojs.plugin; | ||
// Array#indexOf analog for IE8 | ||
const indexOf = function(array, target) { | ||
for (let i = 0, length = array.length; i < length; i++) { | ||
var indexOf = function indexOf(array, target) { | ||
for (var i = 0, length = array.length; i < length; i++) { | ||
if (array[i] === target) { | ||
@@ -21,13 +51,13 @@ return i; | ||
// see https://github.com/Modernizr/Modernizr/blob/master/feature-detects/css/pointerevents.js | ||
const supportsCssPointerEvents = (() => { | ||
const element = document.createElement('x'); | ||
var supportsCssPointerEvents = function () { | ||
var element = document.createElement('x'); | ||
element.style.cssText = 'pointer-events:auto'; | ||
return element.style.pointerEvents === 'auto'; | ||
})(); | ||
}(); | ||
const defaults = { | ||
var defaults$1 = { | ||
className: 'vjs-playlist', | ||
playOnSelect: false, | ||
supportsCssPointerEvents | ||
supportsCssPointerEvents: supportsCssPointerEvents | ||
}; | ||
@@ -38,6 +68,6 @@ | ||
// since it'll get added when we mouse out | ||
const addSelectedClass = function(el) { | ||
var addSelectedClass = function addSelectedClass(el) { | ||
el.addClass('vjs-selected'); | ||
}; | ||
const removeSelectedClass = function(el) { | ||
var removeSelectedClass = function removeSelectedClass(el) { | ||
el.removeClass('vjs-selected'); | ||
@@ -50,12 +80,12 @@ | ||
const upNext = function(el) { | ||
var upNext = function upNext(el) { | ||
el.addClass('vjs-up-next'); | ||
}; | ||
const notUpNext = function(el) { | ||
var notUpNext = function notUpNext(el) { | ||
el.removeClass('vjs-up-next'); | ||
}; | ||
const createThumbnail = function(thumbnail) { | ||
var createThumbnail = function createThumbnail(thumbnail) { | ||
if (!thumbnail) { | ||
const placeholder = document.createElement('div'); | ||
var placeholder = document.createElement('div'); | ||
@@ -66,3 +96,3 @@ placeholder.className = 'vjs-playlist-thumbnail vjs-playlist-thumbnail-placeholder'; | ||
const picture = document.createElement('picture'); | ||
var picture = document.createElement('picture'); | ||
@@ -73,3 +103,3 @@ picture.className = 'vjs-playlist-thumbnail'; | ||
// simple thumbnails | ||
const img = document.createElement('img'); | ||
var img = document.createElement('img'); | ||
@@ -84,9 +114,9 @@ img.src = thumbnail; | ||
// <source> elements | ||
for (let i = 0; i < thumbnail.length - 1; i++) { | ||
const variant = thumbnail[i]; | ||
const source = document.createElement('source'); | ||
for (var i = 0; i < thumbnail.length - 1; i++) { | ||
var _variant = thumbnail[i]; | ||
var source = document.createElement('source'); | ||
// transfer the properties of each variant onto a <source> | ||
for (const prop in variant) { | ||
source[prop] = variant[prop]; | ||
for (var prop in _variant) { | ||
source[prop] = _variant[prop]; | ||
} | ||
@@ -97,10 +127,10 @@ picture.appendChild(source); | ||
// the default version of a <picture> is specified by an <img> | ||
const variant = thumbnail[thumbnail.length - 1]; | ||
const img = document.createElement('img'); | ||
var variant = thumbnail[thumbnail.length - 1]; | ||
var _img = document.createElement('img'); | ||
img.alt = ''; | ||
for (const prop in variant) { | ||
img[prop] = variant[prop]; | ||
_img.alt = ''; | ||
for (var _prop in variant) { | ||
_img[_prop] = variant[_prop]; | ||
} | ||
picture.appendChild(img); | ||
picture.appendChild(_img); | ||
} | ||
@@ -110,7 +140,10 @@ return picture; | ||
const Component = videojs.getComponent('Component'); | ||
var Component = videojs.getComponent('Component'); | ||
class PlaylistMenuItem extends Component { | ||
var PlaylistMenuItem = function (_Component) { | ||
inherits(PlaylistMenuItem, _Component); | ||
constructor(player, playlistItem, settings) { | ||
function PlaylistMenuItem(player, playlistItem, settings) { | ||
classCallCheck(this, PlaylistMenuItem); | ||
if (!playlistItem.item) { | ||
@@ -120,15 +153,17 @@ throw new Error('Cannot construct a PlaylistMenuItem without an item option'); | ||
super(player, playlistItem); | ||
this.item = playlistItem.item; | ||
var _this = possibleConstructorReturn(this, _Component.call(this, player, playlistItem)); | ||
this.playOnSelect = settings.playOnSelect; | ||
_this.item = playlistItem.item; | ||
this.emitTapEvents(); | ||
_this.playOnSelect = settings.playOnSelect; | ||
this.on(['click', 'tap'], this.switchPlaylistItem_); | ||
this.on('keydown', this.handleKeyDown_); | ||
_this.emitTapEvents(); | ||
_this.on(['click', 'tap'], _this.switchPlaylistItem_); | ||
_this.on('keydown', _this.handleKeyDown_); | ||
return _this; | ||
} | ||
handleKeyDown_(event) { | ||
PlaylistMenuItem.prototype.handleKeyDown_ = function handleKeyDown_(event) { | ||
// keycode 13 is <Enter> | ||
@@ -139,5 +174,5 @@ // keycode 32 is <Space> | ||
} | ||
} | ||
}; | ||
switchPlaylistItem_(event) { | ||
PlaylistMenuItem.prototype.switchPlaylistItem_ = function switchPlaylistItem_(event) { | ||
this.player_.playlist.currentItem(indexOf(this.player_.playlist(), this.item)); | ||
@@ -147,7 +182,7 @@ if (this.playOnSelect) { | ||
} | ||
} | ||
}; | ||
createEl() { | ||
const li = document.createElement('li'); | ||
const item = this.options_.item; | ||
PlaylistMenuItem.prototype.createEl = function createEl() { | ||
var li = document.createElement('li'); | ||
var item = this.options_.item; | ||
@@ -163,4 +198,4 @@ li.className = 'vjs-playlist-item'; | ||
if (item.duration) { | ||
const duration = document.createElement('time'); | ||
const time = videojs.formatTime(item.duration); | ||
var duration = document.createElement('time'); | ||
var time = videojs.formatTime(item.duration); | ||
@@ -174,4 +209,4 @@ duration.className = 'vjs-playlist-duration'; | ||
// Now playing | ||
const nowPlayingEl = document.createElement('span'); | ||
const nowPlayingText = this.localize('Now Playing'); | ||
var nowPlayingEl = document.createElement('span'); | ||
var nowPlayingText = this.localize('Now Playing'); | ||
@@ -184,3 +219,3 @@ nowPlayingEl.className = 'vjs-playlist-now-playing-text'; | ||
// Title container contains title and "up next" | ||
const titleContainerEl = document.createElement('div'); | ||
var titleContainerEl = document.createElement('div'); | ||
@@ -191,4 +226,4 @@ titleContainerEl.className = 'vjs-playlist-title-container'; | ||
// Up next | ||
const upNextEl = document.createElement('span'); | ||
const upNextText = this.localize('Up Next'); | ||
var upNextEl = document.createElement('span'); | ||
var upNextText = this.localize('Up Next'); | ||
@@ -201,4 +236,4 @@ upNextEl.className = 'vjs-up-next-text'; | ||
// Video title | ||
const titleEl = document.createElement('cite'); | ||
const titleText = item.name || this.localize('Untitled Video'); | ||
var titleEl = document.createElement('cite'); | ||
var titleText = item.name || this.localize('Untitled Video'); | ||
@@ -211,8 +246,13 @@ titleEl.className = 'vjs-playlist-name'; | ||
return li; | ||
} | ||
} | ||
}; | ||
class PlaylistMenu extends Component { | ||
return PlaylistMenuItem; | ||
}(Component); | ||
constructor(player, options) { | ||
var PlaylistMenu = function (_Component2) { | ||
inherits(PlaylistMenu, _Component2); | ||
function PlaylistMenu(player, options) { | ||
classCallCheck(this, PlaylistMenu); | ||
if (!player.playlist) { | ||
@@ -222,9 +262,10 @@ throw new Error('videojs-playlist is required for the playlist component'); | ||
super(player, options); | ||
this.items = []; | ||
var _this2 = possibleConstructorReturn(this, _Component2.call(this, player, options)); | ||
_this2.items = []; | ||
if (options.horizontal) { | ||
this.addClass('vjs-playlist-horizontal'); | ||
_this2.addClass('vjs-playlist-horizontal'); | ||
} else { | ||
this.addClass('vjs-playlist-vertical'); | ||
_this2.addClass('vjs-playlist-vertical'); | ||
} | ||
@@ -236,13 +277,13 @@ | ||
if (options.supportsCssPointerEvents) { | ||
this.addClass('vjs-csspointerevents'); | ||
_this2.addClass('vjs-csspointerevents'); | ||
} | ||
this.createPlaylist_(); | ||
_this2.createPlaylist_(); | ||
if (!videojs.browser.TOUCH_ENABLED) { | ||
this.addClass('vjs-mouse'); | ||
_this2.addClass('vjs-mouse'); | ||
} | ||
player.on(['loadstart', 'playlistchange', 'playlistsorted'], (event) => { | ||
this.update(); | ||
player.on(['loadstart', 'playlistchange', 'playlistsorted'], function (event) { | ||
_this2.update(); | ||
}); | ||
@@ -252,19 +293,20 @@ | ||
// appearance can be adapted appropriately | ||
player.on('adstart', () => { | ||
this.addClass('vjs-ad-playing'); | ||
player.on('adstart', function () { | ||
_this2.addClass('vjs-ad-playing'); | ||
}); | ||
player.on('adend', () => { | ||
this.removeClass('vjs-ad-playing'); | ||
player.on('adend', function () { | ||
_this2.removeClass('vjs-ad-playing'); | ||
}); | ||
return _this2; | ||
} | ||
createEl() { | ||
return dom.createEl('div', {className: this.options_.className}); | ||
} | ||
PlaylistMenu.prototype.createEl = function createEl() { | ||
return dom.createEl('div', { className: this.options_.className }); | ||
}; | ||
createPlaylist_() { | ||
const playlist = this.player_.playlist() || []; | ||
let list = this.el_.querySelector('.vjs-playlist-item-list'); | ||
let overlay = this.el_.querySelector('.vjs-playlist-ad-overlay'); | ||
PlaylistMenu.prototype.createPlaylist_ = function createPlaylist_() { | ||
var playlist = this.player_.playlist() || []; | ||
var list = this.el_.querySelector('.vjs-playlist-item-list'); | ||
var overlay = this.el_.querySelector('.vjs-playlist-ad-overlay'); | ||
@@ -278,3 +320,3 @@ if (!list) { | ||
// remove any existing items | ||
for (let i = 0; i < this.items.length; i++) { | ||
for (var i = 0; i < this.items.length; i++) { | ||
list.removeChild(this.items[i].el_); | ||
@@ -285,5 +327,5 @@ } | ||
// create new items | ||
for (let i = 0; i < playlist.length; i++) { | ||
const item = new PlaylistMenuItem(this.player_, { | ||
item: playlist[i] | ||
for (var _i = 0; _i < playlist.length; _i++) { | ||
var item = new PlaylistMenuItem(this.player_, { | ||
item: playlist[_i] | ||
}, this.options_); | ||
@@ -308,3 +350,3 @@ | ||
// select the current playlist item | ||
const selectedIndex = this.player_.playlist.currentItem(); | ||
var selectedIndex = this.player_.playlist.currentItem(); | ||
@@ -314,3 +356,3 @@ if (this.items.length && selectedIndex >= 0) { | ||
const thumbnail = this.items[selectedIndex].$('.vjs-playlist-thumbnail'); | ||
var thumbnail = this.items[selectedIndex].$('.vjs-playlist-thumbnail'); | ||
@@ -321,7 +363,7 @@ if (thumbnail) { | ||
} | ||
} | ||
}; | ||
update() { | ||
PlaylistMenu.prototype.update = function update() { | ||
// replace the playlist items being displayed, if necessary | ||
const playlist = this.player_.playlist(); | ||
var playlist = this.player_.playlist(); | ||
@@ -335,3 +377,3 @@ if (this.items.length !== playlist.length) { | ||
for (let i = 0; i < this.items.length; i++) { | ||
for (var i = 0; i < this.items.length; i++) { | ||
if (this.items[i].item !== playlist[i]) { | ||
@@ -346,8 +388,8 @@ // if any of the playlist items have changed, rebuild the | ||
// the playlist itself is unchanged so just update the selection | ||
const currentItem = this.player_.playlist.currentItem(); | ||
var currentItem = this.player_.playlist.currentItem(); | ||
for (let i = 0; i < this.items.length; i++) { | ||
const item = this.items[i]; | ||
for (var _i2 = 0; _i2 < this.items.length; _i2++) { | ||
var item = this.items[_i2]; | ||
if (i === currentItem) { | ||
if (_i2 === currentItem) { | ||
addSelectedClass(item); | ||
@@ -358,3 +400,3 @@ if (document.activeElement !== item.el()) { | ||
notUpNext(item); | ||
} else if (i === currentItem + 1) { | ||
} else if (_i2 === currentItem + 1) { | ||
removeSelectedClass(item); | ||
@@ -367,5 +409,7 @@ upNext(item); | ||
} | ||
} | ||
} | ||
}; | ||
return PlaylistMenu; | ||
}(Component); | ||
/** | ||
@@ -382,4 +426,6 @@ * Returns a boolean indicating whether an element has child elements. | ||
*/ | ||
const hasChildEls = (el) => { | ||
for (let i = 0; i < el.childNodes.length; i++) { | ||
var hasChildEls = function hasChildEls(el) { | ||
for (var i = 0; i < el.childNodes.length; i++) { | ||
if (dom.isEl(el.childNodes[i])) { | ||
@@ -401,7 +447,7 @@ return true; | ||
*/ | ||
const findRoot = (className) => { | ||
const all = document.querySelectorAll('.' + className); | ||
let el; | ||
var findRoot = function findRoot(className) { | ||
var all = document.querySelectorAll('.' + className); | ||
var el = void 0; | ||
for (let i = 0; i < all.length; i++) { | ||
for (var i = 0; i < all.length; i++) { | ||
if (!hasChildEls(all[i])) { | ||
@@ -432,4 +478,4 @@ el = all[i]; | ||
*/ | ||
const playlistUi = function(options) { | ||
const player = this; | ||
var playlistUi = function playlistUi(options) { | ||
var player = this; | ||
@@ -442,6 +488,6 @@ if (!player.playlist) { | ||
videojs.log.warn('videojs-playlist-ui: Passing an element directly to playlistUi() is deprecated, use the "el" option instead!'); | ||
options = {el: options}; | ||
options = { el: options }; | ||
} | ||
options = videojs.mergeOptions(defaults, options); | ||
options = videojs.mergeOptions(defaults$1, options); | ||
@@ -452,3 +498,3 @@ // If the player is already using this plugin, remove the pre-existing | ||
if (player.playlistMenu) { | ||
const el = player.playlistMenu.el(); | ||
var el = player.playlistMenu.el(); | ||
@@ -458,4 +504,4 @@ // Catch cases where the menu may have been disposed elsewhere or the | ||
if (el) { | ||
const parentNode = el.parentNode; | ||
const nextSibling = el.nextSibling; | ||
var parentNode = el.parentNode; | ||
var nextSibling = el.nextSibling; | ||
@@ -462,0 +508,0 @@ // Disposing the menu will remove `el` from the DOM, but we need to |
@@ -1,2 +0,2 @@ | ||
/*! @name videojs-playlist-ui @version 3.4.1 @license Apache-2.0 */ | ||
/*! @name videojs-playlist-ui @version 3.4.2 @license Apache-2.0 */ | ||
(function (global, factory) { | ||
@@ -11,3 +11,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('global/document'), require('video.js')) : | ||
var version = "3.4.1"; | ||
var version = "3.4.2"; | ||
@@ -14,0 +14,0 @@ var classCallCheck = function (instance, Constructor) { |
@@ -1,2 +0,2 @@ | ||
/*! @name videojs-playlist-ui @version 3.4.1 @license Apache-2.0 */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("global/document"),require("video.js")):"function"==typeof define&&define.amd?define(["global/document","video.js"],t):e.videojsPlaylistUi=t(e.document,e.videojs)}(this,function(e,t){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var i,l=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},s=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},n=(t=t&&t.hasOwnProperty("default")?t.default:t).dom||t,r=t.registerPlugin||t.plugin,o={className:"vjs-playlist",playOnSelect:!1,supportsCssPointerEvents:((i=e.createElement("x")).style.cssText="pointer-events:auto","auto"===i.style.pointerEvents)},p=function(e){e.addClass("vjs-selected")},c=function(e){e.removeClass("vjs-selected"),e.thumbnail&&n.removeClass(e.thumbnail,"vjs-playlist-now-playing")},d=function(e){e.removeClass("vjs-up-next")},h=t.getComponent("Component"),u=function(i){function n(e,t,s){if(l(this,n),!t.item)throw new Error("Cannot construct a PlaylistMenuItem without an item option");var r=a(this,i.call(this,e,t));return r.item=t.item,r.playOnSelect=s.playOnSelect,r.emitTapEvents(),r.on(["click","tap"],r.switchPlaylistItem_),r.on("keydown",r.handleKeyDown_),r}return s(n,i),n.prototype.handleKeyDown_=function(e){13!==e.which&&32!==e.which||this.switchPlaylistItem_()},n.prototype.switchPlaylistItem_=function(e){this.player_.playlist.currentItem(function(e,t){for(var i=0,l=e.length;i<l;i++)if(e[i]===t)return i;return-1}(this.player_.playlist(),this.item)),this.playOnSelect&&this.player_.play()},n.prototype.createEl=function(){var i=e.createElement("li"),l=this.options_.item;if(i.className="vjs-playlist-item",i.setAttribute("tabIndex",0),this.thumbnail=function(t){if(!t){var i=e.createElement("div");return i.className="vjs-playlist-thumbnail vjs-playlist-thumbnail-placeholder",i}var l=e.createElement("picture");if(l.className="vjs-playlist-thumbnail","string"==typeof t){var s=e.createElement("img");s.src=t,s.alt="",l.appendChild(s)}else{for(var a=0;a<t.length-1;a++){var n=t[a],r=e.createElement("source");for(var o in n)r[o]=n[o];l.appendChild(r)}var p=t[t.length-1],c=e.createElement("img");for(var d in c.alt="",p)c[d]=p[d];l.appendChild(c)}return l}(l.thumbnail),i.appendChild(this.thumbnail),l.duration){var s=e.createElement("time"),a=t.formatTime(l.duration);s.className="vjs-playlist-duration",s.setAttribute("datetime","PT0H0M"+l.duration+"S"),s.appendChild(e.createTextNode(a)),i.appendChild(s)}var n=e.createElement("span"),r=this.localize("Now Playing");n.className="vjs-playlist-now-playing-text",n.appendChild(e.createTextNode(r)),n.setAttribute("title",r),this.thumbnail.appendChild(n);var o=e.createElement("div");o.className="vjs-playlist-title-container",this.thumbnail.appendChild(o);var p=e.createElement("span"),c=this.localize("Up Next");p.className="vjs-up-next-text",p.appendChild(e.createTextNode(c)),p.setAttribute("title",c),o.appendChild(p);var d=e.createElement("cite"),h=l.name||this.localize("Untitled Video");return d.className="vjs-playlist-name",d.appendChild(e.createTextNode(h)),d.setAttribute("title",h),o.appendChild(d),i},n}(h),y=function(i){function r(e,s){if(l(this,r),!e.playlist)throw new Error("videojs-playlist is required for the playlist component");var n=a(this,i.call(this,e,s));return n.items=[],s.horizontal?n.addClass("vjs-playlist-horizontal"):n.addClass("vjs-playlist-vertical"),s.supportsCssPointerEvents&&n.addClass("vjs-csspointerevents"),n.createPlaylist_(),t.browser.TOUCH_ENABLED||n.addClass("vjs-mouse"),e.on(["loadstart","playlistchange","playlistsorted"],function(e){n.update()}),e.on("adstart",function(){n.addClass("vjs-ad-playing")}),e.on("adend",function(){n.removeClass("vjs-ad-playing")}),n}return s(r,i),r.prototype.createEl=function(){return n.createEl("div",{className:this.options_.className})},r.prototype.createPlaylist_=function(){var t=this.player_.playlist()||[],i=this.el_.querySelector(".vjs-playlist-item-list"),l=this.el_.querySelector(".vjs-playlist-ad-overlay");i||((i=e.createElement("ol")).className="vjs-playlist-item-list",this.el_.appendChild(i));for(var s=0;s<this.items.length;s++)i.removeChild(this.items[s].el_);this.items.length=0;for(var a=0;a<t.length;a++){var r=new u(this.player_,{item:t[a]},this.options_);this.items.push(r),i.appendChild(r.el_)}l?i.appendChild(l):((l=e.createElement("li")).className="vjs-playlist-ad-overlay",i.appendChild(l));var o=this.player_.playlist.currentItem();if(this.items.length&&o>=0){p(this.items[o]);var c=this.items[o].$(".vjs-playlist-thumbnail");c&&n.addClass(c,"vjs-playlist-now-playing")}},r.prototype.update=function(){var t=this.player_.playlist();if(this.items.length===t.length){for(var i=0;i<this.items.length;i++)if(this.items[i].item!==t[i])return void this.createPlaylist_();for(var l=this.player_.playlist.currentItem(),s=0;s<this.items.length;s++){var a=this.items[s];s===l?(p(a),e.activeElement!==a.el()&&n.addClass(a.thumbnail,"vjs-playlist-now-playing"),d(a)):s===l+1?(c(a),a.addClass("vjs-up-next")):(c(a),d(a))}}else this.createPlaylist_()},r}(h),m=function(e){for(var t=0;t<e.childNodes.length;t++)if(n.isEl(e.childNodes[t]))return!0;return!1},v=function(i){if(!this.playlist)throw new Error("videojs-playlist plugin is required by the videojs-playlist-ui plugin");if(n.isEl(i)&&(t.log.warn('videojs-playlist-ui: Passing an element directly to playlistUi() is deprecated, use the "el" option instead!'),i={el:i}),i=t.mergeOptions(o,i),this.playlistMenu){var l=this.playlistMenu.el();if(l){var s=l.parentNode,a=l.nextSibling;this.playlistMenu.dispose(),n.emptyEl(l),a?s.insertBefore(l,a):s.appendChild(l),i.el=l}}n.isEl(i.el)||(i.el=function(t){for(var i=e.querySelectorAll("."+t),l=void 0,s=0;s<i.length;s++)if(!m(i[s])){l=i[s];break}return l}(i.className)),this.playlistMenu=new y(this,i)};return t.registerComponent("PlaylistMenu",y),t.registerComponent("PlaylistMenuItem",u),r("playlistUi",v),v.VERSION="3.4.1",v}); | ||
/*! @name videojs-playlist-ui @version 3.4.2 @license Apache-2.0 */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("global/document"),require("video.js")):"function"==typeof define&&define.amd?define(["global/document","video.js"],t):e.videojsPlaylistUi=t(e.document,e.videojs)}(this,function(e,t){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var i,l=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},s=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},n=(t=t&&t.hasOwnProperty("default")?t.default:t).dom||t,r=t.registerPlugin||t.plugin,o={className:"vjs-playlist",playOnSelect:!1,supportsCssPointerEvents:((i=e.createElement("x")).style.cssText="pointer-events:auto","auto"===i.style.pointerEvents)},p=function(e){e.addClass("vjs-selected")},c=function(e){e.removeClass("vjs-selected"),e.thumbnail&&n.removeClass(e.thumbnail,"vjs-playlist-now-playing")},d=function(e){e.removeClass("vjs-up-next")},h=t.getComponent("Component"),u=function(i){function n(e,t,s){if(l(this,n),!t.item)throw new Error("Cannot construct a PlaylistMenuItem without an item option");var r=a(this,i.call(this,e,t));return r.item=t.item,r.playOnSelect=s.playOnSelect,r.emitTapEvents(),r.on(["click","tap"],r.switchPlaylistItem_),r.on("keydown",r.handleKeyDown_),r}return s(n,i),n.prototype.handleKeyDown_=function(e){13!==e.which&&32!==e.which||this.switchPlaylistItem_()},n.prototype.switchPlaylistItem_=function(e){this.player_.playlist.currentItem(function(e,t){for(var i=0,l=e.length;i<l;i++)if(e[i]===t)return i;return-1}(this.player_.playlist(),this.item)),this.playOnSelect&&this.player_.play()},n.prototype.createEl=function(){var i=e.createElement("li"),l=this.options_.item;if(i.className="vjs-playlist-item",i.setAttribute("tabIndex",0),this.thumbnail=function(t){if(!t){var i=e.createElement("div");return i.className="vjs-playlist-thumbnail vjs-playlist-thumbnail-placeholder",i}var l=e.createElement("picture");if(l.className="vjs-playlist-thumbnail","string"==typeof t){var s=e.createElement("img");s.src=t,s.alt="",l.appendChild(s)}else{for(var a=0;a<t.length-1;a++){var n=t[a],r=e.createElement("source");for(var o in n)r[o]=n[o];l.appendChild(r)}var p=t[t.length-1],c=e.createElement("img");for(var d in c.alt="",p)c[d]=p[d];l.appendChild(c)}return l}(l.thumbnail),i.appendChild(this.thumbnail),l.duration){var s=e.createElement("time"),a=t.formatTime(l.duration);s.className="vjs-playlist-duration",s.setAttribute("datetime","PT0H0M"+l.duration+"S"),s.appendChild(e.createTextNode(a)),i.appendChild(s)}var n=e.createElement("span"),r=this.localize("Now Playing");n.className="vjs-playlist-now-playing-text",n.appendChild(e.createTextNode(r)),n.setAttribute("title",r),this.thumbnail.appendChild(n);var o=e.createElement("div");o.className="vjs-playlist-title-container",this.thumbnail.appendChild(o);var p=e.createElement("span"),c=this.localize("Up Next");p.className="vjs-up-next-text",p.appendChild(e.createTextNode(c)),p.setAttribute("title",c),o.appendChild(p);var d=e.createElement("cite"),h=l.name||this.localize("Untitled Video");return d.className="vjs-playlist-name",d.appendChild(e.createTextNode(h)),d.setAttribute("title",h),o.appendChild(d),i},n}(h),y=function(i){function r(e,s){if(l(this,r),!e.playlist)throw new Error("videojs-playlist is required for the playlist component");var n=a(this,i.call(this,e,s));return n.items=[],s.horizontal?n.addClass("vjs-playlist-horizontal"):n.addClass("vjs-playlist-vertical"),s.supportsCssPointerEvents&&n.addClass("vjs-csspointerevents"),n.createPlaylist_(),t.browser.TOUCH_ENABLED||n.addClass("vjs-mouse"),e.on(["loadstart","playlistchange","playlistsorted"],function(e){n.update()}),e.on("adstart",function(){n.addClass("vjs-ad-playing")}),e.on("adend",function(){n.removeClass("vjs-ad-playing")}),n}return s(r,i),r.prototype.createEl=function(){return n.createEl("div",{className:this.options_.className})},r.prototype.createPlaylist_=function(){var t=this.player_.playlist()||[],i=this.el_.querySelector(".vjs-playlist-item-list"),l=this.el_.querySelector(".vjs-playlist-ad-overlay");i||((i=e.createElement("ol")).className="vjs-playlist-item-list",this.el_.appendChild(i));for(var s=0;s<this.items.length;s++)i.removeChild(this.items[s].el_);this.items.length=0;for(var a=0;a<t.length;a++){var r=new u(this.player_,{item:t[a]},this.options_);this.items.push(r),i.appendChild(r.el_)}l?i.appendChild(l):((l=e.createElement("li")).className="vjs-playlist-ad-overlay",i.appendChild(l));var o=this.player_.playlist.currentItem();if(this.items.length&&o>=0){p(this.items[o]);var c=this.items[o].$(".vjs-playlist-thumbnail");c&&n.addClass(c,"vjs-playlist-now-playing")}},r.prototype.update=function(){var t=this.player_.playlist();if(this.items.length===t.length){for(var i=0;i<this.items.length;i++)if(this.items[i].item!==t[i])return void this.createPlaylist_();for(var l=this.player_.playlist.currentItem(),s=0;s<this.items.length;s++){var a=this.items[s];s===l?(p(a),e.activeElement!==a.el()&&n.addClass(a.thumbnail,"vjs-playlist-now-playing"),d(a)):s===l+1?(c(a),a.addClass("vjs-up-next")):(c(a),d(a))}}else this.createPlaylist_()},r}(h),m=function(e){for(var t=0;t<e.childNodes.length;t++)if(n.isEl(e.childNodes[t]))return!0;return!1},v=function(i){if(!this.playlist)throw new Error("videojs-playlist plugin is required by the videojs-playlist-ui plugin");if(n.isEl(i)&&(t.log.warn('videojs-playlist-ui: Passing an element directly to playlistUi() is deprecated, use the "el" option instead!'),i={el:i}),i=t.mergeOptions(o,i),this.playlistMenu){var l=this.playlistMenu.el();if(l){var s=l.parentNode,a=l.nextSibling;this.playlistMenu.dispose(),n.emptyEl(l),a?s.insertBefore(l,a):s.appendChild(l),i.el=l}}n.isEl(i.el)||(i.el=function(t){for(var i=e.querySelectorAll("."+t),l=void 0,s=0;s<i.length;s++)if(!m(i[s])){l=i[s];break}return l}(i.className)),this.playlistMenu=new y(this,i)};return t.registerComponent("PlaylistMenu",y),t.registerComponent("PlaylistMenuItem",u),r("playlistUi",v),v.VERSION="3.4.2",v}); |
{ | ||
"name": "videojs-playlist-ui", | ||
"version": "3.4.1", | ||
"version": "3.4.2", | ||
"author": "Brightcove, Inc.", | ||
@@ -48,3 +48,3 @@ "description": "A user interface for the videojs-playlist API", | ||
"devDependencies": { | ||
"autoprefixer": "^8.6.0", | ||
"autoprefixer": "^9.0.0", | ||
"babel-core": "^6.26.3", | ||
@@ -56,3 +56,3 @@ "babel-plugin-external-helpers": "^6.22.0", | ||
"conventional-changelog-videojs": "^3.0.0", | ||
"cssnano": "^3.10.0", | ||
"cssnano": "^4.0.3", | ||
"doctoc": "^1.3.1", | ||
@@ -63,2 +63,3 @@ "husky": "^0.14.3", | ||
"karma": "^2.0.2", | ||
"karma-browserstack-launcher": "^1.3.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
@@ -70,2 +71,3 @@ "karma-detect-browsers": "^2.2.6", | ||
"karma-safari-launcher": "^1.0.0", | ||
"karma-teamcity-reporter": "^1.1.0", | ||
"mkdirp": "^0.5.1", | ||
@@ -75,3 +77,3 @@ "node-sass": "^4.5.3", | ||
"postcss-banner": "^3.0.0", | ||
"postcss-cli": "^5.0.0", | ||
"postcss-cli": "^6.0.0", | ||
"postcss-import": "^11.1.0", | ||
@@ -82,3 +84,3 @@ "postcss-preset-env": "^5.1.0", | ||
"rimraf": "^2.6.1", | ||
"rollup": "^0.60.1", | ||
"rollup": "^0.63.2", | ||
"rollup-plugin-babel": "^3.0.4", | ||
@@ -89,3 +91,2 @@ "rollup-plugin-commonjs": "^9.1.3", | ||
"rollup-plugin-node-resolve": "^3.0.0", | ||
"rollup-plugin-replace": "^1.1.1", | ||
"rollup-plugin-uglify": "^4.0.0", | ||
@@ -96,4 +97,4 @@ "semver": "^5.1.0", | ||
"uglify-es": "^3.3.9", | ||
"videojs-playlist": "^4.0.0", | ||
"videojs-standard": "^6.0.0" | ||
"videojs-playlist": "^4.2.3", | ||
"videojs-standard": "^6.0.3" | ||
}, | ||
@@ -103,3 +104,3 @@ "main": "dist/videojs-playlist-ui.cjs.js", | ||
"generator-videojs-plugin": { | ||
"version": "6.0.9" | ||
"version": "6.1.4" | ||
}, | ||
@@ -106,0 +107,0 @@ "vjsstandard": { |
@@ -1,12 +0,14 @@ | ||
/* eslint-disable no-console */ | ||
/* eslint-disable no-console, camelcase */ | ||
const serveStatic = require('serve-static'); | ||
const path = require('path'); | ||
const serve = serveStatic( | ||
path.join(__dirname, '..'), | ||
{index: ['index.html', 'index.htm']} | ||
); | ||
const pkg = require('../package.json'); | ||
/* allow static files to be served, note karma will takeover the /test directory */ | ||
const StaticMiddlewareFactory = function(config) { | ||
console.log(`**** Dev server started at http://${config.listenAddress}:${config.port}/ *****`); | ||
console.log(`**** static file server started for ${config.basePath} *****`); | ||
const serve = serveStatic( | ||
config.basePath, | ||
{index: ['index.html', 'index.htm']} | ||
); | ||
return function(req, res, next) { | ||
@@ -18,22 +20,89 @@ res.setHeader('Cache-Control', 'no-cache,must-revalidate'); | ||
module.exports = function(config) { | ||
const detectBrowsers = { | ||
enabled: false, | ||
usePhantomJS: false | ||
}; | ||
/* browsers to run on teamcity */ | ||
const teamcityLaunchers = {}; | ||
// On Travis CI, we can only run in Firefox and Chrome; so, enforce that. | ||
if (process.env.TRAVIS) { | ||
config.browsers = ['Firefox', 'travisChrome']; | ||
/* browsers to run on browserstack */ | ||
const browserstackLaunchers = { | ||
bsChrome: { | ||
base: 'BrowserStack', | ||
browser: 'chrome', | ||
os: 'Windows', | ||
os_version: '10' | ||
}, | ||
bsFirefox: { | ||
base: 'BrowserStack', | ||
browser: 'firefox', | ||
os: 'Windows', | ||
os_version: '10' | ||
}, | ||
bsSafariSierra: { | ||
base: 'BrowserStack', | ||
browser: 'safari', | ||
os: 'OS X', | ||
os_version: 'Sierra' | ||
}, | ||
bsEdgeWin10: { | ||
base: 'BrowserStack', | ||
browser: 'edge', | ||
os: 'Windows', | ||
os_version: '10' | ||
}, | ||
bsIE11Win10: { | ||
base: 'BrowserStack', | ||
browser: 'ie', | ||
browser_version: '11', | ||
os: 'Windows', | ||
os_version: '10' | ||
}, | ||
bsIE11Win7: { | ||
base: 'BrowserStack', | ||
browser: 'ie', | ||
browser_version: '11', | ||
os: 'Windows', | ||
os_version: '7' | ||
} | ||
}; | ||
// If no browsers are specified, we enable `karma-detect-browsers` | ||
// this will detect all browsers that are available for testing | ||
if (config.browsers !== false && !config.browsers.length) { | ||
detectBrowsers.enabled = true; | ||
/* browsers to run on travis */ | ||
const travisLaunchers = { | ||
travisFirefox: { | ||
base: 'Firefox' | ||
}, | ||
travisChrome: { | ||
base: 'Chrome', | ||
flags: ['--no-sandbox'] | ||
} | ||
}; | ||
module.exports = function(config) { | ||
/* Default configuration */ | ||
config.set({ | ||
basePath: '..', | ||
frameworks: ['qunit', 'detectBrowsers'], | ||
customLaunchers: Object.assign( | ||
{}, | ||
travisLaunchers, | ||
teamcityLaunchers, | ||
browserstackLaunchers | ||
), | ||
client: {clearContext: false, qunit: {showUI: true, testTimeout: 5000}}, | ||
detectBrowsers: { | ||
enabled: false, | ||
usePhantomJS: false | ||
}, | ||
browserStack: { | ||
project: process.env.TEAMCITY_PROJECT_NAME || pkg.name, | ||
name: '', | ||
build: process.env.TRAVIS_BUILD_NUMBER || process.env.BUILD_NUMBER, | ||
pollingTimeout: 30000, | ||
captureTimeout: 600, | ||
timeout: 600 | ||
}, | ||
reporters: ['dots'], | ||
files: [ | ||
@@ -44,20 +113,4 @@ 'node_modules/video.js/dist/video-js.css', | ||
'node_modules/video.js/dist/video.js', | ||
'node_modules/videojs-playlist/dist/videojs-playlist.js', | ||
'test/dist/bundle.js' | ||
], | ||
customLaunchers: { | ||
travisChrome: { | ||
base: 'Chrome', | ||
flags: ['--no-sandbox'] | ||
} | ||
}, | ||
client: { | ||
clearContext: false, | ||
qunit: { | ||
showUI: true, | ||
testTimeout: 5000 | ||
} | ||
}, | ||
detectBrowsers, | ||
reporters: ['dots'], | ||
port: 9999, | ||
@@ -73,4 +126,44 @@ urlRoot: '/test/', | ||
singleRun: true, | ||
concurrency: Infinity | ||
concurrency: Infinity, | ||
captureTimeout: 30000, | ||
browserNoActivityTimeout: 300000 | ||
}); | ||
/* dynamic configuration, for ci and detectBrowsers */ | ||
// determine what browsers should be run on this environment | ||
if (process.env.BROWSER_STACK_USERNAME) { | ||
config.browsers = Object.keys(browserstackLaunchers); | ||
} else if (process.env.TRAVIS) { | ||
config.browsers = Object.keys(travisLaunchers); | ||
} else if (process.env.TEAMCITY_VERSION) { | ||
config.browsers = Object.keys(teamcityLaunchers); | ||
} | ||
// if running on travis | ||
if (process.env.TRAVIS) { | ||
config.browserStack.name = process.env.TRAVIS_BUILD_NUMBER; | ||
if (process.env.TRAVIS_PULL_REQUEST !== 'false') { | ||
config.browserStack.name += process.env.TRAVIS_PULL_REQUEST; | ||
config.browserStack.name += ' '; | ||
config.browserStack.name += process.env.TRAVIS_PULL_REQUEST_BRANCH; | ||
} | ||
config.browserStack.name += ' ' + process.env.TRAVIS_BRANCH; | ||
// if running on teamcity | ||
} else if (process.env.TEAMCITY_VERSION) { | ||
config.reporters.push('teamcity'); | ||
config.browserStack.name = process.env.TEAMCITY_PROJECT_NAME; | ||
config.browserStack.name += '_'; | ||
config.browserStack.name += process.env.BUILD_NUMBER; | ||
} | ||
// If no browsers are specified, we enable `karma-detect-browsers` | ||
// this will detect all browsers that are available for testing | ||
if (config.browsers !== false && !config.browsers.length) { | ||
config.detectBrowsers.enabled = true; | ||
} | ||
}; |
@@ -6,3 +6,6 @@ /* eslint-disable no-console */ | ||
const banner = `@name ${pkg.name} @version ${pkg.version} @license ${pkg.license}`; | ||
const getNow = () => Date.now(); | ||
let startTime = getNow(); | ||
/** | ||
@@ -19,14 +22,25 @@ * by default there is no way to print that file was written | ||
console.log(`${relativeFrom} -> ${relativeTo}`); | ||
console.log(`${relativeFrom} -> ${relativeTo} in ${getNow() - startTime}ms`); | ||
}; | ||
}); | ||
/** | ||
* A function to set the startTime of postcss so that | ||
* we can print the time taken in the output. | ||
*/ | ||
const setTime = postcss.plugin('postcss-set-time', function(opts) { | ||
return function(root, results) { | ||
startTime = getNow(); | ||
}; | ||
}); | ||
module.exports = function(context) { | ||
return { | ||
plugins: [ | ||
// set the startTime so that we can print the end time | ||
setTime(), | ||
// inlines local file imports | ||
require('postcss-import')(), | ||
require('postcss-simple-vars')(), | ||
// allows you to use newer css features, by converting | ||
@@ -38,5 +52,8 @@ // them into something browsers can support now. | ||
browsers: pkg.browserslist, | ||
stage: 3, | ||
stage: false, | ||
features: { | ||
'custom-environment-variables': true, | ||
// turn `var(xyz)` in the actual value | ||
'custom-properties': {preserve: false, warnings: true}, | ||
// flatten nested rules | ||
'nesting-rules': true | ||
@@ -43,0 +60,0 @@ } |
@@ -12,5 +12,16 @@ /** | ||
const pkg = require('../package.json'); | ||
const banner = `/*! @name ${pkg.name} @version ${pkg.version} @license ${pkg.license} */`; | ||
const plugins = { | ||
/* to prevent going into a screen during rollup */ | ||
process.stderr.isTTY = false; | ||
let isWatch = false; | ||
process.argv.forEach((a) => { | ||
if ((/-w|--watch/).test(a)) { | ||
isWatch = true; | ||
} | ||
}); | ||
/* configuration for plugins */ | ||
const primedPlugins = { | ||
babel: babel({ | ||
@@ -34,80 +45,32 @@ babelrc: false, | ||
// to prevent a screen during rollup watch/build | ||
process.stderr.isTTY = false; | ||
/* General Globals */ | ||
const moduleName = 'videojsPlaylistUi'; | ||
const pluginName = 'videojs-playlist-ui'; | ||
let isWatch = false; | ||
process.argv.forEach((a) => { | ||
if ((/-w|--watch/).test(a)) { | ||
isWatch = true; | ||
// globals, aka replace require calls with this | ||
const globals = { | ||
umd: { | ||
'video.js': 'videojs', | ||
'global': 'window', | ||
'global/window': 'window', | ||
'global/document': 'document' | ||
}, | ||
module: { | ||
'video.js': 'videojs' | ||
}, | ||
test: { | ||
'qunit': 'QUnit', | ||
'qunitjs': 'QUnit', | ||
'sinon': 'sinon', | ||
'video.js': 'videojs' | ||
} | ||
}); | ||
const umdGlobals = { | ||
'video.js': 'videojs', | ||
'global': 'window', | ||
'global/window': 'window', | ||
'global/document': 'document' | ||
}; | ||
const moduleGlobals = { | ||
'video.js': 'videojs' | ||
}; | ||
const testGlobals = { | ||
'qunit': 'QUnit', | ||
'qunitjs': 'QUnit', | ||
'sinon': 'sinon', | ||
'video.js': 'videojs' | ||
}; | ||
// externals, aka don't bundle these and if not | ||
// listed as a global don't require them either | ||
const externals = { | ||
umd: Object.keys(globals.umd).concat([ | ||
const testExternals = Object.keys(testGlobals).concat([ | ||
]); | ||
const builds = [{ | ||
// umd | ||
input: 'src/plugin.js', | ||
output: { | ||
name: 'videojsPlaylistUi', | ||
file: 'dist/videojs-playlist-ui.js', | ||
format: 'umd', | ||
globals: umdGlobals, | ||
banner | ||
}, | ||
external: Object.keys(umdGlobals), | ||
plugins: [ | ||
plugins.resolve, | ||
plugins.json, | ||
plugins.commonjs, | ||
plugins.babel | ||
] | ||
}, { | ||
// cjs | ||
input: 'src/plugin.js', | ||
output: [{ | ||
file: 'dist/videojs-playlist-ui.cjs.js', | ||
format: 'cjs', | ||
globals: moduleGlobals, | ||
banner | ||
}], | ||
external: Object.keys(moduleGlobals).concat([ | ||
'global', | ||
'global/document', | ||
'global/window' | ||
]), | ||
plugins: [ | ||
plugins.resolve, | ||
plugins.json, | ||
plugins.commonjs, | ||
plugins.babel | ||
] | ||
}, { | ||
// es | ||
input: 'src/plugin.js', | ||
output: [{ | ||
file: 'dist/videojs-playlist-ui.es.js', | ||
format: 'es', | ||
globals: moduleGlobals, | ||
banner | ||
}], | ||
external: Object.keys(moduleGlobals).concat([ | ||
module: Object.keys(globals.module).concat([ | ||
'global', | ||
@@ -117,48 +80,107 @@ 'global/document', | ||
]), | ||
plugins: [ | ||
plugins.resolve, | ||
plugins.json, | ||
plugins.commonjs | ||
test: Object.keys(globals.test).concat([ | ||
]) | ||
}; | ||
/* plugins that should be used in each bundle with caveats as comments */ | ||
const plugins = { | ||
// note uglify will be added before babel for minified bundle | ||
umd: [ | ||
primedPlugins.resolve, | ||
primedPlugins.json, | ||
primedPlugins.commonjs, | ||
primedPlugins.babel | ||
], | ||
module: [ | ||
primedPlugins.resolve, | ||
primedPlugins.json, | ||
primedPlugins.commonjs, | ||
primedPlugins.babel | ||
], | ||
test: [ | ||
primedPlugins.multiEntry, | ||
primedPlugins.resolve, | ||
primedPlugins.json, | ||
primedPlugins.commonjs, | ||
primedPlugins.babel | ||
] | ||
}, { | ||
// test bundle | ||
input: 'test/**/*.test.js', | ||
output: { | ||
name: 'videojsPlaylistUiTests', | ||
file: 'test/dist/bundle.js', | ||
format: 'iife', | ||
globals: testGlobals | ||
}, | ||
external: testExternals, | ||
plugins: [ | ||
plugins.multiEntry, | ||
plugins.resolve, | ||
plugins.json, | ||
plugins.commonjs, | ||
plugins.babel | ||
] | ||
}]; | ||
}; | ||
/* make a build with the specifed settings */ | ||
const makeBuild = (name, settings) => { | ||
const b = Object.assign({}, { | ||
plugins: plugins[name], | ||
external: externals[name], | ||
input: 'src/plugin.js' | ||
}, settings); | ||
const fixOutput = (o) => { | ||
if (!o.banner) { | ||
o.banner = `/*! @name ${pkg.name} @version ${pkg.version} @license ${pkg.license} */`; | ||
} | ||
if (!o.globals) { | ||
o.globals = globals[name]; | ||
} | ||
return o; | ||
}; | ||
if (!Array.isArray(b.output)) { | ||
b.output = fixOutput(b.output); | ||
} else { | ||
b.output = b.output.map(fixOutput); | ||
} | ||
return b; | ||
}; | ||
/* all rollup builds by name. note only object values will be used */ | ||
const builds = { | ||
umd: makeBuild('umd', { | ||
output: [{ | ||
name: moduleName, | ||
file: `dist/${pluginName}.js`, | ||
format: 'umd' | ||
}] | ||
}), | ||
cjs: makeBuild('module', { | ||
output: [{ | ||
file: `dist/${pluginName}.cjs.js`, | ||
format: 'cjs' | ||
}] | ||
}), | ||
es: makeBuild('module', { | ||
output: [{ | ||
file: `dist/${pluginName}.es.js`, | ||
format: 'es' | ||
}] | ||
}), | ||
test: makeBuild('test', { | ||
input: 'test/**/*.test.js', | ||
output: [{ | ||
name: `${moduleName}Tests`, | ||
file: 'test/dist/bundle.js', | ||
format: 'iife' | ||
}] | ||
}) | ||
}; | ||
if (!isWatch) { | ||
builds.push({ | ||
// minified umd | ||
input: 'src/plugin.js', | ||
output: { | ||
name: 'videojsPlaylistUi', | ||
file: 'dist/videojs-playlist-ui.min.js', | ||
format: 'umd', | ||
globals: umdGlobals, | ||
banner | ||
}, | ||
external: Object.keys(umdGlobals), | ||
plugins: [ | ||
plugins.resolve, | ||
plugins.json, | ||
plugins.commonjs, | ||
plugins.uglify, | ||
plugins.babel | ||
] | ||
builds.minUmd = makeBuild('umd', { | ||
output: [{ | ||
name: moduleName, | ||
file: `dist/${pluginName}.min.js`, | ||
format: 'umd' | ||
}], | ||
// we need to minify before babel | ||
plugins: plugins.umd | ||
.filter((p) => p !== primedPlugins.babel) | ||
.concat([primedPlugins.uglify, primedPlugins.babel]) | ||
}); | ||
} | ||
export default builds; | ||
export default Object.values(builds); |
@@ -0,1 +1,2 @@ | ||
/*! @name videojs-playlist-ui @version 3.4.2 @license Apache-2.0 */ | ||
(function (videojs,QUnit) { | ||
@@ -49,3 +50,3 @@ 'use strict'; | ||
/*! @name videojs-playlist @version 4.2.2 @license Apache-2.0 */ | ||
/*! @name videojs-playlist @version 4.2.3 @license Apache-2.0 */ | ||
@@ -62,4 +63,5 @@ /** | ||
*/ | ||
const validSeconds = s => | ||
typeof s === 'number' && !isNaN(s) && s >= 0 && s < Infinity; | ||
var validSeconds = function validSeconds(s) { | ||
return typeof s === 'number' && !isNaN(s) && s >= 0 && s < Infinity; | ||
}; | ||
@@ -72,4 +74,4 @@ /** | ||
*/ | ||
let reset = (player) => { | ||
const aa = player.playlist.autoadvance_; | ||
var reset = function reset(player) { | ||
var aa = player.playlist.autoadvance_; | ||
@@ -100,3 +102,3 @@ if (aa.timeout) { | ||
*/ | ||
const setup = (player, delay) => { | ||
var setup = function setup(player, delay) { | ||
reset(player); | ||
@@ -113,7 +115,9 @@ | ||
player.playlist.autoadvance_.trigger = function() { | ||
player.playlist.autoadvance_.trigger = function () { | ||
// This calls setup again, which will reset the existing auto-advance and | ||
// set up another auto-advance for the next "ended" event. | ||
const cancelOnPlay = () => setup(player, delay); | ||
var cancelOnPlay = function cancelOnPlay() { | ||
return setup(player, delay); | ||
}; | ||
@@ -126,3 +130,3 @@ // If there is a "play" event while we're waiting for an auto-advance, | ||
player.playlist.autoadvance_.timeout = player.setTimeout(() => { | ||
player.playlist.autoadvance_.timeout = player.setTimeout(function () { | ||
reset(player); | ||
@@ -143,5 +147,5 @@ player.off('play', cancelOnPlay); | ||
*/ | ||
const clearTracks = (player) => { | ||
const tracks = player.remoteTextTracks(); | ||
let i = tracks && tracks.length || 0; | ||
var clearTracks = function clearTracks(player) { | ||
var tracks = player.remoteTextTracks(); | ||
var i = tracks && tracks.length || 0; | ||
@@ -167,4 +171,4 @@ // This uses a `while` loop rather than `forEach` because the | ||
*/ | ||
const playItem = (player, item) => { | ||
const replay = !player.paused() || player.ended(); | ||
var playItem = function playItem(player, item) { | ||
var replay = !player.paused() || player.ended(); | ||
@@ -176,3 +180,3 @@ player.trigger('beforeplaylistitem', item); | ||
player.ready(() => { | ||
player.ready(function () { | ||
(item.textTracks || []).forEach(player.addRemoteTextTrack.bind(player)); | ||
@@ -182,3 +186,3 @@ player.trigger('playlistitem', item); | ||
if (replay) { | ||
const playPromise = player.play(); | ||
var playPromise = player.play(); | ||
@@ -188,3 +192,3 @@ // silence error when a pause interrupts a play request | ||
if (typeof playPromise !== 'undefined' && typeof playPromise.then === 'function') { | ||
playPromise.then(null, (e) => {}); | ||
playPromise.then(null, function (e) {}); | ||
} | ||
@@ -199,2 +203,8 @@ } | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
/** | ||
@@ -215,10 +225,10 @@ * Given two sources, check to see whether the two sources are equal. | ||
*/ | ||
const sourceEquals = (source1, source2) => { | ||
let src1 = source1; | ||
let src2 = source2; | ||
var sourceEquals = function sourceEquals(source1, source2) { | ||
var src1 = source1; | ||
var src2 = source2; | ||
if (typeof source1 === 'object') { | ||
if ((typeof source1 === 'undefined' ? 'undefined' : _typeof(source1)) === 'object') { | ||
src1 = source1.src; | ||
} | ||
if (typeof source2 === 'object') { | ||
if ((typeof source2 === 'undefined' ? 'undefined' : _typeof(source2)) === 'object') { | ||
src2 = source2.src; | ||
@@ -252,9 +262,9 @@ } | ||
*/ | ||
const indexInSources = (arr, src) => { | ||
for (let i = 0; i < arr.length; i++) { | ||
const sources = arr[i].sources; | ||
var indexInSources = function indexInSources(arr, src) { | ||
for (var i = 0; i < arr.length; i++) { | ||
var sources = arr[i].sources; | ||
if (Array.isArray(sources)) { | ||
for (let j = 0; j < sources.length; j++) { | ||
const source = sources[j]; | ||
for (var j = 0; j < sources.length; j++) { | ||
var source = sources[j]; | ||
@@ -281,9 +291,9 @@ if (source && sourceEquals(source, src)) { | ||
*/ | ||
const randomize = (arr) => { | ||
let index = -1; | ||
const lastIndex = arr.length - 1; | ||
var randomize = function randomize(arr) { | ||
var index = -1; | ||
var lastIndex = arr.length - 1; | ||
while (++index < arr.length) { | ||
const rand = index + Math.floor(Math.random() * (lastIndex - index + 1)); | ||
const value = arr[rand]; | ||
var rand = index + Math.floor(Math.random() * (lastIndex - index + 1)); | ||
var value = arr[rand]; | ||
@@ -328,6 +338,8 @@ arr[rand] = arr[index]; | ||
*/ | ||
function factory(player, initialList, initialIndex = 0) { | ||
let list = null; | ||
let changing = false; | ||
function factory(player, initialList) { | ||
var initialIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; | ||
var list = null; | ||
var changing = false; | ||
/** | ||
@@ -351,3 +363,5 @@ * Get/set the playlist for a player. | ||
*/ | ||
const playlist = player.playlist = (newList, newIndex = 0) => { | ||
var playlist = player.playlist = function (newList) { | ||
var newIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | ||
if (changing) { | ||
@@ -360,3 +374,3 @@ throw new Error('do not call playlist() during a playlist change'); | ||
// @todo - Simplify this to `list.slice()` for v5. | ||
const previousPlaylist = Array.isArray(list) ? list.slice() : null; | ||
var previousPlaylist = Array.isArray(list) ? list.slice() : null; | ||
@@ -392,3 +406,3 @@ list = newList.slice(); | ||
if (previousPlaylist) { | ||
player.setTimeout(() => { | ||
player.setTimeout(function () { | ||
player.trigger('playlistchange'); | ||
@@ -404,3 +418,3 @@ }, 0); | ||
// On a new source, if there is no current item, disable auto-advance. | ||
player.on('loadstart', () => { | ||
player.on('loadstart', function () { | ||
if (playlist.currentItem() === -1) { | ||
@@ -427,3 +441,3 @@ reset(player); | ||
*/ | ||
playlist.currentItem = (index) => { | ||
playlist.currentItem = function (index) { | ||
@@ -435,13 +449,5 @@ // If the playlist is changing, only act as a getter. | ||
if ( | ||
typeof index === 'number' && | ||
playlist.currentIndex_ !== index && | ||
index >= 0 && | ||
index < list.length | ||
) { | ||
if (typeof index === 'number' && playlist.currentIndex_ !== index && index >= 0 && index < list.length) { | ||
playlist.currentIndex_ = index; | ||
playItem( | ||
playlist.player_, | ||
list[playlist.currentIndex_] | ||
); | ||
playItem(playlist.player_, list[playlist.currentIndex_]); | ||
} else { | ||
@@ -463,3 +469,3 @@ playlist.currentIndex_ = playlist.indexOf(playlist.player_.currentSrc() || ''); | ||
*/ | ||
playlist.contains = (value) => { | ||
playlist.contains = function (value) { | ||
return playlist.indexOf(value) !== -1; | ||
@@ -477,3 +483,3 @@ }; | ||
*/ | ||
playlist.indexOf = (value) => { | ||
playlist.indexOf = function (value) { | ||
if (typeof value === 'string') { | ||
@@ -483,6 +489,6 @@ return indexInSources(list, value); | ||
const sources = Array.isArray(value) ? value : value.sources; | ||
var sources = Array.isArray(value) ? value : value.sources; | ||
for (let i = 0; i < sources.length; i++) { | ||
const source = sources[i]; | ||
for (var i = 0; i < sources.length; i++) { | ||
var source = sources[i]; | ||
@@ -506,3 +512,5 @@ if (typeof source === 'string') { | ||
*/ | ||
playlist.currentIndex = () => playlist.currentItem(); | ||
playlist.currentIndex = function () { | ||
return playlist.currentItem(); | ||
}; | ||
@@ -516,3 +524,5 @@ /** | ||
*/ | ||
playlist.lastIndex = () => list.length - 1; | ||
playlist.lastIndex = function () { | ||
return list.length - 1; | ||
}; | ||
@@ -526,4 +536,4 @@ /** | ||
*/ | ||
playlist.nextIndex = () => { | ||
const current = playlist.currentItem(); | ||
playlist.nextIndex = function () { | ||
var current = playlist.currentItem(); | ||
@@ -534,3 +544,3 @@ if (current === -1) { | ||
const lastIndex = playlist.lastIndex(); | ||
var lastIndex = playlist.lastIndex(); | ||
@@ -553,4 +563,4 @@ // When repeating, loop back to the beginning on the last item. | ||
*/ | ||
playlist.previousIndex = () => { | ||
const current = playlist.currentItem(); | ||
playlist.previousIndex = function () { | ||
var current = playlist.currentItem(); | ||
@@ -576,3 +586,3 @@ if (current === -1) { | ||
*/ | ||
playlist.first = () => { | ||
playlist.first = function () { | ||
if (changing) { | ||
@@ -595,3 +605,3 @@ return; | ||
*/ | ||
playlist.last = () => { | ||
playlist.last = function () { | ||
if (changing) { | ||
@@ -614,3 +624,3 @@ return; | ||
*/ | ||
playlist.next = () => { | ||
playlist.next = function () { | ||
if (changing) { | ||
@@ -620,3 +630,3 @@ return; | ||
const index = playlist.nextIndex(); | ||
var index = playlist.nextIndex(); | ||
@@ -634,3 +644,3 @@ if (index !== playlist.currentIndex_) { | ||
*/ | ||
playlist.previous = () => { | ||
playlist.previous = function () { | ||
if (changing) { | ||
@@ -640,3 +650,3 @@ return; | ||
const index = playlist.previousIndex(); | ||
var index = playlist.previousIndex(); | ||
@@ -654,3 +664,3 @@ if (index !== playlist.currentIndex_) { | ||
*/ | ||
playlist.autoadvance = (delay) => { | ||
playlist.autoadvance = function (delay) { | ||
setup(playlist.player_, delay); | ||
@@ -669,3 +679,3 @@ }; | ||
*/ | ||
playlist.repeat = (val) => { | ||
playlist.repeat = function (val) { | ||
if (val === undefined) { | ||
@@ -693,3 +703,3 @@ return playlist.repeat_; | ||
*/ | ||
playlist.sort = (compare) => { | ||
playlist.sort = function (compare) { | ||
@@ -723,3 +733,3 @@ // Bail if the array is empty. | ||
*/ | ||
playlist.reverse = () => { | ||
playlist.reverse = function () { | ||
@@ -765,6 +775,9 @@ // Bail if the array is empty. | ||
*/ | ||
playlist.shuffle = ({rest} = {}) => { | ||
let index = 0; | ||
let arr = list; | ||
playlist.shuffle = function () { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
rest = _ref.rest; | ||
var index = 0; | ||
var arr = list; | ||
// When options.rest is true, start randomization at the item after the | ||
@@ -787,3 +800,5 @@ // current item. | ||
if (rest) { | ||
list.splice(...[index, arr.length].concat(arr)); | ||
var _list; | ||
(_list = list).splice.apply(_list, [index, arr.length].concat(arr)); | ||
} | ||
@@ -809,3 +824,3 @@ | ||
// If there is no initial list given, silently set an empty array. | ||
// If there is no initial list given, silently set an empty array. | ||
} else { | ||
@@ -818,6 +833,6 @@ list = []; | ||
var version = "4.2.2"; | ||
var version = "4.2.3"; | ||
// Video.js 5/6 cross-compatible. | ||
const registerPlugin = videojs.registerPlugin || videojs.plugin; | ||
var registerPlugin = videojs.registerPlugin || videojs.plugin; | ||
@@ -834,3 +849,3 @@ /** | ||
*/ | ||
const plugin = function(list, item) { | ||
var plugin = function plugin(list, item) { | ||
factory(this, list, item); | ||
@@ -843,3 +858,3 @@ }; | ||
var version$1 = "3.4.1"; | ||
var version$1 = "3.4.2"; | ||
@@ -846,0 +861,0 @@ var classCallCheck = function (instance, Constructor) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 8 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
299715
3949
44
15