aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/plyr.js
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2018-05-31 23:39:51 +1000
committerGitHub <noreply@github.com>2018-05-31 23:39:51 +1000
commitfb22a90d33ad991e1f6de22f201c3b49f54168c1 (patch)
tree8cc30e7af53cd44f8cb5f035e16f9d6d9804cc39 /src/js/plyr.js
parentd70a787af19ece0b9eeeba60d947225c73ded291 (diff)
parent108bd3dfa078cf22c0446373830e86cba586919c (diff)
downloadplyr-fb22a90d33ad991e1f6de22f201c3b49f54168c1.tar.lz
plyr-fb22a90d33ad991e1f6de22f201c3b49f54168c1.tar.xz
plyr-fb22a90d33ad991e1f6de22f201c3b49f54168c1.zip
Merge pull request #993 from sampotts/develop
v3.3.10
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r--src/js/plyr.js23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js
index 4a064e09..cfce37c9 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -675,7 +675,7 @@ class Plyr {
quality = Number(input);
}
- if (!utils.is.number(quality) || quality === 0) {
+ if (!utils.is.number(quality)) {
quality = this.storage.get('quality');
}
@@ -838,24 +838,19 @@ class Plyr {
}
// If the method is called without parameter, toggle based on current value
- const show = utils.is.boolean(input) ? input : !this.elements.container.classList.contains(this.config.classNames.captions.active);
-
- // Nothing to change...
- if (this.captions.active === show) {
- return;
- }
-
- // Set global
- this.captions.active = show;
+ const active = utils.is.boolean(input) ? input : !this.elements.container.classList.contains(this.config.classNames.captions.active);
// Toggle state
- utils.toggleState(this.elements.buttons.captions, this.captions.active);
+ utils.toggleState(this.elements.buttons.captions, active);
// Add class hook
- utils.toggleClass(this.elements.container, this.config.classNames.captions.active, this.captions.active);
+ utils.toggleClass(this.elements.container, this.config.classNames.captions.active, active);
- // Trigger an event
- utils.dispatchEvent.call(this, this.media, this.captions.active ? 'captionsenabled' : 'captionsdisabled');
+ // Update state and trigger event
+ if (active !== this.captions.active) {
+ this.captions.active = active;
+ utils.dispatchEvent.call(this, this.media, this.captions.active ? 'captionsenabled' : 'captionsdisabled');
+ }
}
/**