Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

videojs-playlist-ui

Package Overview
Dependencies
Maintainers
41
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

videojs-playlist-ui - npm Package Compare versions

Comparing version 3.0.4 to 3.0.5

CONTRIBUTING.md

7

CHANGELOG.md

@@ -0,1 +1,8 @@

<a name="3.0.5"></a>
## [3.0.5](https://github.com/brightcove/videojs-playlist-ui/compare/v3.0.3...v3.0.5) (2017-05-19)
### Chores
* Update tooling using generator v5 prerelease. ([#42](https://github.com/brightcove/videojs-playlist-ui/issues/42)) ([6153b64](https://github.com/brightcove/videojs-playlist-ui/commit/6153b64))
# CHANGELOG

@@ -2,0 +9,0 @@

584

dist/videojs-playlist-ui.js

@@ -1,24 +0,108 @@

/*! videojs-playlist-ui - v3.0.4 - 2017-04-26
* Copyright (c) 2017 Brightcove; Licensed Apache-2.0 */
/**
* videojs-playlist-ui
* @version 3.0.5
* @copyright 2017 Brightcove, Inc.
* @license Apache-2.0
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('video.js')) :
typeof define === 'function' && define.amd ? define(['video.js'], factory) :
(factory(global.videojs));
}(this, (function (videojs) { 'use strict';
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){
"use strict";
videojs = 'default' in videojs ? videojs['default'] : videojs;
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var empty = {};
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
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) subClass.__proto__ = superClass; };
var empty$1 = (Object.freeze || Object)({
'default': empty
});
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var minDoc = ( empty$1 && empty ) || empty$1;
/*! videojs-playlist-ui - v0.0.0 - 2015-3-12
* Copyright (c) 2015 Brightcove
* Licensed under the Apache-2.0 license. */
var topLevel = typeof commonjsGlobal !== 'undefined' ? commonjsGlobal :
typeof window !== 'undefined' ? window : {};
var videojs = _interopRequire((typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null));
var doccy;
if (typeof document !== 'undefined') {
doccy = document;
} else {
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];
if (!doccy) {
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;
}
}
var document_1 = doccy;
var win;
if (typeof window !== "undefined") {
win = window;
} else if (typeof commonjsGlobal !== "undefined") {
win = commonjsGlobal;
} else if (typeof self !== "undefined"){
win = self;
} else {
win = {};
}
var window_1 = win;
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;
};
// support VJS5 & VJS6 at the same time

@@ -30,3 +114,3 @@ var dom = videojs.dom || videojs;

