aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/plyr.js
diff options
context:
space:
mode:
authorAlbin Larsson <mail@albinlarsson.com>2018-06-14 15:58:35 +0200
committerAlbin Larsson <mail@albinlarsson.com>2018-06-14 15:58:35 +0200
commitfa5d0ad3162151cb2ecd1737f42d81e18068db5e (patch)
treedbfacaec3f15d7c7d225dfb5c9dd3bc0ca0a79cb /src/js/plyr.js
parent019e1f80cad34cf40516cd9f039c5220717bf7d0 (diff)
downloadplyr-fa5d0ad3162151cb2ecd1737f42d81e18068db5e.tar.lz
plyr-fa5d0ad3162151cb2ecd1737f42d81e18068db5e.tar.xz
plyr-fa5d0ad3162151cb2ecd1737f42d81e18068db5e.zip
Move toggleCaption internals to captions object
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r--src/js/plyr.js22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js
index 543291e7..4b9697ce 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -19,7 +19,7 @@ import Storage from './storage';
import support from './support';
import ui from './ui';
import { closest } from './utils/arrays';
-import { createElement, hasClass, removeElement, replaceElement, toggleClass, toggleState, wrap } from './utils/elements';
+import { createElement, hasClass, removeElement, replaceElement, toggleClass, wrap } from './utils/elements';
import { off, on, once, triggerEvent, unbindListeners } from './utils/events';
import is from './utils/is';
import loadSprite from './utils/loadSprite';
@@ -833,25 +833,7 @@ class Plyr {
* @param {boolean} input - Whether to enable captions
*/
toggleCaptions(input) {
- // If there's no full support
- if (!this.supported.ui) {
- return;
- }
-
- // If the method is called without parameter, toggle based on current value
- const active = is.boolean(input) ? input : !this.elements.container.classList.contains(this.config.classNames.captions.active);
-
- // Toggle state
- toggleState(this.elements.buttons.captions, active);
-
- // Add class hook
- toggleClass(this.elements.container, this.config.classNames.captions.active, active);
-
- // Update state and trigger event
- if (active !== this.captions.active) {
- this.captions.active = active;
- triggerEvent.call(this, this.media, this.captions.active ? 'captionsenabled' : 'captionsdisabled');
- }
+ captions.toggle.call(this, input);
}
/**