Socket
Socket
Sign inDemoInstall

videojs-playlist-ui

Package Overview
Dependencies
Maintainers
42
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 2.3.3 to 2.3.4

CONTRIBUTING.md

7

CHANGELOG.md

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

# CHANGELOG
<a name="2.3.4"></a>
## [2.3.4](https://github.com/brightcove/videojs-playlist-ui/compare/v2.3.3...v2.3.4) (2017-05-30)
### Chores
* Update tooling using generator v5 prerelease. ([#43](https://github.com/brightcove/videojs-playlist-ui/issues/43)) ([84475be](https://github.com/brightcove/videojs-playlist-ui/commit/84475be))
## 2.3.1

@@ -4,0 +9,0 @@

506

dist/videojs-playlist-ui.js

@@ -1,24 +0,64 @@

/*! videojs-playlist-ui - v2.3.3 - 2017-03-24
* Copyright (c) 2017 Brightcove; Licensed Apache-2.0 */
/**
* videojs-playlist-ui
* @version 2.3.4
* @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;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(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; }
function _inherits(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; }
// support VJS5 & VJS6 at the same time

@@ -30,3 +70,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 +80,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');
element.style.cssText = 'pointer-events:auto';
return element.style.pointerEvents === 'auto';
}();
var defaults = {
className: "vjs-playlist",
className: 'vjs-playlist',
playOnSelect: false,

@@ -57,9 +98,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');
}

@@ -70,13 +111,16 @@ };

if (!thumbnail) {
var placeholder = document.createElement("div");
placeholder.className = "vjs-playlist-thumbnail";
var placeholder = document_1.createElement('div');
placeholder.className = 'vjs-playlist-thumbnail';
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;

@@ -91,3 +135,4 @@ picture.appendChild(img);

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

@@ -102,7 +147,8 @@ for (var prop in _variant) {

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

@@ -112,5 +158,7 @@ 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) {

@@ -120,115 +168,112 @@ _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.on(["focus", "mouseover"], this.addPlayIcon_);
this.on(["blur", "mouseout"], this.removePlayIcon_);
_this.emitTapEvents();
_this.on(['click', 'tap'], _this.switchPlaylistItem_);
_this.on('keydown', _this.handleKeyDown_);
_this.on(['focus', 'mouseover'], _this.addPlayIcon_);
_this.on(['blur', 'mouseout'], _this.removePlayIcon_);
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();
}
}
},
addPlayIcon_: {
value: function addPlayIcon_() {
dom.addClass(this.thumbnail, "vjs-icon-play");
dom.removeClass(this.thumbnail, "vjs-playlist-now-playing");
}
},
removePlayIcon_: {
value: function removePlayIcon_() {
if (document.activeElement === this.el()) {
return;
}
PlaylistMenuItem.prototype.switchPlaylistItem_ = function switchPlaylistItem_(event) {
this.player_.playlist.currentItem(indexOf(this.player_.playlist(), this.item));
if (this.playOnSelect) {
this.player_.play();
}
};
dom.removeClass(this.thumbnail, "vjs-icon-play");
if (this.hasClass("vjs-selected")) {
dom.addClass(this.thumbnail, "vjs-playlist-now-playing");
}
}
},
createEl: {
value: function createEl() {
var li = document.createElement("li");
var item = this.options_.item;
PlaylistMenuItem.prototype.addPlayIcon_ = function addPlayIcon_() {
dom.addClass(this.thumbnail, 'vjs-icon-play');
dom.removeClass(this.thumbnail, 'vjs-playlist-now-playing');
};
li.className = "vjs-playlist-item";
li.setAttribute("tabIndex", 0);
PlaylistMenuItem.prototype.removePlayIcon_ = function removePlayIcon_() {
if (document_1.activeElement === this.el()) {
return;
}
// Thumbnail image
this.thumbnail = createThumbnail(item.thumbnail);
li.appendChild(this.thumbnail);
dom.removeClass(this.thumbnail, 'vjs-icon-play');
if (this.hasClass('vjs-selected')) {
dom.addClass(this.thumbnail, 'vjs-playlist-now-playing');
}
};
// 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);
}
PlaylistMenuItem.prototype.createEl = function createEl() {
var li = document_1.createElement('li');
var item = this.options_.item;
// Name and description
var name = document.createElement("cite");
var nameValue = item.name || this.localize("Untitled Video");
name.className = "vjs-playlist-name";
name.appendChild(document.createTextNode(nameValue));
name.setAttribute("title", nameValue);
li.appendChild(name);
li.className = 'vjs-playlist-item';
li.setAttribute('tabIndex', 0);
if (item.description) {
var description = document.createElement("p");
description.className = "vjs-playlist-description";
description.appendChild(document.createTextNode(item.description));
description.setAttribute("title", item.description);
li.appendChild(description);
}
// Thumbnail image
this.thumbnail = createThumbnail(item.thumbnail);
li.appendChild(this.thumbnail);
return li;
}
// Duration
if (item.duration) {
var duration = document_1.createElement('time');
var time = videojs.formatTime(item.duration);
duration.className = 'vjs-playlist-duration';
duration.setAttribute('datetime', 'PT0H0M' + item.duration + 'S');
duration.appendChild(document_1.createTextNode(time));
li.appendChild(duration);
}
});
// Name and description
var name = document_1.createElement('cite');
var nameValue = item.name || this.localize('Untitled Video');
name.className = 'vjs-playlist-name';
name.appendChild(document_1.createTextNode(nameValue));
name.setAttribute('title', nameValue);
li.appendChild(name);
if (item.description) {
var description = document_1.createElement('p');
description.className = 'vjs-playlist-description';
description.appendChild(document_1.createTextNode(item.description));
description.setAttribute('title', item.description);
li.appendChild(description);
}
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);
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

@@ -238,13 +283,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();
});

@@ -254,6 +299,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()) {

@@ -263,107 +308,109 @@ // 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 ol = document_1.createElement('ol');
// remove any existing items
for (var i = 0; i < this.items.length; i++) {
this.removeChild(this.items[i]);
}
this.items.length = 0;
var overlay = this.el_.querySelector(".vjs-playlist-ad-overlay");
if (overlay) {
overlay.parentNode.removeChild(overlay);
}
ol.className = settings.className;
settings.el = ol;
return ol;
};
// 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);
this.addChild(item);
}
PlaylistMenu.prototype.createPlaylist_ = function createPlaylist_() {
var playlist = this.player_.playlist() || [];
// Inject the ad overlay. IE<11 doesn't support "pointer-events:
// none" so we use this element to block clicks during ad
// playback.
overlay = document.createElement("li");
overlay.className = "vjs-playlist-ad-overlay";
this.el_.appendChild(overlay);
// remove any existing items
for (var i = 0; i < this.items.length; i++) {
this.removeChild(this.items[i]);
}
this.items.length = 0;
var overlay = this.el_.querySelector('.vjs-playlist-ad-overlay');
// select the current playlist item
var selectedIndex = this.player_.playlist.currentItem();
if (this.items.length && selectedIndex >= 0) {
addSelectedClass(this.items[selectedIndex]);
if (overlay) {
overlay.parentNode.removeChild(overlay);
}
var thumbnail = this.items[selectedIndex].$(".vjs-playlist-thumbnail");
if (thumbnail) {
dom.addClass(thumbnail, "vjs-playlist-now-playing");
}
}
// 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);
this.addChild(item);
}
// Inject the ad overlay. IE<11 doesn't support "pointer-events:
// none" so we use this element to block clicks during ad
// playback.
overlay = document_1.createElement('li');
overlay.className = 'vjs-playlist-ad-overlay';
this.el_.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");
}
} else {
removeSelectedClass(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');
}
} else {
removeSelectedClass(item);
}
}
});
};
return PlaylistMenu;
})(Component);
}(Component);

@@ -374,13 +421,17 @@ /**

*/
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;

@@ -391,3 +442,3 @@ settings = videojs.mergeOptions(defaults);

settings = videojs.mergeOptions(defaults, options);
elem = document.querySelector("." + settings.className);
elem = document_1.querySelector('.' + settings.className);
}

@@ -401,11 +452,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 - v2.3.3 - 2017-03-24
* 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 t(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){var e=Object.getPrototypeOf(a);return null===e?void 0:t(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){if(!a){var b=document.createElement("div");return b.className="vjs-playlist-thumbnail",b}var c=document.createElement("picture");if(c.className="vjs-playlist-thumbnail","string"==typeof a){var d=document.createElement("img");d.src=a,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");for(var h in i)d[h]=i[h];c.appendChild(d)}return c},p=g.getComponent("Component"),q=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_),this.on(["focus","mouseover"],this.addPlayIcon_),this.on(["blur","mouseout"],this.removePlayIcon_)}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()}},addPlayIcon_:{value:function(){h.addClass(this.thumbnail,"vjs-icon-play"),h.removeClass(this.thumbnail,"vjs-playlist-now-playing")}},removePlayIcon_:{value:function(){document.activeElement!==this.el()&&(h.removeClass(this.thumbnail,"vjs-icon-play"),this.hasClass("vjs-selected")&&h.addClass(this.thumbnail,"vjs-playlist-now-playing"))}},createEl:{value:function(){var a=document.createElement("li"),b=this.options_.item;if(a.className="vjs-playlist-item",a.setAttribute("tabIndex",0),this.thumbnail=o(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("cite"),f=b.name||this.localize("Untitled Video");if(e.className="vjs-playlist-name",e.appendChild(document.createTextNode(f)),e.setAttribute("title",f),a.appendChild(e),b.description){var h=document.createElement("p");h.className="vjs-playlist-description",h.appendChild(document.createTextNode(b.description)),h.setAttribute("title",b.description),a.appendChild(h)}return a}}}),b}(p),r=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(){for(var a=this.player_.playlist()||[],b=0;b<this.items.length;b++)this.removeChild(this.items[b]);this.items.length=0;var c=this.el_.querySelector(".vjs-playlist-ad-overlay");c&&c.parentNode.removeChild(c);for(var b=0;b<a.length;b++){var d=new q(this.player_,{item:a[b]},this.options_);this.items.push(d),this.addChild(d)}c=document.createElement("li"),c.className="vjs-playlist-ad-overlay",this.el_.appendChild(c);var e=this.player_.playlist.currentItem();if(this.items.length&&e>=0){m(this.items[e]);var f=this.items[e].$(".vjs-playlist-thumbnail");f&&h.addClass(f,"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")):n(d)}}}}),b}(p),s=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 r(b,c)};g.registerComponent("PlaylistMenu",r),g.registerComponent("PlaylistMenuItem",q),i("playlistUi",s)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]);
/**
* videojs-playlist-ui
* @version 2.3.4
* @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";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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}function n(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)}e="default"in e?e["default"]:e;var s,l="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},a={},o=(Object.freeze||Object)({"default":a}),r=o&&a||o,p=void 0!==l?l:"undefined"!=typeof window?window:{};"undefined"!=typeof document?s=document:(s=p["__GLOBAL_DOCUMENT_CACHE@4"])||(s=p["__GLOBAL_DOCUMENT_CACHE@4"]=r);var d,c=s,u=d="undefined"!=typeof window?window:void 0!==l?l:"undefined"!=typeof self?self:{},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=c.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){if(!e){var t=c.createElement("div");return t.className="vjs-playlist-thumbnail",t}var i=c.createElement("picture");if(i.className="vjs-playlist-thumbnail","string"==typeof e){var n=c.createElement("img");n.src=e,i.appendChild(n)}else{for(var s=0;s<e.length-1;s++){var l=e[s],a=c.createElement("source");for(var o in l)a[o]=l[o];i.appendChild(a)}var r=e[e.length-1],p=c.createElement("img");for(var d in r)p[d]=r[d];i.appendChild(p)}return i},_=e.getComponent("Component"),j=function(s){function l(e,n,a){if(t(this,l),!n.item)throw new Error("Cannot construct a PlaylistMenuItem without an item option");var o=i(this,s.call(this,e,n));return o.item=n.item,o.playOnSelect=a.playOnSelect,o.emitTapEvents(),o.on(["click","tap"],o.switchPlaylistItem_),o.on("keydown",o.handleKeyDown_),o.on(["focus","mouseover"],o.addPlayIcon_),o.on(["blur","mouseout"],o.removePlayIcon_),o}return n(l,s),l.prototype.handleKeyDown_=function(e){13!==e.which&&32!==e.which||this.switchPlaylistItem_()},l.prototype.switchPlaylistItem_=function(e){this.player_.playlist.currentItem(y(this.player_.playlist(),this.item)),this.playOnSelect&&this.player_.play()},l.prototype.addPlayIcon_=function(){h.addClass(this.thumbnail,"vjs-icon-play"),h.removeClass(this.thumbnail,"vjs-playlist-now-playing")},l.prototype.removePlayIcon_=function(){c.activeElement!==this.el()&&(h.removeClass(this.thumbnail,"vjs-icon-play"),this.hasClass("vjs-selected")&&h.addClass(this.thumbnail,"vjs-playlist-now-playing"))},l.prototype.createEl=function(){var t=c.createElement("li"),i=this.options_.item;if(t.className="vjs-playlist-item",t.setAttribute("tabIndex",0),this.thumbnail=w(i.thumbnail),t.appendChild(this.thumbnail),i.duration){var n=c.createElement("time"),s=e.formatTime(i.duration);n.className="vjs-playlist-duration",n.setAttribute("datetime","PT0H0M"+i.duration+"S"),n.appendChild(c.createTextNode(s)),t.appendChild(n)}var l=c.createElement("cite"),a=i.name||this.localize("Untitled Video");if(l.className="vjs-playlist-name",l.appendChild(c.createTextNode(a)),l.setAttribute("title",a),t.appendChild(l),i.description){var o=c.createElement("p");o.className="vjs-playlist-description",o.appendChild(c.createTextNode(i.description)),o.setAttribute("title",i.description),t.appendChild(o)}return t},l}(_),b=function(s){function l(n,a){if(t(this,l),!n.playlist)throw new Error("videojs-playlist is required for the playlist component");var o=i(this,s.call(this,n,a));return o.items=[],a.supportsCssPointerEvents&&o.addClass("vjs-csspointerevents"),o.createPlaylist_(),e.browser.TOUCH_ENABLED||o.addClass("vjs-mouse"),n.on(["loadstart","playlistchange"],function(e){o.update()}),n.on("adstart",function(){o.addClass("vjs-ad-playing")}),n.on("adend",function(){n.ended()?n.one("ended",function(){o.removeClass("vjs-ad-playing")}):o.removeClass("vjs-ad-playing")}),o}return n(l,s),l.prototype.createEl=function(){var e=this.options_;if(e.el)return e.el;var t=c.createElement("ol");return t.className=e.className,e.el=t,t},l.prototype.createPlaylist_=function(){for(var e=this.player_.playlist()||[],t=0;t<this.items.length;t++)this.removeChild(this.items[t]);this.items.length=0;var i=this.el_.querySelector(".vjs-playlist-ad-overlay");i&&i.parentNode.removeChild(i);for(var n=0;n<e.length;n++){var s=new j(this.player_,{item:e[n]},this.options_);this.items.push(s),this.addChild(s)}(i=c.createElement("li")).className="vjs-playlist-ad-overlay",this.el_.appendChild(i);var l=this.player_.playlist.currentItem();if(this.items.length&&l>=0){v(this.items[l]);var a=this.items[l].$(".vjs-playlist-thumbnail");a&&h.addClass(a,"vjs-playlist-now-playing")}},l.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 s=this.items[n];n===i?(v(s),c.activeElement!==s.el()&&h.addClass(s.thumbnail,"vjs-playlist-now-playing")):C(s)}},l}(_),g=function(t){var i=this,n=void 0,s=void 0;if(!i.playlist)throw new Error("videojs-playlist is required for the playlist component");"undefined"!=typeof u.HTMLElement&&t instanceof u.HTMLElement||t&&1===t.nodeType?(s=t,n=e.mergeOptions(f)):(n=e.mergeOptions(f,t),s=c.querySelector("."+n.className)),n.el=s,i.playlistMenu=new b(i,n)};e.registerComponent("PlaylistMenu",b),e.registerComponent("PlaylistMenuItem",j),m("playlistUi",g)});
{
"name": "videojs-playlist-ui",
"version": "2.3.3",
"author": "Brightcove",
"version": "2.3.4",
"author": "Brightcove, Inc.",
"description": "A playlist video picker for video.js",
"main": "es5/videojs-playlist-ui.js",
"main": "dist/videojs-playlist-ui.cjs.js",
"module": "dist/videojs-playlist-ui.es.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.vertical.css --banner=scripts/banner.ejs",
"build:css:sass": "node-sass src/plugin.scss dist/videojs-playlist-ui.vertical.css --output-style=compressed --linefeed=lf",
"build:js": "npm-run-all build:js:rollup-modules build:js:rollup-umd build:js:bannerize build:js:uglify",
"build:js:bannerize": "bannerize dist/videojs-playlist-ui.js --banner=scripts/banner.ejs",
"build:js:rollup-modules": "rollup -c scripts/modules.rollup.config.js",
"build:js:rollup-umd": "rollup -c scripts/umd.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.vertical.css --output-style=compressed --linefeed=lf --watch src/**/*.scss",
"watch:js-modules": "rollup -c scripts/modules.rollup.config.js -w",
"watch:js-umd": "rollup -c scripts/umd.rollup.config.js -w",
"watch:test": "rollup -c scripts/test.rollup.config.js -w",
"prepublish": "npm run build",
"prepush": "npm run lint"
},

@@ -22,38 +49,62 @@ "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-json": "^2.1.1",
"rollup-plugin-multi-entry": "^2.0.1",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-watch": "^3.2.2",
"semver": "^5.3.0",
"sinon": "^2.2.0",
"uglify-js": "^3.0.7",
"videojs-playlist": "^3.0.0",
"videojs-standard": "^6.0.0"
},
"browserify-shim": {
"video.js": "global:videojs"
}
"generator-videojs-plugin": {
"version": "5.0.0"
},
"vjsstandard": {
"ignore": [
"dist",
"docs",
"test/dist",
"test/karma.conf.js"
]
},
"files": [
"CONTRIBUTING.md",
"dist/",
"docs/",
"index.html",
"scripts/",
"src/",
"test/"
]
}

Sorry, the diff of this file is not supported yet

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