subtitles-button.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. 'use strict';
  2. exports.__esModule = true;
  3. var _textTrackButton = require('./text-track-button.js');
  4. var _textTrackButton2 = _interopRequireDefault(_textTrackButton);
  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 subtitles-button.js
  12. */
  13. /**
  14. * The button component for toggling and selecting subtitles
  15. *
  16. * @extends TextTrackButton
  17. */
  18. var SubtitlesButton = function (_TextTrackButton) {
  19. _inherits(SubtitlesButton, _TextTrackButton);
  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. * @param {Component~ReadyCallback} [ready]
  30. * The function to call when this component is ready.
  31. */
  32. function SubtitlesButton(player, options, ready) {
  33. _classCallCheck(this, SubtitlesButton);
  34. var _this = _possibleConstructorReturn(this, _TextTrackButton.call(this, player, options, ready));
  35. _this.el_.setAttribute('aria-label', 'Subtitles Menu');
  36. return _this;
  37. }
  38. /**
  39. * Builds the default DOM `className`.
  40. *
  41. * @return {string}
  42. * The DOM `className` for this object.
  43. */
  44. SubtitlesButton.prototype.buildCSSClass = function buildCSSClass() {
  45. return 'vjs-subtitles-button ' + _TextTrackButton.prototype.buildCSSClass.call(this);
  46. };
  47. return SubtitlesButton;
  48. }(_textTrackButton2['default']);
  49. /**
  50. * `kind` of TextTrack to look for to associate it with this menu.
  51. *
  52. * @type {string}
  53. * @private
  54. */
  55. SubtitlesButton.prototype.kind_ = 'subtitles';
  56. /**
  57. * The text that should display over the `SubtitlesButton`s controls. Added for localization.
  58. *
  59. * @type {string}
  60. * @private
  61. */
  62. SubtitlesButton.prototype.controlText_ = 'Subtitles';
  63. _component2['default'].registerComponent('SubtitlesButton', SubtitlesButton);
  64. exports['default'] = SubtitlesButton;