aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlbin Larsson <mail@albinlarsson.com>2018-06-15 17:06:36 +0200
committerAlbin Larsson <mail@albinlarsson.com>2018-06-16 07:27:04 +0200
commit99c10aa1fc2010c659a412568096ee24900f0eac (patch)
treecb823756be086db5c220ceb1045b75540b62a4ca /src
parent2a186e425bd83bddea65247d1352cc7b0114fab0 (diff)
downloadplyr-99c10aa1fc2010c659a412568096ee24900f0eac.tar.lz
plyr-99c10aa1fc2010c659a412568096ee24900f0eac.tar.xz
plyr-99c10aa1fc2010c659a412568096ee24900f0eac.zip
Replace switch in controls.createProgress with object literal
Diffstat (limited to 'src')
-rw-r--r--src/js/controls.js17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/js/controls.js b/src/js/controls.js
index 1cbaa752..19c531af 100644
--- a/src/js/controls.js
+++ b/src/js/controls.js
@@ -331,19 +331,12 @@ const controls = {
if (type !== 'volume') {
progress.appendChild(createElement('span', null, '0'));
- let suffix = '';
- switch (type) {
- case 'played':
- suffix = i18n.get('played', this.config);
- break;
-
- case 'buffer':
- suffix = i18n.get('buffered', this.config);
- break;
+ const suffixKey = ({
+ played: 'played',
+ buffer: 'buffered',
+ })[type];
- default:
- break;
- }
+ const suffix = suffixKey ? i18n.get(suffixKey, this.config) : '';
progress.innerText = `% ${suffix.toLowerCase()}`;
}