Replace switch in controls.createLabel with object literal
This commit is contained in:
parent
88735e3146
commit
2d6732d580
31
src/js/controls.js
vendored
31
src/js/controls.js
vendored
@ -119,28 +119,17 @@ const controls = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Create hidden text label
|
// Create hidden text label
|
||||||
createLabel(type, attr) {
|
createLabel(type, attr = {}) {
|
||||||
let text = i18n.get(type, this.config);
|
// Skip i18n for abbreviations and brand names
|
||||||
const attributes = Object.assign({}, attr);
|
const universals = {
|
||||||
|
pip: 'PIP',
|
||||||
|
airplay: 'AirPlay',
|
||||||
|
};
|
||||||
|
|
||||||
switch (type) {
|
const text = universals[type] || i18n.get(type, this.config);
|
||||||
case 'pip':
|
const attributes = Object.assign({}, attr, {
|
||||||
text = 'PIP';
|
class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' '),
|
||||||
break;
|
});
|
||||||
|
|
||||||
case 'airplay':
|
|
||||||
text = 'AirPlay';
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('class' in attributes) {
|
|
||||||
attributes.class += ` ${this.config.classNames.hidden}`;
|
|
||||||
} else {
|
|
||||||
attributes.class = this.config.classNames.hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
return createElement('span', attributes, text);
|
return createElement('span', attributes, text);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user