ca362781222a491dbe25729422264f0c8cc74151
[yaffs-website] / control-bar / text-track-controls / subtitles-button.js
1 'use strict';
2
3 exports.__esModule = true;
4
5 var _textTrackButton = require('./text-track-button.js');
6
7 var _textTrackButton2 = _interopRequireDefault(_textTrackButton);
8
9 var _component = require('../../component.js');
10
11 var _component2 = _interopRequireDefault(_component);
12
13 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
14
15 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
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; }
18
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 subtitles-button.js
21                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 */
22
23
24 /**
25  * The button component for toggling and selecting subtitles
26  *
27  * @extends TextTrackButton
28  */
29 var SubtitlesButton = function (_TextTrackButton) {
30   _inherits(SubtitlesButton, _TextTrackButton);
31
32   /**
33    * Creates an instance of this class.
34    *
35    * @param {Player} player
36    *        The `Player` that this class should be attached to.
37    *
38    * @param {Object} [options]
39    *        The key/value store of player options.
40    *
41    * @param {Component~ReadyCallback} [ready]
42    *        The function to call when this component is ready.
43    */
44   function SubtitlesButton(player, options, ready) {
45     _classCallCheck(this, SubtitlesButton);
46
47     var _this = _possibleConstructorReturn(this, _TextTrackButton.call(this, player, options, ready));
48
49     _this.el_.setAttribute('aria-label', 'Subtitles Menu');
50     return _this;
51   }
52
53   /**
54    * Builds the default DOM `className`.
55    *
56    * @return {string}
57    *         The DOM `className` for this object.
58    */
59
60
61   SubtitlesButton.prototype.buildCSSClass = function buildCSSClass() {
62     return 'vjs-subtitles-button ' + _TextTrackButton.prototype.buildCSSClass.call(this);
63   };
64
65   return SubtitlesButton;
66 }(_textTrackButton2['default']);
67
68 /**
69  * `kind` of TextTrack to look for to associate it with this menu.
70  *
71  * @type {string}
72  * @private
73  */
74
75
76 SubtitlesButton.prototype.kind_ = 'subtitles';
77
78 /**
79  * The text that should display over the `SubtitlesButton`s controls. Added for localization.
80  *
81  * @type {string}
82  * @private
83  */
84 SubtitlesButton.prototype.controlText_ = 'Subtitles';
85
86 _component2['default'].registerComponent('SubtitlesButton', SubtitlesButton);
87 exports['default'] = SubtitlesButton;