diff options
author | Sam Potts <sam@potts.es> | 2018-03-27 23:43:38 +1100 |
---|---|---|
committer | Sam Potts <sam@potts.es> | 2018-03-27 23:43:38 +1100 |
commit | 7b1e4abda7058c602c6d542ea2e12f0cba4fa332 (patch) | |
tree | ecc9c4c5b5a3468fe29d6ea054085ac4440d7b46 /src/js/controls.js | |
parent | 0cf75eed3f8ec982300b2abdfd0347f638f83205 (diff) | |
download | plyr-7b1e4abda7058c602c6d542ea2e12f0cba4fa332.tar.lz plyr-7b1e4abda7058c602c6d542ea2e12f0cba4fa332.tar.xz plyr-7b1e4abda7058c602c6d542ea2e12f0cba4fa332.zip |
Controls fixes
Diffstat (limited to 'src/js/controls.js')
-rw-r--r-- | src/js/controls.js | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/js/controls.js b/src/js/controls.js index 295a2eef..c4cc7531 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -384,6 +384,16 @@ const controls = { const clientRect = this.elements.inputs.seek.getBoundingClientRect(); const visible = `${this.config.classNames.tooltip}--visible`; + const toggle = toggle => { + utils.toggleClass(this.elements.display.seekTooltip, visible, toggle); + }; + + // Hide on touch + if (this.touch) { + toggle(false); + return; + } + // Determine percentage, if already visible if (utils.is.event(event)) { percent = 100 / clientRect.width * (event.pageX - clientRect.left); @@ -412,7 +422,7 @@ const controls = { 'mouseenter', 'mouseleave', ].includes(event.type)) { - utils.toggleClass(this.elements.display.seekTooltip, visible, event.type === 'mouseenter'); + toggle(event.type === 'mouseenter'); } }, @@ -541,7 +551,7 @@ const controls = { switch (setting) { case 'captions': - value = this.captions.active ? this.captions.language : ''; + value = this.captions.active ? this.captions.language : i18n.get('disabled', this.config); break; default: @@ -638,11 +648,7 @@ const controls = { return null; } - if (!support.textTracks || !captions.getTracks.call(this).length) { - return i18n.get('none', this.config); - } - - if (this.captions.active) { + if (support.textTracks && captions.getTracks.call(this).length && this.captions.active) { const currentTrack = captions.getCurrentTrack.call(this); if (utils.is.track(currentTrack)) { @@ -677,10 +683,10 @@ const controls = { label: !utils.is.empty(track.label) ? track.label : track.language.toUpperCase(), })); - // Add the "None" option to turn off captions + // Add the "Disabled" option to turn off captions tracks.unshift({ language: '', - label: i18n.get('none', this.config), + label: i18n.get('disabled', this.config), }); // Generate options |