3 exports.__esModule = true;
5 var _component = require('../component.js');
7 var _component2 = _interopRequireDefault(_component);
9 var _dom = require('../utils/dom.js');
11 var Dom = _interopRequireWildcard(_dom);
13 var _fn = require('../utils/fn.js');
15 var Fn = _interopRequireWildcard(_fn);
17 var _events = require('../utils/events.js');
19 var Events = _interopRequireWildcard(_events);
21 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
23 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
25 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27 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; }
29 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; } /**
35 * The Popup component is used to build pop up controls.
39 var Popup = function (_Component) {
40 _inherits(Popup, _Component);
43 _classCallCheck(this, Popup);
45 return _possibleConstructorReturn(this, _Component.apply(this, arguments));
49 * Add a popup item to the popup
51 * @param {Object|string} component
52 * Component or component type to add
55 Popup.prototype.addItem = function addItem(component) {
56 this.addChild(component);
57 component.on('click', Fn.bind(this, function () {
63 * Create the `PopupButton`s DOM element.
66 * The element that gets created.
70 Popup.prototype.createEl = function createEl() {
71 var contentElType = this.options_.contentElType || 'ul';
73 this.contentEl_ = Dom.createEl(contentElType, {
74 className: 'vjs-menu-content'
77 var el = _Component.prototype.createEl.call(this, 'div', {
78 append: this.contentEl_,
82 el.appendChild(this.contentEl_);
84 // Prevent clicks from bubbling up. Needed for Popup Buttons,
85 // where a click on the parent is significant
86 Events.on(el, 'click', function (event) {
87 event.preventDefault();
88 event.stopImmediatePropagation();
95 }(_component2['default']);
97 _component2['default'].registerComponent('Popup', Popup);
98 exports['default'] = Popup;