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

videojs-playlist-ui

Package Overview
Dependencies
Maintainers
55
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.4.2 to 3.5.0

7

CHANGELOG.md

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

<a name="3.5.0"></a>
# [3.5.0](https://github.com/brightcove/videojs-playlist-ui/compare/v3.4.2...v3.5.0) (2018-08-20)
### Features
* set dataset attributes on playlist items when they have a data object ([#68](https://github.com/brightcove/videojs-playlist-ui/issues/68)) ([e16f2dd](https://github.com/brightcove/videojs-playlist-ui/commit/e16f2dd))
<a name="3.4.2"></a>

@@ -2,0 +9,0 @@ ## [3.4.2](https://github.com/brightcove/videojs-playlist-ui/compare/v3.4.1...v3.4.2) (2018-08-03)

20

dist/videojs-playlist-ui.cjs.js

@@ -1,2 +0,2 @@

/*! @name videojs-playlist-ui @version 3.4.2 @license Apache-2.0 */
/*! @name videojs-playlist-ui @version 3.5.0 @license Apache-2.0 */
'use strict';

@@ -9,4 +9,10 @@

var version = "3.4.2";
var version = "3.5.0";
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;
};
var classCallCheck = function (instance, Constructor) {

@@ -183,2 +189,12 @@ if (!(instance instanceof Constructor)) {

if (_typeof(item.data) === 'object') {
var dataKeys = Object.keys(item.data);
dataKeys.forEach(function (key) {
var value = item.data[key];
li.dataset[key] = value;
});
}
li.className = 'vjs-playlist-item';

@@ -185,0 +201,0 @@ li.setAttribute('tabIndex', 0);

@@ -1,7 +0,13 @@

/*! @name videojs-playlist-ui @version 3.4.2 @license Apache-2.0 */
/*! @name videojs-playlist-ui @version 3.5.0 @license Apache-2.0 */
import document from 'global/document';
import videojs from 'video.js';
var version = "3.4.2";
var version = "3.5.0";
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;
};
var classCallCheck = function (instance, Constructor) {

@@ -178,2 +184,12 @@ if (!(instance instanceof Constructor)) {

if (_typeof(item.data) === 'object') {
var dataKeys = Object.keys(item.data);
dataKeys.forEach(function (key) {
var value = item.data[key];
li.dataset[key] = value;
});
}
li.className = 'vjs-playlist-item';

@@ -180,0 +196,0 @@ li.setAttribute('tabIndex', 0);

@@ -1,2 +0,2 @@

/*! @name videojs-playlist-ui @version 3.4.2 @license Apache-2.0 */
/*! @name videojs-playlist-ui @version 3.5.0 @license Apache-2.0 */
(function (global, factory) {

@@ -11,4 +11,10 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('global/document'), require('video.js')) :

var version = "3.4.2";
var version = "3.5.0";
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;
};
var classCallCheck = function (instance, Constructor) {

@@ -185,2 +191,12 @@ if (!(instance instanceof Constructor)) {

if (_typeof(item.data) === 'object') {
var dataKeys = Object.keys(item.data);
dataKeys.forEach(function (key) {
var value = item.data[key];
li.dataset[key] = value;
});
}
li.className = 'vjs-playlist-item';

@@ -187,0 +203,0 @@ li.setAttribute('tabIndex', 0);

4

dist/videojs-playlist-ui.min.js

@@ -1,2 +0,2 @@

/*! @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.5.0 @license Apache-2.0 */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("global/document"),require("video.js")):"function"==typeof define&&define.amd?define(["global/document","video.js"],e):t.videojsPlaylistUi=e(t.document,t.videojs)}(this,function(t,e){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t,e=e&&e.hasOwnProperty("default")?e.default:e;var i,l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},s=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},r=e.dom||e,o=e.registerPlugin||e.plugin,p={className:"vjs-playlist",playOnSelect:!1,supportsCssPointerEvents:((i=t.createElement("x")).style.cssText="pointer-events:auto","auto"===i.style.pointerEvents)},c=function(t){t.addClass("vjs-selected")},u=function(t){t.removeClass("vjs-selected"),t.thumbnail&&r.removeClass(t.thumbnail,"vjs-playlist-now-playing")},d=function(t){t.removeClass("vjs-up-next")},h=e.getComponent("Component"),y=function(i){function r(t,e,l){if(a(this,r),!e.item)throw new Error("Cannot construct a PlaylistMenuItem without an item option");var s=n(this,i.call(this,t,e));return s.item=e.item,s.playOnSelect=l.playOnSelect,s.emitTapEvents(),s.on(["click","tap"],s.switchPlaylistItem_),s.on("keydown",s.handleKeyDown_),s}return s(r,i),r.prototype.handleKeyDown_=function(t){13!==t.which&&32!==t.which||this.switchPlaylistItem_()},r.prototype.switchPlaylistItem_=function(t){this.player_.playlist.currentItem(function(t,e){for(var i=0,l=t.length;i<l;i++)if(t[i]===e)return i;return-1}(this.player_.playlist(),this.item)),this.playOnSelect&&this.player_.play()},r.prototype.createEl=function(){var i=t.createElement("li"),a=this.options_.item;"object"===l(a.data)&&Object.keys(a.data).forEach(function(t){var e=a.data[t];i.dataset[t]=e});if(i.className="vjs-playlist-item",i.setAttribute("tabIndex",0),this.thumbnail=function(e){if(!e){var i=t.createElement("div");return i.className="vjs-playlist-thumbnail vjs-playlist-thumbnail-placeholder",i}var l=t.createElement("picture");if(l.className="vjs-playlist-thumbnail","string"==typeof e){var a=t.createElement("img");a.src=e,a.alt="",l.appendChild(a)}else{for(var s=0;s<e.length-1;s++){var n=e[s],r=t.createElement("source");for(var o in n)r[o]=n[o];l.appendChild(r)}var p=e[e.length-1],c=t.createElement("img");for(var u in c.alt="",p)c[u]=p[u];l.appendChild(c)}return l}(a.thumbnail),i.appendChild(this.thumbnail),a.duration){var s=t.createElement("time"),n=e.formatTime(a.duration);s.className="vjs-playlist-duration",s.setAttribute("datetime","PT0H0M"+a.duration+"S"),s.appendChild(t.createTextNode(n)),i.appendChild(s)}var r=t.createElement("span"),o=this.localize("Now Playing");r.className="vjs-playlist-now-playing-text",r.appendChild(t.createTextNode(o)),r.setAttribute("title",o),this.thumbnail.appendChild(r);var p=t.createElement("div");p.className="vjs-playlist-title-container",this.thumbnail.appendChild(p);var c=t.createElement("span"),u=this.localize("Up Next");c.className="vjs-up-next-text",c.appendChild(t.createTextNode(u)),c.setAttribute("title",u),p.appendChild(c);var d=t.createElement("cite"),h=a.name||this.localize("Untitled Video");return d.className="vjs-playlist-name",d.appendChild(t.createTextNode(h)),d.setAttribute("title",h),p.appendChild(d),i},r}(h),m=function(i){function l(t,s){if(a(this,l),!t.playlist)throw new Error("videojs-playlist is required for the playlist component");var r=n(this,i.call(this,t,s));return r.items=[],s.horizontal?r.addClass("vjs-playlist-horizontal"):r.addClass("vjs-playlist-vertical"),s.supportsCssPointerEvents&&r.addClass("vjs-csspointerevents"),r.createPlaylist_(),e.browser.TOUCH_ENABLED||r.addClass("vjs-mouse"),t.on(["loadstart","playlistchange","playlistsorted"],function(t){r.update()}),t.on("adstart",function(){r.addClass("vjs-ad-playing")}),t.on("adend",function(){r.removeClass("vjs-ad-playing")}),r}return s(l,i),l.prototype.createEl=function(){return r.createEl("div",{className:this.options_.className})},l.prototype.createPlaylist_=function(){var e=this.player_.playlist()||[],i=this.el_.querySelector(".vjs-playlist-item-list"),l=this.el_.querySelector(".vjs-playlist-ad-overlay");i||((i=t.createElement("ol")).className="vjs-playlist-item-list",this.el_.appendChild(i));for(var a=0;a<this.items.length;a++)i.removeChild(this.items[a].el_);this.items.length=0;for(var s=0;s<e.length;s++){var n=new y(this.player_,{item:e[s]},this.options_);this.items.push(n),i.appendChild(n.el_)}l?i.appendChild(l):((l=t.createElement("li")).className="vjs-playlist-ad-overlay",i.appendChild(l));var o=this.player_.playlist.currentItem();if(this.items.length&&o>=0){c(this.items[o]);var p=this.items[o].$(".vjs-playlist-thumbnail");p&&r.addClass(p,"vjs-playlist-now-playing")}},l.prototype.update=function(){var e=this.player_.playlist();if(this.items.length===e.length){for(var i=0;i<this.items.length;i++)if(this.items[i].item!==e[i])return void this.createPlaylist_();for(var l=this.player_.playlist.currentItem(),a=0;a<this.items.length;a++){var s=this.items[a];a===l?(c(s),t.activeElement!==s.el()&&r.addClass(s.thumbnail,"vjs-playlist-now-playing"),d(s)):a===l+1?(u(s),s.addClass("vjs-up-next")):(u(s),d(s))}}else this.createPlaylist_()},l}(h),f=function(t){for(var e=0;e<t.childNodes.length;e++)if(r.isEl(t.childNodes[e]))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(r.isEl(i)&&(e.log.warn('videojs-playlist-ui: Passing an element directly to playlistUi() is deprecated, use the "el" option instead!'),i={el:i}),i=e.mergeOptions(p,i),this.playlistMenu){var l=this.playlistMenu.el();if(l){var a=l.parentNode,s=l.nextSibling;this.playlistMenu.dispose(),r.emptyEl(l),s?a.insertBefore(l,s):a.appendChild(l),i.el=l}}r.isEl(i.el)||(i.el=function(e){for(var i=t.querySelectorAll("."+e),l=void 0,a=0;a<i.length;a++)if(!f(i[a])){l=i[a];break}return l}(i.className)),this.playlistMenu=new m(this,i)};return e.registerComponent("PlaylistMenu",m),e.registerComponent("PlaylistMenuItem",y),o("playlistUi",v),v.VERSION="3.5.0",v});
{
"name": "videojs-playlist-ui",
"version": "3.4.2",
"version": "3.5.0",
"author": "Brightcove, Inc.",

@@ -5,0 +5,0 @@ "description": "A user interface for the videojs-playlist API",

@@ -141,2 +141,12 @@ import document from 'global/document';

if (typeof item.data === 'object') {
const dataKeys = Object.keys(item.data);
dataKeys.forEach(key => {
const value = item.data[key];
li.dataset[key] = value;
});
}
li.className = 'vjs-playlist-item';

@@ -143,0 +153,0 @@ li.setAttribute('tabIndex', 0);

@@ -1,2 +0,2 @@

/*! @name videojs-playlist-ui @version 3.4.2 @license Apache-2.0 */
/*! @name videojs-playlist-ui @version 3.5.0 @license Apache-2.0 */
(function (videojs,QUnit) {

@@ -813,4 +813,10 @@ 'use strict';

var version$1 = "3.4.2";
var version$1 = "3.5.0";
var _typeof$1 = 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;
};
var classCallCheck = function (instance, Constructor) {

@@ -987,2 +993,12 @@ if (!(instance instanceof Constructor)) {

if (_typeof$1(item.data) === 'object') {
var dataKeys = Object.keys(item.data);
dataKeys.forEach(function (key) {
var value = item.data[key];
li.dataset[key] = value;
});
}
li.className = 'vjs-playlist-item';

@@ -1315,2 +1331,4 @@ li.setAttribute('tabIndex', 0);

/* eslint-disable no-console */
var playlist = [{

@@ -1320,2 +1338,6 @@ name: 'Movie 1',

duration: 100,
data: {
id: '1',
foo: 'bar'
},
sources: [{

@@ -1493,2 +1515,14 @@ src: '//example.com/movie1.mp4',

QUnit.test('includes custom data attribute if provided', function (assert) {
this.player.playlist(playlist);
this.player.playlistUi();
var items = this.fixture.querySelectorAll('.vjs-playlist-item');
assert.strictEqual(items[0].dataset.id, playlist[0].data.id, 'set a single data attribute');
assert.strictEqual(items[0].dataset.id, '1', 'set a single data attribute (actual value)');
assert.strictEqual(items[0].dataset.foo, playlist[0].data.foo, 'set an addtional data attribute');
assert.strictEqual(items[0].dataset.foo, 'bar', 'set an addtional data attribute');
});
QUnit.test('outputs a <picture> for simple thumbnails', function (assert) {

@@ -1495,0 +1529,0 @@ this.player.playlist(playlist);

@@ -0,1 +1,2 @@

/* eslint-disable no-console */
import document from 'global/document';

@@ -13,2 +14,6 @@ import window from 'global/window';

duration: 100,
data: {
id: '1',
foo: 'bar'
},
sources: [{

@@ -210,2 +215,22 @@ src: '//example.com/movie1.mp4',

QUnit.test('includes custom data attribute if provided', function(assert) {
this.player.playlist(playlist);
this.player.playlistUi();
const items = this.fixture.querySelectorAll('.vjs-playlist-item');
assert.strictEqual(items[0].dataset.id,
playlist[0].data.id,
'set a single data attribute');
assert.strictEqual(items[0].dataset.id,
'1',
'set a single data attribute (actual value)');
assert.strictEqual(items[0].dataset.foo,
playlist[0].data.foo,
'set an addtional data attribute');
assert.strictEqual(items[0].dataset.foo,
'bar',
'set an addtional data attribute');
});
QUnit.test('outputs a <picture> for simple thumbnails', function(assert) {

@@ -212,0 +237,0 @@ this.player.playlist(playlist);

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