demo/dist/demo.js
function setQualityMenu(options) {
	    var _this6 = this;

	    // Menu required
	    if (!is$1.element(this.elements.settings.panels.quality)) {
	      return;
	    }

	    var type = 'quality';
	    var list = this.elements.settings.panels.quality.querySelector('[role="menu"]'); // Set options if passed and filter based on uniqueness and config

	    if (is$1.array(options)) {
	      this.options.quality = dedupe(options).filter(function (quality) {
	        return _this6.config.quality.options.includes(quality);
	      });
	    } // Toggle the pane and tab


	    var toggle = !is$1.empty(this.options.quality) && this.options.quality.length > 1;
	    controls.toggleMenuButton.call(this, type, toggle); // Empty the menu

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

	    controls.checkMenu.call(this); // If we're hiding, nothing more to do

	    if (!toggle) {
	      return;
	    } // Get the badge HTML for HD, 4K etc


	    var getBadge = function getBadge(quality) {
	      var label = i18n.get("qualityBadge.".concat(quality), _this6.config);

	      if (!label.length) {
	        return null;
	      }

	      return controls.createBadge.call(_this6, label);
	    }; // Sort options by the config and then render options


	    this.options.quality.sort(function (a, b) {
	      var sorting = _this6.config.quality.options;
	      return sorting.indexOf(a) > sorting.indexOf(b) ? 1 : -1;
	    }).forEach(function (quality) {
	      controls.createMenuItem.call(_this6, {
	        value: quality,
	        list: list,
	        type: type,
	        title: controls.getLabel.call(_this6, 'quality', quality),
	        badge: getBadge(quality)
	      });
	    });
	    controls.updateSetting.call(this, type, list);
	  }
function setQualityMenu(options) {
	    var _this6 = this;

	    // Menu required
	    if (!is$1.element(this.elements.settings.panels.quality)) {
	      return;
	    }

	    var type = 'quality';
	    var list = this.elements.settings.panels.quality.querySelector('[role="menu"]'); // Set options if passed and filter based on uniqueness and config

	    if (is$1.array(options)) {
	      this.options.quality = dedupe(options).filter(function (quality) {
	        return _this6.config.quality.options.includes(quality);
	      });
	    } // Toggle the pane and tab


	    var toggle = !is$1.empty(this.options.quality) && this.options.quality.length > 1;
	    controls.toggleMenuButton.call(this, type, toggle); // Empty the menu

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

	    controls.checkMenu.call(this); // If we're hiding, nothing more to do

	    if (!toggle) {
	      return;
	    } // Get the badge HTML for HD, 4K etc


	    var getBadge = function getBadge(quality) {
	      var label = i18n.get("qualityBadge.".concat(quality), _this6.config);

	      if (!label.length) {
	        return null;
	      }

	      return controls.createBadge.call(_this6, label);
	    }; // Sort options by the config and then render options


	    this.options.quality.sort(function (a, b) {
	      var sorting = _this6.config.quality.options;
	      return sorting.indexOf(a) > sorting.indexOf(b) ? 1 : -1;
	    }).forEach(function (quality) {
	      controls.createMenuItem.call(_this6, {
	        value: quality,
	        list: list,
	        type: type,
	        title: controls.getLabel.call(_this6, 'quality', quality),
	        badge: getBadge(quality)
	      });
	    });
	    controls.updateSetting.call(this, type, list);
	  }
function setQualityMenu ( options ) { var _this6 = this ; // Menu required if ( ! is$1 . element ( this . elements . settings . panels . quality ) ) { return ; } var type = 'quality' ; var list = this . elements . settings . panels . quality . querySelector ( '[role="menu"]' ) ; // Set options if passed and filter based on uniqueness and config if ( is$1 . array ( options ) ) { this . options . quality = dedupe ( options ) . filter ( function ( quality ) { return _this6 . config . quality . options . includes ( quality ) ; } ) ; } // Toggle the pane and tab var toggle = ! is$1 . empty ( this . options . quality ) && this . options . quality . length > 1 ; controls . toggleMenuButton . call ( this , type , toggle ) ; // Empty the menu emptyElement ( list ) ; // Check if we need to toggle the parent controls . checkMenu . call ( this ) ; // If we're hiding, nothing more to do if ( ! toggle ) { return ; } // Get the badge HTML for HD, 4K etc var getBadge = function getBadge ( quality ) { var label = i18n . get ( "qualityBadge." . concat ( quality ) , _this6 . config ) ; if ( ! label . length ) { return null ; } return controls . createBadge . call ( _this6 , label ) ; } ; // Sort options by the config and then render options this . options . quality . sort ( function ( a , b ) { var sorting = _this6 . config . quality . options ; return sorting . indexOf ( a ) > sorting . indexOf ( b ) ? 1 : - 1 ; } ) . forEach ( function ( quality ) { controls . createMenuItem . call ( _this6 , { value : quality , list : list , type : type , title : controls . getLabel . call ( _this6 , 'quality' , quality ) , badge : getBadge ( quality ) } ) ; } ) ; controls . updateSetting . call ( this , type , list ) ; }
Set the quality menu
Set the quality menu