From 0694e586502f7ce85ce7858b67d515403b48c87e Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Thu, 25 Apr 2019 12:14:48 +1000 Subject: v3.5.4 --- dist/plyr.js | 895 +++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 507 insertions(+), 388 deletions(-) (limited to 'dist/plyr.js') diff --git a/dist/plyr.js b/dist/plyr.js index 11c69184..9e7a047a 100644 --- a/dist/plyr.js +++ b/dist/plyr.js @@ -686,6 +686,47 @@ typeof navigator === "object" && (function (global, factory) { }).then(function () {}); } + function cloneDeep(object) { + return JSON.parse(JSON.stringify(object)); + } // Get a nested value in an object + + function getDeep(object, path) { + return path.split('.').reduce(function (obj, key) { + return obj && obj[key]; + }, object); + } // Deep extend destination object with N more objects + + function extend() { + var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + sources[_key - 1] = arguments[_key]; + } + + if (!sources.length) { + return target; + } + + var source = sources.shift(); + + if (!is$1.object(source)) { + return target; + } + + Object.keys(source).forEach(function (key) { + if (is$1.object(source[key])) { + if (!Object.keys(target).includes(key)) { + Object.assign(target, _defineProperty({}, key, {})); + } + + extend(target[key], source[key]); + } else { + Object.assign(target, _defineProperty({}, key, source[key])); + } + }); + return extend.apply(void 0, [target].concat(sources)); + } + function wrap(elements, wrapper) { // Convert `elements` to an array, if necessary. var targets = elements.length ? elements : [elements]; // Loops backwards to prevent having to clone the wrapper on the @@ -809,7 +850,7 @@ typeof navigator === "object" && (function (global, factory) { } var attributes = {}; - var existing = existingAttributes; + var existing = extend({}, existingAttributes); sel.split(',').forEach(function (s) { // Remove whitespace var selector = s.trim(); @@ -817,7 +858,10 @@ typeof navigator === "object" && (function (global, factory) { var stripped = selector.replace(/[[\]]/g, ''); // Get the parts and value var parts = stripped.split('='); - var key = parts[0]; + + var _parts = _slicedToArray(parts, 1), + key = _parts[0]; + var value = parts.length > 1 ? parts[1].replace(/["']/g, '') : ''; // Get the first character var start = selector.charAt(0); @@ -825,11 +869,12 @@ typeof navigator === "object" && (function (global, factory) { switch (start) { case '.': // Add to existing classname - if (is$1.object(existing) && is$1.string(existing.class)) { - existing.class += " ".concat(className); + if (is$1.string(existing.class)) { + attributes.class = "".concat(existing.class, " ").concat(className); + } else { + attributes.class = className; } - attributes.class = className; break; case '#': @@ -846,7 +891,7 @@ typeof navigator === "object" && (function (global, factory) { break; } }); - return attributes; + return extend(existing, attributes); } // Toggle hidden function toggleHidden(element, hidden) { @@ -1142,8 +1187,16 @@ typeof navigator === "object" && (function (global, factory) { } // Get from embed - if (ratio === null && !is$1.empty(this.embed) && is$1.string(this.embed.ratio)) { - ratio = parse(this.embed.ratio); + if (ratio === null && !is$1.empty(this.embed) && is$1.array(this.embed.ratio)) { + ratio = this.embed.ratio; + } // Get from HTML5 video + + + if (ratio === null && this.isHTML5) { + var _this$media = this.media, + videoWidth = _this$media.videoWidth, + videoHeight = _this$media.videoHeight; + ratio = reduceAspectRatio([videoWidth, videoHeight]); } return ratio; @@ -1310,47 +1363,6 @@ typeof navigator === "object" && (function (global, factory) { }); } - function cloneDeep(object) { - return JSON.parse(JSON.stringify(object)); - } // Get a nested value in an object - - function getDeep(object, path) { - return path.split('.').reduce(function (obj, key) { - return obj && obj[key]; - }, object); - } // Deep extend destination object with N more objects - - function extend() { - var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - sources[_key - 1] = arguments[_key]; - } - - if (!sources.length) { - return target; - } - - var source = sources.shift(); - - if (!is$1.object(source)) { - return target; - } - - Object.keys(source).forEach(function (key) { - if (is$1.object(source[key])) { - if (!Object.keys(target).includes(key)) { - Object.assign(target, _defineProperty({}, key, {})); - } - - extend(target[key], source[key]); - } else { - Object.assign(target, _defineProperty({}, key, source[key])); - } - }); - return extend.apply(void 0, [target].concat(sources)); - } - // ========================================================================== function generateId(prefix) { @@ -1797,7 +1809,9 @@ typeof navigator === "object" && (function (global, factory) { }, // Create a