3 exports.__esModule = true;
5 var _clickableComponent = require('../clickable-component.js');
7 var _clickableComponent2 = _interopRequireDefault(_clickableComponent);
9 var _component = require('../component.js');
11 var _component2 = _interopRequireDefault(_component);
13 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
15 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
19 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
20 * @file popup-button.js
25 * A button class for use with {@link Popup} controls
27 * @extends ClickableComponent
29 var PopupButton = function (_ClickableComponent) {
30 _inherits(PopupButton, _ClickableComponent);
33 * Create an instance of this class.
35 * @param {Player} player
36 * The `Player` that this class should be attached to.
38 * @param {Object} [options]
39 * The key/value store of player options.
41 function PopupButton(player) {
42 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
44 _classCallCheck(this, PopupButton);
46 var _this = _possibleConstructorReturn(this, _ClickableComponent.call(this, player, options));
53 * Update the `Popup` that this button is attached to.
57 PopupButton.prototype.update = function update() {
58 var popup = this.createPopup();
61 this.removeChild(this.popup);
67 if (this.items && this.items.length === 0) {
69 } else if (this.items && this.items.length > 1) {
75 * Create a `Popup`. - Override with specific functionality for component
81 PopupButton.prototype.createPopup = function createPopup() {};
84 * Create the `PopupButton`s DOM element.
87 * The element that gets created.
91 PopupButton.prototype.createEl = function createEl() {
92 return _ClickableComponent.prototype.createEl.call(this, 'div', {
93 className: this.buildCSSClass()
98 * Builds the default DOM `className`.
101 * The DOM `className` for this object.
105 PopupButton.prototype.buildCSSClass = function buildCSSClass() {
106 var menuButtonClass = 'vjs-menu-button';
108 // If the inline option is passed, we want to use different styles altogether.
109 if (this.options_.inline === true) {
110 menuButtonClass += '-inline';
112 menuButtonClass += '-popup';
115 return 'vjs-menu-button ' + menuButtonClass + ' ' + _ClickableComponent.prototype.buildCSSClass.call(this);
119 }(_clickableComponent2['default']);
121 _component2['default'].registerComponent('PopupButton', PopupButton);
122 exports['default'] = PopupButton;