From 3c1ba2397b66656c1208c19da93c31b42808c0be Mon Sep 17 00:00:00 2001 From: taylorchu Date: Tue, 28 Apr 2020 15:24:23 -0700 Subject: [PATCH] allow custom control as element --- src/js/controls.js | 6 ++---- src/js/plyr.js | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/js/controls.js b/src/js/controls.js index 5bdb5b0a..ad126de1 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -1263,7 +1263,7 @@ const controls = { this.elements.controls = null; // Larger overlaid play button - if (this.config.controls.includes('play-large')) { + if (is.array(this.config.controls) && this.config.controls.includes('play-large')) { this.elements.container.appendChild(createButton.call(this, 'play-large')); } @@ -1275,7 +1275,7 @@ const controls = { const defaultAttributes = { class: 'plyr__controls__item' }; // Loop through controls in order - dedupe(this.config.controls).forEach(control => { + dedupe(is.array(this.config.controls) ? this.config.controls: []).forEach(control => { // Restart button if (control === 'restart') { container.appendChild(createButton.call(this, 'restart', defaultAttributes)); @@ -1675,8 +1675,6 @@ const controls = { if (update) { if (is.string(this.config.controls)) { container = replace(container); - } else if (is.element(container)) { - container.innerHTML = replace(container.innerHTML); } } diff --git a/src/js/plyr.js b/src/js/plyr.js index a3bdb285..908d8d2c 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -1054,7 +1054,7 @@ class Plyr { const hiding = toggleClass(this.elements.container, this.config.classNames.hideControls, force); // Close menu - if (hiding && this.config.controls.includes('settings') && !is.empty(this.config.settings)) { + if (hiding && is.array(this.config.controls) && this.config.controls.includes('settings') && !is.empty(this.config.settings)) { controls.toggleMenu.call(this, false); }