Replace switch in controls.createProgress with object literal
This commit is contained in:
parent
2a186e425b
commit
99c10aa1fc
17
src/js/controls.js
vendored
17
src/js/controls.js
vendored
@ -331,19 +331,12 @@ const controls = {
|
|||||||
if (type !== 'volume') {
|
if (type !== 'volume') {
|
||||||
progress.appendChild(createElement('span', null, '0'));
|
progress.appendChild(createElement('span', null, '0'));
|
||||||
|
|
||||||
let suffix = '';
|
const suffixKey = ({
|
||||||
switch (type) {
|
played: 'played',
|
||||||
case 'played':
|
buffer: 'buffered',
|
||||||
suffix = i18n.get('played', this.config);
|
})[type];
|
||||||
break;
|
|
||||||
|
|
||||||
case 'buffer':
|
const suffix = suffixKey ? i18n.get(suffixKey, this.config) : '';
|
||||||
suffix = i18n.get('buffered', this.config);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
progress.innerText = `% ${suffix.toLowerCase()}`;
|
progress.innerText = `% ${suffix.toLowerCase()}`;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user