demo/dist/demo.js
function setCaptionsMenu() {
	    var _this7 = this;

	    // Menu required
	    if (!is$1.element(this.elements.settings.panels.captions)) {
	      return;
	    } // TODO: Captions or language? Currently it's mixed


	    var type = 'captions';
	    var list = this.elements.settings.panels.captions.querySelector('[role="menu"]');
	    var tracks = captions.getTracks.call(this);
	    var toggle = Boolean(tracks.length); // Toggle the pane and tab

	    controls.toggleMenuButton.call(this, type, toggle); // Empty the menu

	    emptyElement(list); // Check if we need to toggle the parent

	    controls.checkMenu.call(this); // If there's no captions, bail

	    if (!toggle) {
	      return;
	    } // Generate options data


	    var options = tracks.map(function (track, value) {
	      return {
	        value: value,
	        checked: _this7.captions.toggled && _this7.currentTrack === value,
	        title: captions.getLabel.call(_this7, track),
	        badge: track.language && controls.createBadge.call(_this7, track.language.toUpperCase()),
	        list: list,
	        type: 'language'
	      };
	    }); // Add the "Disabled" option to turn off captions

	    options.unshift({
	      value: -1,
	      checked: !this.captions.toggled,
	      title: i18n.get('disabled', this.config),
	      list: list,
	      type: 'language'
	    }); // Generate options

	    options.forEach(controls.createMenuItem.bind(this));
	    controls.updateSetting.call(this, type, list);
	  }
function setCaptionsMenu() {
	    var _this7 = this;

	    // Menu required
	    if (!is$1.element(this.elements.settings.panels.captions)) {
	      return;
	    } // TODO: Captions or language? Currently it's mixed


	    var type = 'captions';
	    var list = this.elements.settings.panels.captions.querySelector('[role="menu"]');
	    var tracks = captions.getTracks.call(this);
	    var toggle = Boolean(tracks.length); // Toggle the pane and tab

	    controls.toggleMenuButton.call(this, type, toggle); // Empty the menu

	    emptyElement(list); // Check if we need to toggle the parent

	    controls.checkMenu.call(this); // If there's no captions, bail

	    if (!toggle) {
	      return;
	    } // Generate options data


	    var options = tracks.map(function (track, value) {
	      return {
	        value: value,
	        checked: _this7.captions.toggled && _this7.currentTrack === value,
	        title: captions.getLabel.call(_this7, track),
	        badge: track.language && controls.createBadge.call(_this7, track.language.toUpperCase()),
	        list: list,
	        type: 'language'
	      };
	    }); // Add the "Disabled" option to turn off captions

	    options.unshift({
	      value: -1,
	      checked: !this.captions.toggled,
	      title: i18n.get('disabled', this.config),
	      list: list,
	      type: 'language'
	    }); // Generate options

	    options.forEach(controls.createMenuItem.bind(this));
	    controls.updateSetting.call(this, type, list);
	  }
function setCaptionsMenu ( ) { var _this7 = this ; // Menu required if ( ! is$1 . element ( this . elements . settings . panels . captions ) ) { return ; } // TODO: Captions or language? Currently it's mixed var type = 'captions' ; var list = this . elements . settings . panels . captions . querySelector ( '[role="menu"]' ) ; var tracks = captions . getTracks . call ( this ) ; var toggle = Boolean ( tracks . length ) ; // Toggle the pane and tab controls . toggleMenuButton . call ( this , type , toggle ) ; // Empty the menu emptyElement ( list ) ; // Check if we need to toggle the parent controls . checkMenu . call ( this ) ; // If there's no captions, bail if ( ! toggle ) { return ; } // Generate options data var options = tracks . map ( function ( track , value ) { return { value : value , checked : _this7 . captions . toggled && _this7 . currentTrack === value , title : captions . getLabel . call ( _this7 , track ) , badge : track . language && controls . createBadge . call ( _this7 , track . language . toUpperCase ( ) ) , list : list , type : 'language' } ; } ) ; // Add the "Disabled" option to turn off captions options . unshift ( { value : - 1 , checked : ! this . captions . toggled , title : i18n . get ( 'disabled' , this . config ) , list : list , type : 'language' } ) ; // Generate options options . forEach ( controls . createMenuItem . bind ( this ) ) ; controls . updateSetting . call ( this , type , list ) ; }
/* setLoopMenu() {
Menu required
if (!is.element(this.elements.settings.panels.loop)) {
return;
}
const options = ['start', 'end', 'all', 'reset'];
const list = this.elements.settings.panels.loop.querySelector('[role="menu"]');
Show the pane and tab
toggleHidden(this.elements.settings.buttons.loop, false);
toggleHidden(this.elements.settings.panels.loop, false);
Toggle the pane and tab
const toggle = !is.empty(this.loop.options);
controls.toggleMenuButton.call(this, 'loop', toggle);
Empty the menu
emptyElement(list);
options.forEach(option => {
const item = createElement('li');
const button = createElement(
'button',
extend(getAttributesFromSelector(this.config.selectors.buttons.loop), {
type: 'button',
class: this.config.classNames.control,
'data-plyr-loop-action': option,
}),
i18n.get(option, this.config)
);
if (['start', 'end'].includes(option)) {
const badge = controls.createBadge.call(this, '00:00');
button.appendChild(badge);
}
item.appendChild(button);
list.appendChild(item);
});
}, Get current selected caption language TODO: rework this to user the getter in the API? Set a list of available captions languages
/ * setLoopMenu () { Menu required if ( !is . element ( this . elements . settings . panels . loop )) { return ; } const options = [ start end all reset ] ; const list = this . elements . settings . panels . loop . querySelector ( [ role = menu ] ) ; Show the pane and tab toggleHidden ( this . elements . settings . buttons . loop false ) ; toggleHidden ( this . elements . settings . panels . loop false ) ; Toggle the pane and tab const toggle = !is . empty ( this . loop . options ) ; controls . toggleMenuButton . call ( this loop toggle ) ; Empty the menu emptyElement ( list ) ; options . forEach ( option = > { const item = createElement ( li ) ; const button = createElement ( button extend ( getAttributesFromSelector ( this . config . selectors . buttons . loop ) { type : button class : this . config . classNames . control data - plyr - loop - action : option } ) i18n . get ( option this . config ) ) ; if ( [ start end ] . includes ( option )) { const badge = controls . createBadge . call ( this 00 : 00 ) ; button . appendChild ( badge ) ; } item . appendChild ( button ) ; list . appendChild ( item ) ; } ) ; } Get current selected caption language TODO : rework this to user the getter in the API? Set a list of available captions languages