aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/utils
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2020-01-30 14:23:40 +0000
committerGitHub <noreply@github.com>2020-01-30 14:23:40 +0000
commit58f5380694993891892e4e24ba0904434892e538 (patch)
tree4de3d7b46d33192a43a0b40c3f3a9a5f90f9b071 /src/js/utils
parent9d512911252cf4835c2b7364cb4ae392cb277a1d (diff)
parentfefcca78052174dce73f8dfe7df5b264edb0653a (diff)
downloadplyr-58f5380694993891892e4e24ba0904434892e538.tar.lz
plyr-58f5380694993891892e4e24ba0904434892e538.tar.xz
plyr-58f5380694993891892e4e24ba0904434892e538.zip
Merge pull request #1662 from sampotts/develop
3.5.7
Diffstat (limited to 'src/js/utils')
-rw-r--r--src/js/utils/events.js4
-rw-r--r--src/js/utils/style.js5
-rw-r--r--src/js/utils/time.js2
3 files changed, 5 insertions, 6 deletions
diff --git a/src/js/utils/events.js b/src/js/utils/events.js
index 87c35d26..31571b2d 100644
--- a/src/js/utils/events.js
+++ b/src/js/utils/events.js
@@ -90,9 +90,7 @@ export function triggerEvent(element, type = '', bubbles = false, detail = {}) {
// Create and dispatch the event
const event = new CustomEvent(type, {
bubbles,
- detail: Object.assign({}, detail, {
- plyr: this,
- }),
+ detail: { ...detail, plyr: this,},
});
// Dispatch the event
diff --git a/src/js/utils/style.js b/src/js/utils/style.js
index 941db8f2..17a033fe 100644
--- a/src/js/utils/style.js
+++ b/src/js/utils/style.js
@@ -56,11 +56,12 @@ export function setAspectRatio(input) {
return {};
}
+ const { wrapper } = this.elements;
const ratio = getAspectRatio.call(this, input);
const [w, h] = is.array(ratio) ? ratio : [0, 0];
const padding = (100 / w) * h;
- this.elements.wrapper.style.paddingBottom = `${padding}%`;
+ wrapper.style.paddingBottom = `${padding}%`;
// For Vimeo we have an extra <div> to hide the standard controls and UI
if (this.isVimeo && this.supported.ui) {
@@ -68,7 +69,7 @@ export function setAspectRatio(input) {
const offset = (height - padding) / (height / 50);
this.media.style.transform = `translateY(-${offset}%)`;
} else if (this.isHTML5) {
- this.elements.wrapper.classList.toggle(this.config.classNames.videoFixedRatio, ratio !== null);
+ wrapper.classList.toggle(this.config.classNames.videoFixedRatio, ratio !== null);
}
return { padding, ratio };
diff --git a/src/js/utils/time.js b/src/js/utils/time.js
index ffca88b2..17228de5 100644
--- a/src/js/utils/time.js
+++ b/src/js/utils/time.js
@@ -13,7 +13,7 @@ export const getSeconds = value => Math.trunc(value % 60, 10);
export function formatTime(time = 0, displayHours = false, inverted = false) {
// Bail if the value isn't a number
if (!is.number(time)) {
- return formatTime(null, displayHours, inverted);
+ return formatTime(undefined, displayHours, inverted);
}
// Format time component to add leading zero