caption-settings-menu-item.js 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. 'use strict';
  2. exports.__esModule = true;
  3. var _textTrackMenuItem = require('./text-track-menu-item.js');
  4. var _textTrackMenuItem2 = _interopRequireDefault(_textTrackMenuItem);
  5. var _component = require('../../component.js');
  6. var _component2 = _interopRequireDefault(_component);
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  8. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9. 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; }
  10. 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; } /**
  11. * @file caption-settings-menu-item.js
  12. */
  13. /**
  14. * The menu item for caption track settings menu
  15. *
  16. * @extends TextTrackMenuItem
  17. */
  18. var CaptionSettingsMenuItem = function (_TextTrackMenuItem) {
  19. _inherits(CaptionSettingsMenuItem, _TextTrackMenuItem);
  20. /**
  21. * Creates an instance of this class.
  22. *
  23. * @param {Player} player
  24. * The `Player` that this class should be attached to.
  25. *
  26. * @param {Object} [options]
  27. * The key/value store of player options.
  28. */
  29. function CaptionSettingsMenuItem(player, options) {
  30. _classCallCheck(this, CaptionSettingsMenuItem);
  31. options.track = {
  32. player: player,
  33. kind: options.kind,
  34. label: options.kind + ' settings',
  35. selectable: false,
  36. 'default': false,
  37. mode: 'disabled'
  38. };
  39. // CaptionSettingsMenuItem has no concept of 'selected'
  40. options.selectable = false;
  41. var _this = _possibleConstructorReturn(this, _TextTrackMenuItem.call(this, player, options));
  42. _this.addClass('vjs-texttrack-settings');
  43. _this.controlText(', opens ' + options.kind + ' settings dialog');
  44. return _this;
  45. }
  46. /**
  47. * This gets called when an `CaptionSettingsMenuItem` is "clicked". See
  48. * {@link ClickableComponent} for more detailed information on what a click can be.
  49. *
  50. * @param {EventTarget~Event} [event]
  51. * The `keydown`, `tap`, or `click` event that caused this function to be
  52. * called.
  53. *
  54. * @listens tap
  55. * @listens click
  56. */
  57. CaptionSettingsMenuItem.prototype.handleClick = function handleClick(event) {
  58. this.player().getChild('textTrackSettings').show();
  59. this.player().getChild('textTrackSettings').el_.focus();
  60. };
  61. return CaptionSettingsMenuItem;
  62. }(_textTrackMenuItem2['default']);
  63. _component2['default'].registerComponent('CaptionSettingsMenuItem', CaptionSettingsMenuItem);
  64. exports['default'] = CaptionSettingsMenuItem;