- 1 :
/**
- 2 :
* @file subs-caps-menu-item.js
- 3 :
*/
- 4 :
import TextTrackMenuItem from './text-track-menu-item.js';
- 5 :
import Component from '../../component.js';
- 6 :
import {createEl} from '../../utils/dom.js';
- 7 :
- 8 :
/**
- 9 :
* SubsCapsMenuItem has an [cc] icon to distinguish captions from subtitles
- 10 :
* in the SubsCapsMenu.
- 11 :
*
- 12 :
* @extends TextTrackMenuItem
- 13 :
*/
- 14 :
class SubsCapsMenuItem extends TextTrackMenuItem {
- 15 :
- 16 :
createEl(type, props, attrs) {
- 17 :
const el = super.createEl(type, props, attrs);
- 18 :
const parentSpan = el.querySelector('.vjs-menu-item-text');
- 19 :
- 20 :
if (this.options_.track.kind === 'captions') {
- 21 :
parentSpan.appendChild(createEl('span', {
- 22 :
className: 'vjs-icon-placeholder'
- 23 :
}, {
- 24 :
'aria-hidden': true
- 25 :
}));
- 26 :
parentSpan.appendChild(createEl('span', {
- 27 :
className: 'vjs-control-text',
- 28 :
// space added as the text will visually flow with the
- 29 :
// label
- 30 :
textContent: ` ${this.localize('Captions')}`
- 31 :
}));
- 32 :
}
- 33 :
- 34 :
return el;
- 35 :
}
- 36 :
}
- 37 :
- 38 :
Component.registerComponent('SubsCapsMenuItem', SubsCapsMenuItem);
- 39 :
export default SubsCapsMenuItem;