var indexOf = function indexOf(array, target) {
for (var i = 0, _length = array.length; i < _length; i++) {
for (var i = 0, length = array.length; i < length; i++) {
if (array[i] === target) {

@@ -40,10 +124,11 @@ return i;

// see https://github.com/Modernizr/Modernizr/blob/master/feature-detects/css/pointerevents.js
var supportsCssPointerEvents = (function () {
var element = document.createElement("x");
element.style.cssText = "pointer-events:auto";
return element.style.pointerEvents === "auto";
})();
var supportsCssPointerEvents = function () {
var element = document_1.createElement('x');
var defaults = {
className: "vjs-playlist",
element.style.cssText = 'pointer-events:auto';
return element.style.pointerEvents === 'auto';
}();
var defaults$$1 = {
className: 'vjs-playlist',
playOnSelect: false,

@@ -57,9 +142,9 @@ supportsCssPointerEvents: supportsCssPointerEvents

var addSelectedClass = function addSelectedClass(el) {
el.addClass("vjs-selected");
el.addClass('vjs-selected');
};
var removeSelectedClass = function removeSelectedClass(el) {
el.removeClass("vjs-selected");
el.removeClass('vjs-selected');
if (el.thumbnail) {
dom.removeClass(el.thumbnail, "vjs-playlist-now-playing");
dom.removeClass(el.thumbnail, 'vjs-playlist-now-playing');
}

@@ -69,6 +154,6 @@ };

var upNext = function upNext(el) {
el.addClass("vjs-up-next");
el.addClass('vjs-up-next');
};
var notUpNext = function notUpNext(el) {
el.removeClass("vjs-up-next");
el.removeClass('vjs-up-next');
};

@@ -78,15 +163,18 @@

if (!thumbnail) {
var placeholder = document.createElement("div");
placeholder.className = "vjs-playlist-thumbnail vjs-playlist-thumbnail-placeholder";
var placeholder = document_1.createElement('div');
placeholder.className = 'vjs-playlist-thumbnail vjs-playlist-thumbnail-placeholder';
return placeholder;
}
var picture = document.createElement("picture");
picture.className = "vjs-playlist-thumbnail";
var picture = document_1.createElement('picture');
if (typeof thumbnail === "string") {
picture.className = 'vjs-playlist-thumbnail';
if (typeof thumbnail === 'string') {
// simple thumbnails
var img = document.createElement("img");
var img = document_1.createElement('img');
img.src = thumbnail;
img.alt = "";
img.alt = '';
picture.appendChild(img);

@@ -100,3 +188,4 @@ } else {

var _variant = thumbnail[i];
var source = document.createElement("source");
var source = document_1.createElement('source');
// transfer the properties of each variant onto a <source>

@@ -111,8 +200,9 @@ for (var prop in _variant) {

var variant = thumbnail[thumbnail.length - 1];
var img = document.createElement("img");
img.alt = "";
for (var prop in variant) {
img[prop] = variant[prop];
var _img = document_1.createElement('img');
_img.alt = '';
for (var _prop in variant) {
_img[_prop] = variant[_prop];
}
picture.appendChild(img);
picture.appendChild(_img);
}

@@ -122,115 +212,118 @@ return picture;

var Component = videojs.getComponent("Component");
var Component = videojs.getComponent('Component');
var PlaylistMenuItem = (function (_Component) {
var PlaylistMenuItem = function (_Component) {
inherits(PlaylistMenuItem, _Component);
function PlaylistMenuItem(player, playlistItem, settings) {
_classCallCheck(this, PlaylistMenuItem);
classCallCheck(this, PlaylistMenuItem);
if (!playlistItem.item) {
throw new Error("Cannot construct a PlaylistMenuItem without an item option");
throw new Error('Cannot construct a PlaylistMenuItem without an item option');
}
_get(Object.getPrototypeOf(PlaylistMenuItem.prototype), "constructor", this).call(this, 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;
}
_inherits(PlaylistMenuItem, _Component);
PlaylistMenuItem.prototype.handleKeyDown_ = function handleKeyDown_(event) {
// keycode 13 is <Enter>
// keycode 32 is <Space>
if (event.which === 13 || event.which === 32) {
this.switchPlaylistItem_();
}
};
_createClass(PlaylistMenuItem, {
handleKeyDown_: {
value: function handleKeyDown_(event) {
// keycode 13 is <Enter>
// keycode 32 is <Space>
if (event.which === 13 || event.which === 32) {
this.switchPlaylistItem_();
}
}
},
switchPlaylistItem_: {
value: function switchPlaylistItem_(event) {
this.player_.playlist.currentItem(indexOf(this.player_.playlist(), this.item));
if (this.playOnSelect) {
this.player_.play();
}
}
},
createEl: {
value: function createEl() {
var li = document.createElement("li");
var item = this.options_.item;
PlaylistMenuItem.prototype.switchPlaylistItem_ = function switchPlaylistItem_(event) {
this.player_.playlist.currentItem(indexOf(this.player_.playlist(), this.item));
if (this.playOnSelect) {
this.player_.play();
}
};
li.className = "vjs-playlist-item";
li.setAttribute("tabIndex", 0);
PlaylistMenuItem.prototype.createEl = function createEl() {
var li = document_1.createElement('li');
var item = this.options_.item;
// Thumbnail image
this.thumbnail = createThumbnail(item.thumbnail);
li.appendChild(this.thumbnail);
li.className = 'vjs-playlist-item';
li.setAttribute('tabIndex', 0);
// Duration
if (item.duration) {
var duration = document.createElement("time");
var time = videojs.formatTime(item.duration);
duration.className = "vjs-playlist-duration";
duration.setAttribute("datetime", "PT0H0M" + item.duration + "S");
duration.appendChild(document.createTextNode(time));
li.appendChild(duration);
}
// Thumbnail image
this.thumbnail = createThumbnail(item.thumbnail);
li.appendChild(this.thumbnail);
// Now playing
var nowPlayingEl = document.createElement("span");
var nowPlayingText = this.localize("Now Playing");
nowPlayingEl.className = "vjs-playlist-now-playing-text";
nowPlayingEl.appendChild(document.createTextNode(nowPlayingText));
nowPlayingEl.setAttribute("title", nowPlayingText);
this.thumbnail.appendChild(nowPlayingEl);
// Duration
if (item.duration) {
var duration = document_1.createElement('time');
var time = videojs.formatTime(item.duration);
// Title container contains title and "up next"
var titleContainerEl = document.createElement("div");
titleContainerEl.className = "vjs-playlist-title-container";
this.thumbnail.appendChild(titleContainerEl);
duration.className = 'vjs-playlist-duration';
duration.setAttribute('datetime', 'PT0H0M' + item.duration + 'S');
duration.appendChild(document_1.createTextNode(time));
li.appendChild(duration);
}
// Up next
var upNextEl = document.createElement("span");
var upNextText = this.localize("Up Next");
upNextEl.className = "vjs-up-next-text";
upNextEl.appendChild(document.createTextNode(upNextText));
upNextEl.setAttribute("title", upNextText);
titleContainerEl.appendChild(upNextEl);
// Now playing
var nowPlayingEl = document_1.createElement('span');
var nowPlayingText = this.localize('Now Playing');
// Video title
var titleEl = document.createElement("cite");
var titleText = item.name || this.localize("Untitled Video");
titleEl.className = "vjs-playlist-name";
titleEl.appendChild(document.createTextNode(titleText));
titleEl.setAttribute("title", titleText);
titleContainerEl.appendChild(titleEl);
nowPlayingEl.className = 'vjs-playlist-now-playing-text';
nowPlayingEl.appendChild(document_1.createTextNode(nowPlayingText));
nowPlayingEl.setAttribute('title', nowPlayingText);
this.thumbnail.appendChild(nowPlayingEl);
return li;
}
}
});
// Title container contains title and "up next"
var titleContainerEl = document_1.createElement('div');
titleContainerEl.className = 'vjs-playlist-title-container';
this.thumbnail.appendChild(titleContainerEl);
// Up next
var upNextEl = document_1.createElement('span');
var upNextText = this.localize('Up Next');
upNextEl.className = 'vjs-up-next-text';
upNextEl.appendChild(document_1.createTextNode(upNextText));
upNextEl.setAttribute('title', upNextText);
titleContainerEl.appendChild(upNextEl);
// Video title
var titleEl = document_1.createElement('cite');
var titleText = item.name || this.localize('Untitled Video');
titleEl.className = 'vjs-playlist-name';
titleEl.appendChild(document_1.createTextNode(titleText));
titleEl.setAttribute('title', titleText);
titleContainerEl.appendChild(titleEl);
return li;
};
return PlaylistMenuItem;
})(Component);
}(Component);
var PlaylistMenu = (function (_Component2) {
var PlaylistMenu = function (_Component2) {
inherits(PlaylistMenu, _Component2);
function PlaylistMenu(player, settings) {
var _this = this;
classCallCheck(this, PlaylistMenu);
_classCallCheck(this, PlaylistMenu);
if (!player.playlist) {
throw new Error("videojs-playlist is required for the playlist component");
throw new Error('videojs-playlist is required for the playlist component');
}
_get(Object.getPrototypeOf(PlaylistMenu.prototype), "constructor", this).call(this, player, settings);
this.items = [];
var _this2 = possibleConstructorReturn(this, _Component2.call(this, player, settings));
_this2.items = [];
// If CSS pointer events aren't supported, we have to prevent

@@ -240,13 +333,13 @@ // clicking on playlist items during ads with slightly more

if (settings.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"], function (event) {
_this.update();
player.on(['loadstart', 'playlistchange'], function (event) {
_this2.update();
});

@@ -256,6 +349,6 @@

// appearance can be adapted appropriately
player.on("adstart", function () {
_this.addClass("vjs-ad-playing");
player.on('adstart', function () {
_this2.addClass('vjs-ad-playing');
});
player.on("adend", function () {
player.on('adend', function () {
if (player.ended()) {

@@ -265,121 +358,123 @@ // player.ended() is true because the content is done, but the ended event doesn't

// its cycle. We don't consider a postroll ad ended until the "ended" event.
player.one("ended", function () {
_this.removeClass("vjs-ad-playing");
player.one('ended', function () {
_this2.removeClass('vjs-ad-playing');
});
} else {
_this.removeClass("vjs-ad-playing");
_this2.removeClass('vjs-ad-playing');
}
});
return _this2;
}
_inherits(PlaylistMenu, _Component2);
PlaylistMenu.prototype.createEl = function createEl() {
var settings = this.options_;
_createClass(PlaylistMenu, {
createEl: {
value: function createEl() {
var settings = this.options_;
if (settings.el) {
return settings.el;
}
if (settings.el) {
return settings.el;
}
var ol = document.createElement("ol");
ol.className = settings.className;
settings.el = ol;
return ol;
}
},
createPlaylist_: {
value: 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");
var ol = document_1.createElement('ol');
if (!list) {
list = document.createElement("ol");
list.className = "vjs-playlist-item-list";
this.el_.appendChild(list);
}
ol.className = settings.className;
settings.el = ol;
return ol;
};
// remove any existing items
for (var i = 0; i < this.items.length; i++) {
list.removeChild(this.items[i].el_);
}
this.items.length = 0;
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');
// create new items
for (var i = 0; i < playlist.length; i++) {
var item = new PlaylistMenuItem(this.player_, {
item: playlist[i]
}, this.options_);
this.items.push(item);
list.appendChild(item.el_);
}
if (!list) {
list = document_1.createElement('ol');
list.className = 'vjs-playlist-item-list';
this.el_.appendChild(list);
}
// Inject the ad overlay. IE<11 doesn't support "pointer-events:
// none" so we use this element to block clicks during ad
// playback.
if (!overlay) {
var _overlay = document.createElement("li");
_overlay.className = "vjs-playlist-ad-overlay";
list.appendChild(_overlay);
} else {
// Move overlay to end of list
list.appendChild(overlay);
}
// remove any existing items
for (var i = 0; i < this.items.length; i++) {
list.removeChild(this.items[i].el_);
}
this.items.length = 0;
// select the current playlist item
var selectedIndex = this.player_.playlist.currentItem();
if (this.items.length && selectedIndex >= 0) {
addSelectedClass(this.items[selectedIndex]);
// create new items
for (var _i = 0; _i < playlist.length; _i++) {
var item = new PlaylistMenuItem(this.player_, {
item: playlist[_i]
}, this.options_);
var thumbnail = this.items[selectedIndex].$(".vjs-playlist-thumbnail");
if (thumbnail) {
dom.addClass(thumbnail, "vjs-playlist-now-playing");
}
}
this.items.push(item);
list.appendChild(item.el_);
}
// Inject the ad overlay. IE<11 doesn't support "pointer-events:
// none" so we use this element to block clicks during ad
// playback.
if (!overlay) {
overlay = document_1.createElement('li');
overlay.className = 'vjs-playlist-ad-overlay';
list.appendChild(overlay);
} else {
// Move overlay to end of list
list.appendChild(overlay);
}
// select the current playlist item
var selectedIndex = this.player_.playlist.currentItem();
if (this.items.length && selectedIndex >= 0) {
addSelectedClass(this.items[selectedIndex]);
var thumbnail = this.items[selectedIndex].$('.vjs-playlist-thumbnail');
if (thumbnail) {
dom.addClass(thumbnail, 'vjs-playlist-now-playing');
}
},
update: {
value: function update() {
// replace the playlist items being displayed, if necessary
var playlist = this.player_.playlist();
if (this.items.length !== playlist.length) {
// if the menu is currently empty or the state is obviously out
// of date, rebuild everything.
this.createPlaylist_();
return;
}
for (var i = 0; i < this.items.length; i++) {
if (this.items[i].item !== playlist[i]) {
// if any of the playlist items have changed, rebuild the
// entire playlist
this.createPlaylist_();
return;
}
}
}
};
// the playlist itself is unchanged so just update the selection
var currentItem = this.player_.playlist.currentItem();
for (var i = 0; i < this.items.length; i++) {
var item = this.items[i];
if (i === currentItem) {
addSelectedClass(item);
if (document.activeElement !== item.el()) {
dom.addClass(item.thumbnail, "vjs-playlist-now-playing");
}
notUpNext(item);
} else if (i === currentItem + 1) {
removeSelectedClass(item);
upNext(item);
} else {
removeSelectedClass(item);
notUpNext(item);
}
PlaylistMenu.prototype.update = function update() {
// replace the playlist items being displayed, if necessary
var playlist = this.player_.playlist();
if (this.items.length !== playlist.length) {
// if the menu is currently empty or the state is obviously out
// of date, rebuild everything.
this.createPlaylist_();
return;
}
for (var i = 0; i < this.items.length; i++) {
if (this.items[i].item !== playlist[i]) {
// if any of the playlist items have changed, rebuild the
// entire playlist
this.createPlaylist_();
return;
}
}
// the playlist itself is unchanged so just update the selection
var currentItem = this.player_.playlist.currentItem();
for (var _i2 = 0; _i2 < this.items.length; _i2++) {
var item = this.items[_i2];
if (_i2 === currentItem) {
addSelectedClass(item);
if (document_1.activeElement !== item.el()) {
dom.addClass(item.thumbnail, 'vjs-playlist-now-playing');
}
notUpNext(item);
} else if (_i2 === currentItem + 1) {
removeSelectedClass(item);
upNext(item);
} else {
removeSelectedClass(item);
notUpNext(item);
}
}
});
};
return PlaylistMenu;
})(Component);
}(Component);

@@ -390,19 +485,23 @@ /**

*/
var playlistUi = function playlistUi(options) {
var player = this;
var settings = undefined,
elem = undefined;
var settings = void 0;
var elem = void 0;
if (!player.playlist) {
throw new Error("videojs-playlist is required for the playlist component");
throw new Error('videojs-playlist is required for the playlist component');
}
// if the first argument is a DOM element, use it to build the component
if (typeof HTMLElement !== "undefined" && options instanceof HTMLElement || options && options.nodeType === 1) {
if (typeof window_1.HTMLElement !== 'undefined' && options instanceof window_1.HTMLElement ||
// IE8 does not define HTMLElement so use a hackier type check
options && options.nodeType === 1) {
elem = options;
settings = videojs.mergeOptions(defaults);
settings = videojs.mergeOptions(defaults$$1);
} else {
// lookup the elements to use by class name
settings = videojs.mergeOptions(defaults, options);
elem = document.querySelector("." + settings.className);
settings = videojs.mergeOptions(defaults$$1, options);
elem = document_1.querySelector('.' + settings.className);
}

@@ -416,11 +515,8 @@

// register components
videojs.registerComponent("PlaylistMenu", PlaylistMenu);
videojs.registerComponent("PlaylistMenuItem", PlaylistMenuItem);
videojs.registerComponent('PlaylistMenu', PlaylistMenu);
videojs.registerComponent('PlaylistMenuItem', PlaylistMenuItem);
// register the plugin
registerPlugin("playlistUi", playlistUi);
registerPlugin('playlistUi', playlistUi);
// IE8 does not define HTMLElement so use a hackier type check
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}]},{},[1]);
})));

@@ -1,3 +0,7 @@

/*! videojs-playlist-ui - v3.0.4 - 2017-04-26
* Copyright (c) 2017 Brightcove; Licensed Apache-2.0 */
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(){(function(a){"use strict";var b=function(a){return a&&a.__esModule?a["default"]:a},c=function(){function a(a,b){for(var c in b){var d=b[c];d.configurable=!0,d.value&&(d.writable=!0)}Object.defineProperties(a,b)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),d=function v(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){var e=Object.getPrototypeOf(a);return null===e?void 0:v(e,b,c)}if("value"in d&&d.writable)return d.value;var f=d.get;return void 0===f?void 0:f.call(c)},e=function(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(a.__proto__=b)},f=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},g=b("undefined"!=typeof window?window.videojs:"undefined"!=typeof a?a.videojs:null),h=g.dom||g,i=g.registerPlugin||g.plugin,j=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},k=function(){var a=document.createElement("x");return a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents}(),l={className:"vjs-playlist",playOnSelect:!1,supportsCssPointerEvents:k},m=function(a){a.addClass("vjs-selected")},n=function(a){a.removeClass("vjs-selected"),a.thumbnail&&h.removeClass(a.thumbnail,"vjs-playlist-now-playing")},o=function(a){a.addClass("vjs-up-next")},p=function(a){a.removeClass("vjs-up-next")},q=function(a){if(!a){var b=document.createElement("div");return b.className="vjs-playlist-thumbnail vjs-playlist-thumbnail-placeholder",b}var c=document.createElement("picture");if(c.className="vjs-playlist-thumbnail","string"==typeof a){var d=document.createElement("img");d.src=a,d.alt="",c.appendChild(d)}else{for(var e=0;e<a.length-1;e++){var f=a[e],g=document.createElement("source");for(var h in f)g[h]=f[h];c.appendChild(g)}var i=a[a.length-1],d=document.createElement("img");d.alt="";for(var h in i)d[h]=i[h];c.appendChild(d)}return c},r=g.getComponent("Component"),s=function(a){function b(a,c,e){if(f(this,b),!c.item)throw new Error("Cannot construct a PlaylistMenuItem without an item option");d(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,a,c),this.item=c.item,this.playOnSelect=e.playOnSelect,this.emitTapEvents(),this.on(["click","tap"],this.switchPlaylistItem_),this.on("keydown",this.handleKeyDown_)}return e(b,a),c(b,{handleKeyDown_:{value:function(a){(13===a.which||32===a.which)&&this.switchPlaylistItem_()}},switchPlaylistItem_:{value:function(){this.player_.playlist.currentItem(j(this.player_.playlist(),this.item)),this.playOnSelect&&this.player_.play()}},createEl:{value:function(){var a=document.createElement("li"),b=this.options_.item;if(a.className="vjs-playlist-item",a.setAttribute("tabIndex",0),this.thumbnail=q(b.thumbnail),a.appendChild(this.thumbnail),b.duration){var c=document.createElement("time"),d=g.formatTime(b.duration);c.className="vjs-playlist-duration",c.setAttribute("datetime","PT0H0M"+b.duration+"S"),c.appendChild(document.createTextNode(d)),a.appendChild(c)}var e=document.createElement("span"),f=this.localize("Now Playing");e.className="vjs-playlist-now-playing-text",e.appendChild(document.createTextNode(f)),e.setAttribute("title",f),this.thumbnail.appendChild(e);var h=document.createElement("div");h.className="vjs-playlist-title-container",this.thumbnail.appendChild(h);var i=document.createElement("span"),j=this.localize("Up Next");i.className="vjs-up-next-text",i.appendChild(document.createTextNode(j)),i.setAttribute("title",j),h.appendChild(i);var k=document.createElement("cite"),l=b.name||this.localize("Untitled Video");return k.className="vjs-playlist-name",k.appendChild(document.createTextNode(l)),k.setAttribute("title",l),h.appendChild(k),a}}}),b}(r),t=function(a){function b(a,c){var e=this;if(f(this,b),!a.playlist)throw new Error("videojs-playlist is required for the playlist component");d(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,a,c),this.items=[],c.supportsCssPointerEvents&&this.addClass("vjs-csspointerevents"),this.createPlaylist_(),g.browser.TOUCH_ENABLED||this.addClass("vjs-mouse"),a.on(["loadstart","playlistchange"],function(){e.update()}),a.on("adstart",function(){e.addClass("vjs-ad-playing")}),a.on("adend",function(){a.ended()?a.one("ended",function(){e.removeClass("vjs-ad-playing")}):e.removeClass("vjs-ad-playing")})}return e(b,a),c(b,{createEl:{value:function(){var a=this.options_;if(a.el)return a.el;var b=document.createElement("ol");return b.className=a.className,a.el=b,b}},createPlaylist_:{value:function(){var a=this.player_.playlist()||[],b=this.el_.querySelector(".vjs-playlist-item-list"),c=this.el_.querySelector(".vjs-playlist-ad-overlay");b||(b=document.createElement("ol"),b.className="vjs-playlist-item-list",this.el_.appendChild(b));for(var d=0;d<this.items.length;d++)b.removeChild(this.items[d].el_);this.items.length=0;for(var d=0;d<a.length;d++){var e=new s(this.player_,{item:a[d]},this.options_);this.items.push(e),b.appendChild(e.el_)}if(c)b.appendChild(c);else{var f=document.createElement("li");f.className="vjs-playlist-ad-overlay",b.appendChild(f)}var g=this.player_.playlist.currentItem();if(this.items.length&&g>=0){m(this.items[g]);var i=this.items[g].$(".vjs-playlist-thumbnail");i&&h.addClass(i,"vjs-playlist-now-playing")}}},update:{value:function(){var a=this.player_.playlist();if(this.items.length!==a.length)return void this.createPlaylist_();for(var b=0;b<this.items.length;b++)if(this.items[b].item!==a[b])return void this.createPlaylist_();for(var c=this.player_.playlist.currentItem(),b=0;b<this.items.length;b++){var d=this.items[b];b===c?(m(d),document.activeElement!==d.el()&&h.addClass(d.thumbnail,"vjs-playlist-now-playing"),p(d)):b===c+1?(n(d),o(d)):(n(d),p(d))}}}}),b}(r),u=function(a){var b=this,c=void 0,d=void 0;if(!b.playlist)throw new Error("videojs-playlist is required for the playlist component");"undefined"!=typeof HTMLElement&&a instanceof HTMLElement||a&&1===a.nodeType?(d=a,c=g.mergeOptions(l)):(c=g.mergeOptions(l,a),d=document.querySelector("."+c.className)),c.el=d,b.playlistMenu=new t(b,c)};g.registerComponent("PlaylistMenu",t),g.registerComponent("PlaylistMenuItem",s),i("playlistUi",u)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]);
/**
* videojs-playlist-ui
* @version 3.0.5
* @copyright 2017 Brightcove, Inc.
* @license Apache-2.0
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],t):t(e.videojs)}(this,function(e){"use strict";e="default"in e?e["default"]:e;var t,i="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={},l=(Object.freeze||Object)({"default":n}),a=l&&n||l,s=void 0!==i?i:"undefined"!=typeof window?window:{};"undefined"!=typeof document?t=document:(t=s["__GLOBAL_DOCUMENT_CACHE@4"])||(t=s["__GLOBAL_DOCUMENT_CACHE@4"]=a);var r,o=t,p=r="undefined"!=typeof window?window:void 0!==i?i:"undefined"!=typeof self?self:{},d=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},c=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)},u=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},h=e.dom||e,m=e.registerPlugin||e.plugin,y=function(e,t){for(var i=0,n=e.length;i<n;i++)if(e[i]===t)return i;return-1},f={className:"vjs-playlist",playOnSelect:!1,supportsCssPointerEvents:function(){var e=o.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}()},v=function(e){e.addClass("vjs-selected")},C=function(e){e.removeClass("vjs-selected"),e.thumbnail&&h.removeClass(e.thumbnail,"vjs-playlist-now-playing")},w=function(e){e.addClass("vjs-up-next")},j=function(e){e.removeClass("vjs-up-next")},_=function(e){if(!e){var t=o.createElement("div");return t.className="vjs-playlist-thumbnail vjs-playlist-thumbnail-placeholder",t}var i=o.createElement("picture");if(i.className="vjs-playlist-thumbnail","string"==typeof e){var n=o.createElement("img");n.src=e,n.alt="",i.appendChild(n)}else{for(var l=0;l<e.length-1;l++){var a=e[l],s=o.createElement("source");for(var r in a)s[r]=a[r];i.appendChild(s)}var p=e[e.length-1],d=o.createElement("img");d.alt="";for(var c in p)d[c]=p[c];i.appendChild(d)}return i},E=e.getComponent("Component"),b=function(t){function i(e,n,l){if(d(this,i),!n.item)throw new Error("Cannot construct a PlaylistMenuItem without an item option");var a=u(this,t.call(this,e,n));return a.item=n.item,a.playOnSelect=l.playOnSelect,a.emitTapEvents(),a.on(["click","tap"],a.switchPlaylistItem_),a.on("keydown",a.handleKeyDown_),a}return c(i,t),i.prototype.handleKeyDown_=function(e){13!==e.which&&32!==e.which||this.switchPlaylistItem_()},i.prototype.switchPlaylistItem_=function(e){this.player_.playlist.currentItem(y(this.player_.playlist(),this.item)),this.playOnSelect&&this.player_.play()},i.prototype.createEl=function(){var t=o.createElement("li"),i=this.options_.item;if(t.className="vjs-playlist-item",t.setAttribute("tabIndex",0),this.thumbnail=_(i.thumbnail),t.appendChild(this.thumbnail),i.duration){var n=o.createElement("time"),l=e.formatTime(i.duration);n.className="vjs-playlist-duration",n.setAttribute("datetime","PT0H0M"+i.duration+"S"),n.appendChild(o.createTextNode(l)),t.appendChild(n)}var a=o.createElement("span"),s=this.localize("Now Playing");a.className="vjs-playlist-now-playing-text",a.appendChild(o.createTextNode(s)),a.setAttribute("title",s),this.thumbnail.appendChild(a);var r=o.createElement("div");r.className="vjs-playlist-title-container",this.thumbnail.appendChild(r);var p=o.createElement("span"),d=this.localize("Up Next");p.className="vjs-up-next-text",p.appendChild(o.createTextNode(d)),p.setAttribute("title",d),r.appendChild(p);var c=o.createElement("cite"),u=i.name||this.localize("Untitled Video");return c.className="vjs-playlist-name",c.appendChild(o.createTextNode(u)),c.setAttribute("title",u),r.appendChild(c),t},i}(E),g=function(t){function i(n,l){if(d(this,i),!n.playlist)throw new Error("videojs-playlist is required for the playlist component");var a=u(this,t.call(this,n,l));return a.items=[],l.supportsCssPointerEvents&&a.addClass("vjs-csspointerevents"),a.createPlaylist_(),e.browser.TOUCH_ENABLED||a.addClass("vjs-mouse"),n.on(["loadstart","playlistchange"],function(e){a.update()}),n.on("adstart",function(){a.addClass("vjs-ad-playing")}),n.on("adend",function(){n.ended()?n.one("ended",function(){a.removeClass("vjs-ad-playing")}):a.removeClass("vjs-ad-playing")}),a}return c(i,t),i.prototype.createEl=function(){var e=this.options_;if(e.el)return e.el;var t=o.createElement("ol");return t.className=e.className,e.el=t,t},i.prototype.createPlaylist_=function(){var e=this.player_.playlist()||[],t=this.el_.querySelector(".vjs-playlist-item-list"),i=this.el_.querySelector(".vjs-playlist-ad-overlay");t||((t=o.createElement("ol")).className="vjs-playlist-item-list",this.el_.appendChild(t));for(var n=0;n<this.items.length;n++)t.removeChild(this.items[n].el_);this.items.length=0;for(var l=0;l<e.length;l++){var a=new b(this.player_,{item:e[l]},this.options_);this.items.push(a),t.appendChild(a.el_)}i?t.appendChild(i):((i=o.createElement("li")).className="vjs-playlist-ad-overlay",t.appendChild(i));var s=this.player_.playlist.currentItem();if(this.items.length&&s>=0){v(this.items[s]);var r=this.items[s].$(".vjs-playlist-thumbnail");r&&h.addClass(r,"vjs-playlist-now-playing")}},i.prototype.update=function(){var e=this.player_.playlist();if(this.items.length!==e.length)return void this.createPlaylist_();for(var t=0;t<this.items.length;t++)if(this.items[t].item!==e[t])return void this.createPlaylist_();for(var i=this.player_.playlist.currentItem(),n=0;n<this.items.length;n++){var l=this.items[n];n===i?(v(l),o.activeElement!==l.el()&&h.addClass(l.thumbnail,"vjs-playlist-now-playing"),j(l)):n===i+1?(C(l),w(l)):(C(l),j(l))}},i}(E),N=function(t){var i=this,n=void 0,l=void 0;if(!i.playlist)throw new Error("videojs-playlist is required for the playlist component");"undefined"!=typeof p.HTMLElement&&t instanceof p.HTMLElement||t&&1===t.nodeType?(l=t,n=e.mergeOptions(f)):(n=e.mergeOptions(f,t),l=o.querySelector("."+n.className)),n.el=l,i.playlistMenu=new g(i,n)};e.registerComponent("PlaylistMenu",g),e.registerComponent("PlaylistMenuItem",b),m("playlistUi",N)});
{
"name": "videojs-playlist-ui",
"version": "3.0.4",
"author": "Brightcove",
"version": "3.0.5",
"author": "Brightcove, Inc.",
"description": "A playlist video picker for video.js",
"main": "es5/videojs-playlist-ui.js",
"license": "Apache-2.0",
"keywords": [
"videojs-plugin",
"playlist",
"videojs"
"videojs",
"videojs-plugin"
],
"scripts": {
"test": "grunt test",
"prepublish": "grunt build:dist"
"prebuild": "npm run clean",
"build": "npm-run-all -p build:*",
"build:css": "npm-run-all build:css:sass build:css:bannerize",
"build:css:bannerize": "bannerize dist/videojs-playlist-ui.css --banner=scripts/banner.ejs",
"build:css:sass": "node-sass src/plugin.scss dist/videojs-playlist-ui.css --output-style=compressed --linefeed=lf",
"build:js": "npm-run-all build:js:rollup build:js:bannerize build:js:uglify",
"build:js:bannerize": "bannerize dist/videojs-playlist-ui.js --banner=scripts/banner.ejs",
"build:js:rollup": "rollup -c scripts/build.rollup.config.js",
"build:js:uglify": "uglifyjs dist/videojs-playlist-ui.js --comments --mangle --compress --ie8 -o dist/videojs-playlist-ui.min.js",
"build:test": "rollup -c scripts/test.rollup.config.js",
"clean": "rimraf dist test/dist",
"postclean": "mkdirp dist test/dist",
"lint": "vjsstandard",
"prestart": "npm run build",
"start": "npm-run-all -p start:server watch",
"start:server": "static -a 0.0.0.0 -p 9999 -H '{\"Cache-Control\": \"no-cache, must-revalidate\"}' .",
"pretest": "npm-run-all lint build",
"test": "karma start test/karma.conf.js",
"preversion": "npm test",
"version": "node scripts/version.js",
"watch": "npm-run-all -p watch:*",
"watch:css": "node-sass src/plugin.scss dist/videojs-playlist-ui.css --output-style=compressed --linefeed=lf --watch src/**/*.scss",
"watch:js": "rollup -c scripts/build.rollup.config.js -w",
"watch:test": "rollup -c scripts/test.rollup.config.js -w",
"prepublish": "npm run build",
"prepush": "npm run lint"
},

@@ -22,38 +45,64 @@ "repository": {

"dependencies": {
"video.js": "^5.2.0"
"global": "^4.3.2",
"video.js": "^5.19.2"
},
"devDependencies": {
"autoprefixer-core": "^5.1.8",
"babel": "^5.8.38",
"babelify": "^5.0.4",
"browserify": "^9.0.3",
"browserify-shim": "^3.8.12",
"grunt": "^0.4.0",
"grunt-browserify": "^3.5.0",
"grunt-cli": "^0.1.13",
"grunt-contrib-clean": "^0.4",
"grunt-contrib-connect": "^0.9.0",
"grunt-contrib-jshint": "^0.11",
"grunt-contrib-less": "^1.0.0",
"grunt-contrib-uglify": "^0.8.0",
"grunt-contrib-watch": "^0.4",
"grunt-karma": "^2.0.0",
"grunt-postcss": "^0.3.0",
"karma": "^1.4.1",
"karma-chrome-launcher": "^2.0.0",
"karma-detect-browsers": "^2.2.4",
"karma-firefox-launcher": "^1.0.0",
"karma-opera-launcher": "^1.0.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-object-assign": "^6.8.0",
"babel-preset-es2015": "^6.14.0",
"babel-preset-es3": "^1.0.1",
"bannerize": "^1.0.2",
"conventional-changelog-cli": "^1.3.1",
"conventional-changelog-videojs": "^3.0.0",
"es5-shim": "^4.5.9",
"husky": "^0.13.3",
"karma": "~1.3.0",
"karma-chrome-launcher": "^2.1.1",
"karma-detect-browsers": "^2.2.5",
"karma-firefox-launcher": "^1.0.1",
"karma-ie-launcher": "^1.0.0",
"karma-qunit": "^1.2.1",
"karma-safari-launcher": "^1.0.0",
"load-grunt-tasks": "^3.1.0",
"postcss-pseudoelements": "^2.1.1",
"qunitjs": "^1.12",
"shelljs": "^0.7.0",
"shelljs-nodecli": "^0.1.1",
"videojs-playlist": "^3.0.0"
"mkdirp": "^0.5.1",
"node-sass": "^4.5.3",
"node-static": "^0.7.9",
"npm-run-all": "^4.0.2",
"qunitjs": "^1.21.0",
"rimraf": "^2.6.1",
"rollup": "^0.41.6",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-multi-entry": "^2.0.1",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-replace": "^1.1.1",
"rollup-watch": "^3.2.2",
"semver": "^5.3.0",
"sinon": "^2.2.0",
"uglify-js": "^3.0.7",
"videojs-playlist": "^4.0.0",
"videojs-standard": "^6.0.0"
},
"browserify-shim": {
"video.js": "global:videojs"
}
"main": "dist/videojs-playlist-ui.cjs.js",
"module": "dist/videojs-playlist-ui.es.js",
"generator-videojs-plugin": {
"version": "5.0.0-5"
},
"vjsstandard": {
"ignore": [
"dist",
"docs",
"scripts",
"test/dist",
"test/karma.conf.js"
]
},
"files": [
"CONTRIBUTING.md",
"dist/",
"docs/",
"index.html",
"scripts/",
"src/",
"test/"
]
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc