wai-website-theme 1.3.1 → 1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/different.html +2 -1
  3. data/_includes/external.html +2 -1
  4. data/_includes/header.html +2 -1
  5. data/_includes/menuitem.html +6 -2
  6. data/_includes/peoplelist.html +21 -0
  7. data/_includes/prevnext-navigation.html +56 -0
  8. data/_includes/{prevnext.html → prevnext-order.html} +9 -0
  9. data/_includes/translation-note-msg.html +5 -3
  10. data/_includes/video-player.html +2 -2
  11. data/_layouts/default.html +8 -1
  12. data/_layouts/news.html +7 -1
  13. data/_layouts/policy.html +7 -1
  14. data/_layouts/sidenav.html +8 -1
  15. data/_layouts/sidenavsidebar.html +8 -1
  16. data/assets/ableplayer/Gruntfile.js +2 -1
  17. data/assets/ableplayer/README.md +158 -85
  18. data/assets/ableplayer/build/ableplayer.dist.js +15445 -13823
  19. data/assets/ableplayer/build/ableplayer.js +15445 -13823
  20. data/assets/ableplayer/build/ableplayer.min.css +1 -2
  21. data/assets/ableplayer/build/ableplayer.min.js +3 -10
  22. data/assets/ableplayer/package-lock.json +944 -346
  23. data/assets/ableplayer/package.json +8 -8
  24. data/assets/ableplayer/scripts/ableplayer-base.js +515 -524
  25. data/assets/ableplayer/scripts/browser.js +158 -158
  26. data/assets/ableplayer/scripts/buildplayer.js +1750 -1682
  27. data/assets/ableplayer/scripts/caption.js +424 -401
  28. data/assets/ableplayer/scripts/chapters.js +259 -259
  29. data/assets/ableplayer/scripts/control.js +1831 -1594
  30. data/assets/ableplayer/scripts/description.js +333 -256
  31. data/assets/ableplayer/scripts/dialog.js +145 -145
  32. data/assets/ableplayer/scripts/dragdrop.js +746 -749
  33. data/assets/ableplayer/scripts/event.js +875 -696
  34. data/assets/ableplayer/scripts/initialize.js +819 -912
  35. data/assets/ableplayer/scripts/langs.js +979 -743
  36. data/assets/ableplayer/scripts/metadata.js +124 -124
  37. data/assets/ableplayer/scripts/misc.js +170 -137
  38. data/assets/ableplayer/scripts/preference.js +904 -904
  39. data/assets/ableplayer/scripts/search.js +172 -172
  40. data/assets/ableplayer/scripts/sign.js +82 -78
  41. data/assets/ableplayer/scripts/slider.js +449 -448
  42. data/assets/ableplayer/scripts/track.js +409 -309
  43. data/assets/ableplayer/scripts/transcript.js +684 -595
  44. data/assets/ableplayer/scripts/translation.js +63 -67
  45. data/assets/ableplayer/scripts/ttml2webvtt.js +85 -85
  46. data/assets/ableplayer/scripts/vimeo.js +448 -0
  47. data/assets/ableplayer/scripts/volume.js +395 -380
  48. data/assets/ableplayer/scripts/vts.js +1077 -1077
  49. data/assets/ableplayer/scripts/webvtt.js +766 -763
  50. data/assets/ableplayer/scripts/youtube.js +695 -478
  51. data/assets/ableplayer/styles/ableplayer.css +54 -46
  52. data/assets/ableplayer/translations/nl.js +54 -54
  53. data/assets/ableplayer/translations/pt-br.js +311 -0
  54. data/assets/ableplayer/translations/tr.js +311 -0
  55. data/assets/ableplayer/translations/zh-tw.js +1 -1
  56. data/assets/css/style.css +1 -1
  57. data/assets/css/style.css.map +1 -1
  58. data/assets/images/icons.svg +5 -5
  59. data/assets/scripts/main.js +7 -0
  60. data/assets/search/tipuesearch.js +3 -3
  61. metadata +8 -3
@@ -1,384 +1,399 @@
1
1
  (function ($) {
2
2
 
3
- AblePlayer.prototype.addVolumeSlider = function($div) {
4
-
5
- // input type="range" requires IE10 and later
6
- // and still isn't supported by Opera Mini as of v8
7
- // Also, vertical orientation of slider requires CSS hacks
8
- // and causes problems in some screen readers
9
- // Therefore, building a custom vertical volume slider
10
- var thisObj, volumeSliderId, volumeHelpId, x, y, volumePct;
11
-
12
- thisObj = this;
13
-
14
- // define a few variables
15
- volumeSliderId = this.mediaId + '-volume-slider';
16
- volumeHelpId = this.mediaId + '-volume-help';
17
- this.volumeTrackHeight = 50; // must match CSS height for .able-volume-slider
18
- this.volumeHeadHeight = 7; // must match CSS height for .able-volume-head
19
- this.volumeTickHeight = this.volumeTrackHeight / 10;
20
-
21
- this.$volumeSlider = $('<div>',{
22
- 'id': volumeSliderId,
23
- 'class': 'able-volume-slider',
24
- 'aria-hidden': 'true'
25
- }).hide();
26
- this.$volumeSliderTooltip = $('<div>',{
27
- 'class': 'able-tooltip',
28
- 'role': 'tooltip'
29
- }).hide();
30
- this.$volumeSliderTrack = $('<div>',{
31
- 'class': 'able-volume-track'
32
- });
33
- this.$volumeSliderTrackOn = $('<div>',{
34
- 'class': 'able-volume-track able-volume-track-on'
35
- });
36
- this.$volumeSliderHead = $('<div>',{
37
- 'class': 'able-volume-head',
38
- 'role': 'slider',
39
- 'aria-orientation': 'vertical',
40
- 'aria-label': this.tt.volumeUpDown,
41
- 'aria-valuemin': 0,
42
- 'aria-valuemax': 10,
43
- 'aria-valuenow': this.volume,
44
- 'tabindex': -1
45
- });
46
- this.$volumeSliderTrack.append(this.$volumeSliderTrackOn,this.$volumeSliderHead);
47
- this.$volumeAlert = $('<div>',{
48
- 'class': 'able-offscreen',
49
- 'aria-live': 'assertive',
50
- 'aria-atomic': 'true'
51
- });
52
- volumePct = parseInt(thisObj.volume) / 10 * 100;
53
- this.$volumeHelp = $('<div>',{
54
- 'id': volumeHelpId,
55
- 'class': 'able-volume-help'
56
- }).text(volumePct + '%, ' + this.tt.volumeHelp);
57
- this.$volumeButton.attr({
58
- 'aria-describedby': volumeHelpId
59
- });
60
- this.$volumeSlider.append(this.$volumeSliderTooltip,this.$volumeSliderTrack,this.$volumeAlert,this.$volumeHelp)
61
- $div.append(this.$volumeSlider);
62
-
63
- this.refreshVolumeSlider(this.volume);
64
-
65
- // add event listeners
66
- this.$volumeSliderHead.on('mousedown',function (e) {
67
- e.preventDefault(); // prevent text selection (implications?)
68
- thisObj.draggingVolume = true;
69
- thisObj.volumeHeadPositionTop = $(this).offset().top;
70
- });
71
-
72
- // prevent dragging after mouseup as mouseup not detected over iframe (YouTube)
73
- this.$mediaContainer.on('mouseover',function (e) {
74
- if(thisObj.player == 'youtube'){
75
- thisObj.draggingVolume = false;
76
- }
77
- });
78
-
79
- $(document).on('mouseup',function (e) {
80
- thisObj.draggingVolume = false;
81
- });
82
-
83
- $(document).on('mousemove',function (e) {
84
- if (thisObj.draggingVolume) {
85
- x = e.pageX;
86
- y = e.pageY;
87
- thisObj.moveVolumeHead(y);
88
- }
89
- });
90
-
91
- this.$volumeSliderHead.on('keydown',function (e) {
92
- // Left arrow or down arrow
93
- if (e.which === 37 || e.which === 40) {
94
- thisObj.handleVolume('down');
95
- }
96
- // Right arrow or up arrow
97
- else if (e.which === 39 || e.which === 38) {
98
- thisObj.handleVolume('up');
99
- }
100
- // Escape key or Enter key
101
- else if (e.which === 27 || e.which === 13) {
102
- // close popup
103
- if (thisObj.$volumeSlider.is(':visible')) {
104
- thisObj.hideVolumePopup();
105
- }
106
- else {
107
- thisObj.showVolumePopup();
108
- }
109
- }
110
- else {
111
- return;
112
- }
113
- e.preventDefault();
114
- });
115
- };
116
-
117
- AblePlayer.prototype.refreshVolumeSlider = function(volume) {
118
-
119
- // adjust slider position based on current volume
120
- var volumePct, volumePctText;
121
- volumePct = (volume/10) * 100;
122
- volumePctText = volumePct + '%';
123
-
124
- var trackOnHeight, trackOnTop, headTop;
125
- trackOnHeight = volume * this.volumeTickHeight;
126
- trackOnTop = this.volumeTrackHeight - trackOnHeight;
127
- headTop = trackOnTop - this.volumeHeadHeight;
128
-
129
- this.$volumeSliderTrackOn.css({
130
- 'height': trackOnHeight + 'px',
131
- 'top': trackOnTop + 'px'
132
- });
133
- this.$volumeSliderHead.attr({
134
- 'aria-valuenow': volume,
135
- 'aria-valuetext': volumePctText
136
- });
137
- this.$volumeSliderHead.css({
138
- 'top': headTop + 'px'
139
- });
140
- this.$volumeAlert.text(volumePct + '%');
141
-
142
- };
143
-
144
- AblePlayer.prototype.refreshVolumeButton = function(volume) {
145
-
146
- var volumeName, volumePct, volumeLabel, volumeIconClass, volumeImg;
147
-
148
- volumeName = this.getVolumeName(volume);
149
- volumePct = (volume/10) * 100;
150
- volumeLabel = this.tt.volume + ' ' + volumePct + '%';
151
-
152
- if (this.iconType === 'font') {
153
- volumeIconClass = 'icon-volume-' + volumeName;
154
- this.$volumeButton.find('span').first().removeClass().addClass(volumeIconClass);
155
- this.$volumeButton.find('span.able-clipped').text(volumeLabel);
156
- }
157
- else {
158
- volumeImg = this.imgPath + 'volume-' + volumeName + '.png';
159
- this.$volumeButton.find('img').attr('src',volumeImg);
160
- }
161
- };
162
-
163
- AblePlayer.prototype.moveVolumeHead = function(y) {
164
-
165
- // y is current position after mousemove
166
- var diff, direction, ticksDiff, newVolume, maxedOut;
167
-
168
- var diff = this.volumeHeadPositionTop - y;
169
-
170
- // only move the volume head if user had dragged at least one tick
171
- // this is more efficient, plus creates a "snapping' effect
172
- if (Math.abs(diff) > this.volumeTickHeight) {
173
- if (diff > 0) {
174
- direction = 'up';
175
- }
176
- else {
177
- direction = 'down';
178
- }
179
- if (direction == 'up' && this.volume == 10) {
180
- // can't go any higher
181
- return;
182
- }
183
- else if (direction == 'down' && this.volume == 0) {
184
- // can't go any lower
185
- return;
186
- }
187
- else {
188
- ticksDiff = Math.round(Math.abs(diff) / this.volumeTickHeight);
189
- if (direction == 'up') {
190
- newVolume = this.volume + ticksDiff;
191
- if (newVolume > 10) {
192
- newVolume = 10;
193
- }
194
- }
195
- else { // direction is down
196
- newVolume = this.volume - ticksDiff;
197
- if (newVolume < 0) {
198
- newVolume = 0;
199
- }
200
- }
201
- this.setVolume(newVolume); // this.volume will be updated after volumechange event fires (event.js)
202
- this.refreshVolumeSlider(newVolume);
203
- this.refreshVolumeButton(newVolume);
204
- this.volumeHeadPositionTop = y;
205
- }
206
- }
207
- };
208
-
209
- AblePlayer.prototype.handleVolume = function(direction) {
210
-
211
- // 'direction is either 'up','down', or an ASCII key code 49-57 (numeric keys 1-9)
212
- // Action: calculate and change the volume
213
- // Don't change this.volume and this.volumeButton yet - wait for 'volumechange' event to fire (event.js)
214
-
215
- // If NO direction is provided, user has just clicked on the Volume button
216
- // Action: show slider
217
- var volume;
218
-
219
- if (typeof direction === 'undefined') {
220
- if (this.$volumeSlider.is(':visible')) {
221
- this.hideVolumePopup();
222
- }
223
- else {
224
- this.showVolumePopup();
225
- }
226
- return;
227
- }
228
-
229
- if (direction >= 49 && direction <= 57) {
230
- volume = direction - 48;
231
- }
232
- else {
233
-
234
- volume = this.getVolume();
235
-
236
- if (direction === 'up' && volume < 10) {
237
- volume += 1;
238
- }
239
- else if (direction === 'down' && volume > 0) {
240
- volume -= 1;
241
- }
242
- }
243
-
244
- if (this.isMuted() && volume > 0) {
245
- this.setMute(false);
246
- }
247
- else if (volume === 0) {
248
- this.setMute(true);
249
- }
250
- else {
251
- this.setVolume(volume); // this.volume will be updated after volumechange event fires (event.js)
252
- this.refreshVolumeSlider(volume);
253
- this.refreshVolumeButton(volume);
254
- }
255
- };
256
-
257
- AblePlayer.prototype.handleMute = function() {
258
- if (this.isMuted()) {
259
- this.setMute(false);
260
- }
261
- else {
262
- this.setMute(true);
263
- }
264
- };
265
-
266
- AblePlayer.prototype.showVolumePopup = function() {
267
-
268
- this.closePopups();
269
- this.$tooltipDiv.hide();
270
- this.$volumeSlider.show().attr('aria-hidden','false');
271
- this.$volumeButton.attr('aria-expanded','true');
272
- this.$volumeSliderHead.attr('tabindex','0').focus();
273
- };
274
-
275
- AblePlayer.prototype.hideVolumePopup = function() {
276
-
277
- this.$volumeSlider.hide().attr('aria-hidden','true');
278
- this.$volumeSliderHead.attr('tabindex','-1');
279
- this.$volumeButton.attr('aria-expanded','false').focus();
280
- };
281
-
282
- AblePlayer.prototype.isMuted = function () {
283
-
284
- if (this.player === 'html5') {
285
- return this.media.muted;
286
- }
287
- else if (this.player === 'jw' && this.jwPlayer) {
288
- return this.jwPlayer.getMute();
289
- }
290
- else if (this.player === 'youtube') {
291
- return this.youTubePlayer.isMuted();
292
- }
293
- };
294
-
295
- AblePlayer.prototype.setMute = function(mute) {
296
-
297
- // mute is either true (muting) or false (unmuting)
298
- if (mute) {
299
- // save current volume so it can be restored after unmute
300
- this.lastVolume = this.volume;
301
- this.volume = 0;
302
- }
303
- else { // restore to previous volume
304
- if (typeof this.lastVolume !== 'undefined') {
305
- this.volume = this.lastVolume;
306
- }
307
- }
308
-
309
- if (this.player === 'html5') {
310
- this.media.muted = mute;
311
- }
312
- else if (this.player === 'jw' && this.jwPlayer) {
313
- this.jwPlayer.setMute(mute);
314
- }
315
- else if (this.player === 'youtube') {
316
- if (mute) {
317
- this.youTubePlayer.mute();
318
- }
319
- else {
320
- this.youTubePlayer.unMute();
321
- }
322
- }
323
- this.refreshVolumeSlider(this.volume);
324
- this.refreshVolumeButton(this.volume);
325
- };
326
-
327
- AblePlayer.prototype.setVolume = function (volume) {
328
-
329
- // volume is 1 to 10
330
- // convert as needed depending on player
331
-
332
- if (this.player === 'html5') {
333
- this.media.volume = volume / 10;
334
- if (this.hasSignLanguage && this.signVideo) {
335
- this.signVideo.volume = 0; // always mute
336
- }
337
- }
338
- else if (this.player === 'jw' && this.jwPlayer) {
339
- this.jwPlayer.setVolume(volume * 10);
340
- }
341
- else if (this.player === 'youtube') {
342
- this.youTubePlayer.setVolume(volume * 10);
343
- this.volume = volume;
344
- }
345
-
346
- this.lastVolume = volume;
347
- };
348
-
349
- AblePlayer.prototype.getVolume = function (volume) {
350
-
351
- // return volume using common audio control scale 1 to 10
352
-
353
- if (this.player === 'html5') {
354
- // uses 0 to 1 scale
355
- return this.media.volume * 10;
356
- }
357
- else if (this.player === 'jw' && this.jwPlayer) {
358
- // uses 0 to 100 scale
359
- return this.jwPlayer.getVolume() / 10;
360
- }
361
- else if (this.player === 'youtube') {
362
- // uses 0 to 100 scale
363
- return this.youTubePlayer.getVolume() / 10;
364
- }
365
- };
366
-
367
- AblePlayer.prototype.getVolumeName = function (volume) {
368
-
369
- // returns 'mute','soft','medium', or 'loud' depending on volume level
370
- if (volume == 0) {
371
- return 'mute';
372
- }
373
- else if (volume == 10) {
374
- return 'loud';
375
- }
376
- else if (volume < 5) {
377
- return 'soft';
378
- }
379
- else {
380
- return 'medium';
381
- }
382
- };
3
+ AblePlayer.prototype.addVolumeSlider = function($div) {
4
+
5
+ // input type="range" requires IE10 and later
6
+ // and still isn't supported by Opera Mini as of v8
7
+ // Also, vertical orientation of slider requires CSS hacks
8
+ // and causes problems in some screen readers
9
+ // Therefore, building a custom vertical volume slider
10
+ var thisObj, volumeSliderId, volumeHelpId, x, y, volumePct;
11
+
12
+ thisObj = this;
13
+
14
+ // define a few variables
15
+ volumeSliderId = this.mediaId + '-volume-slider';
16
+ volumeHelpId = this.mediaId + '-volume-help';
17
+ this.volumeTrackHeight = 50; // must match CSS height for .able-volume-slider
18
+ this.volumeHeadHeight = 7; // must match CSS height for .able-volume-head
19
+ this.volumeTickHeight = this.volumeTrackHeight / 10;
20
+
21
+ this.$volumeSlider = $('<div>',{
22
+ 'id': volumeSliderId,
23
+ 'class': 'able-volume-slider',
24
+ 'aria-hidden': 'true'
25
+ }).hide();
26
+ this.$volumeSliderTooltip = $('<div>',{
27
+ 'class': 'able-tooltip',
28
+ 'role': 'tooltip'
29
+ }).hide();
30
+ this.$volumeSliderTrack = $('<div>',{
31
+ 'class': 'able-volume-track'
32
+ });
33
+ this.$volumeSliderTrackOn = $('<div>',{
34
+ 'class': 'able-volume-track able-volume-track-on'
35
+ });
36
+ this.$volumeSliderHead = $('<div>',{
37
+ 'class': 'able-volume-head',
38
+ 'role': 'slider',
39
+ 'aria-orientation': 'vertical',
40
+ 'aria-label': this.tt.volumeUpDown,
41
+ 'aria-valuemin': 0,
42
+ 'aria-valuemax': 10,
43
+ 'aria-valuenow': this.volume,
44
+ 'tabindex': -1
45
+ });
46
+ this.$volumeSliderTrack.append(this.$volumeSliderTrackOn,this.$volumeSliderHead);
47
+ this.$volumeAlert = $('<div>',{
48
+ 'class': 'able-offscreen',
49
+ 'aria-live': 'assertive',
50
+ 'aria-atomic': 'true'
51
+ });
52
+ volumePct = parseInt(thisObj.volume) / 10 * 100;
53
+ this.$volumeHelp = $('<div>',{
54
+ 'id': volumeHelpId,
55
+ 'class': 'able-volume-help'
56
+ }).text(volumePct + '%, ' + this.tt.volumeHelp);
57
+ this.$volumeButton.attr({
58
+ 'aria-describedby': volumeHelpId
59
+ });
60
+ this.$volumeSlider.append(this.$volumeSliderTooltip,this.$volumeSliderTrack,this.$volumeAlert,this.$volumeHelp)
61
+ $div.append(this.$volumeSlider);
62
+
63
+ this.refreshVolumeSlider(this.volume);
64
+
65
+ // add event listeners
66
+ this.$volumeSliderHead.on('mousedown',function (e) {
67
+ e.preventDefault(); // prevent text selection (implications?)
68
+ thisObj.draggingVolume = true;
69
+ thisObj.volumeHeadPositionTop = $(this).offset().top;
70
+ });
71
+
72
+ // prevent dragging after mouseup as mouseup not detected over iframe (YouTube)
73
+ this.$mediaContainer.on('mouseover',function (e) {
74
+ if(thisObj.player == 'youtube'){
75
+ thisObj.draggingVolume = false;
76
+ }
77
+ });
78
+
79
+ $(document).on('mouseup',function (e) {
80
+ thisObj.draggingVolume = false;
81
+ });
82
+
83
+ $(document).on('mousemove',function (e) {
84
+ if (thisObj.draggingVolume) {
85
+ x = e.pageX;
86
+ y = e.pageY;
87
+ thisObj.moveVolumeHead(y);
88
+ }
89
+ });
90
+
91
+ this.$volumeSliderHead.on('keydown',function (e) {
92
+ // Left arrow or down arrow
93
+ if (e.which === 37 || e.which === 40) {
94
+ thisObj.handleVolume('down');
95
+ }
96
+ // Right arrow or up arrow
97
+ else if (e.which === 39 || e.which === 38) {
98
+ thisObj.handleVolume('up');
99
+ }
100
+ // Escape key or Enter key
101
+ else if (e.which === 27 || e.which === 13) {
102
+ // close popup
103
+ if (thisObj.$volumeSlider.is(':visible')) {
104
+ thisObj.hideVolumePopup();
105
+ }
106
+ else {
107
+ thisObj.showVolumePopup();
108
+ }
109
+ }
110
+ else {
111
+ return;
112
+ }
113
+ e.preventDefault();
114
+ });
115
+ };
116
+
117
+ AblePlayer.prototype.refreshVolumeSlider = function(volume) {
118
+
119
+ // adjust slider position based on current volume
120
+ var volumePct, volumePctText;
121
+ volumePct = (volume/10) * 100;
122
+ volumePctText = volumePct + '%';
123
+
124
+ var trackOnHeight, trackOnTop, headTop;
125
+ trackOnHeight = volume * this.volumeTickHeight;
126
+ trackOnTop = this.volumeTrackHeight - trackOnHeight;
127
+ headTop = trackOnTop - this.volumeHeadHeight;
128
+
129
+ this.$volumeSliderTrackOn.css({
130
+ 'height': trackOnHeight + 'px',
131
+ 'top': trackOnTop + 'px'
132
+ });
133
+ this.$volumeSliderHead.attr({
134
+ 'aria-valuenow': volume,
135
+ 'aria-valuetext': volumePctText
136
+ });
137
+ this.$volumeSliderHead.css({
138
+ 'top': headTop + 'px'
139
+ });
140
+ this.$volumeAlert.text(volumePct + '%');
141
+
142
+ };
143
+
144
+ AblePlayer.prototype.refreshVolumeButton = function(volume) {
145
+
146
+ var volumeName, volumePct, volumeLabel, volumeIconClass, volumeImg;
147
+
148
+ volumeName = this.getVolumeName(volume);
149
+ volumePct = (volume/10) * 100;
150
+ volumeLabel = this.tt.volume + ' ' + volumePct + '%';
151
+
152
+ if (this.iconType === 'font') {
153
+ volumeIconClass = 'icon-volume-' + volumeName;
154
+ this.$volumeButton.find('span').first().removeClass().addClass(volumeIconClass);
155
+ this.$volumeButton.find('span.able-clipped').text(volumeLabel);
156
+ }
157
+ else {
158
+ volumeImg = this.imgPath + 'volume-' + volumeName + '.png';
159
+ this.$volumeButton.find('img').attr('src',volumeImg);
160
+ }
161
+ };
162
+
163
+ AblePlayer.prototype.moveVolumeHead = function(y) {
164
+
165
+ // y is current position after mousemove
166
+ var diff, direction, ticksDiff, newVolume, maxedOut;
167
+
168
+ var diff = this.volumeHeadPositionTop - y;
169
+
170
+ // only move the volume head if user had dragged at least one tick
171
+ // this is more efficient, plus creates a "snapping' effect
172
+ if (Math.abs(diff) > this.volumeTickHeight) {
173
+ if (diff > 0) {
174
+ direction = 'up';
175
+ }
176
+ else {
177
+ direction = 'down';
178
+ }
179
+ if (direction == 'up' && this.volume == 10) {
180
+ // can't go any higher
181
+ return;
182
+ }
183
+ else if (direction == 'down' && this.volume == 0) {
184
+ // can't go any lower
185
+ return;
186
+ }
187
+ else {
188
+ ticksDiff = Math.round(Math.abs(diff) / this.volumeTickHeight);
189
+ if (direction == 'up') {
190
+ newVolume = this.volume + ticksDiff;
191
+ if (newVolume > 10) {
192
+ newVolume = 10;
193
+ }
194
+ }
195
+ else { // direction is down
196
+ newVolume = this.volume - ticksDiff;
197
+ if (newVolume < 0) {
198
+ newVolume = 0;
199
+ }
200
+ }
201
+ this.setVolume(newVolume); // this.volume will be updated after volumechange event fires (event.js)
202
+ this.refreshVolumeSlider(newVolume);
203
+ this.refreshVolumeButton(newVolume);
204
+ this.volumeHeadPositionTop = y;
205
+ }
206
+ }
207
+ };
208
+
209
+ AblePlayer.prototype.handleVolume = function(direction) {
210
+
211
+ // 'direction is either 'up','down', or an ASCII key code 49-57 (numeric keys 1-9)
212
+ // Action: calculate and change the volume
213
+ // Don't change this.volume and this.volumeButton yet - wait for 'volumechange' event to fire (event.js)
214
+
215
+ // If NO direction is provided, user has just clicked on the Volume button
216
+ // Action: show slider
217
+ var volume;
218
+
219
+ if (typeof direction === 'undefined') {
220
+ if (this.$volumeSlider.is(':visible')) {
221
+ this.hideVolumePopup();
222
+ }
223
+ else {
224
+ this.showVolumePopup();
225
+ }
226
+ return;
227
+ }
228
+
229
+ if (direction >= 49 && direction <= 57) {
230
+ volume = direction - 48;
231
+ }
232
+ else {
233
+
234
+ volume = this.getVolume();
235
+
236
+ if (direction === 'up' && volume < 10) {
237
+ volume += 1;
238
+ }
239
+ else if (direction === 'down' && volume > 0) {
240
+ volume -= 1;
241
+ }
242
+ }
243
+
244
+ if (this.isMuted() && volume > 0) {
245
+ this.setMute(false);
246
+ }
247
+ else if (volume === 0) {
248
+ this.setMute(true);
249
+ }
250
+ else {
251
+ this.setVolume(volume); // this.volume will be updated after volumechange event fires (event.js)
252
+ this.refreshVolumeSlider(volume);
253
+ this.refreshVolumeButton(volume);
254
+ }
255
+ };
256
+
257
+ AblePlayer.prototype.handleMute = function() {
258
+ if (this.isMuted()) {
259
+ this.setMute(false);
260
+ }
261
+ else {
262
+ this.setMute(true);
263
+ }
264
+ };
265
+
266
+ AblePlayer.prototype.showVolumePopup = function() {
267
+
268
+ this.closePopups();
269
+ this.$tooltipDiv.hide();
270
+ this.$volumeSlider.show().attr('aria-hidden','false');
271
+ this.$volumeButton.attr('aria-expanded','true');
272
+ this.$volumeSliderHead.attr('tabindex','0').focus();
273
+ };
274
+
275
+ AblePlayer.prototype.hideVolumePopup = function() {
276
+
277
+ this.$volumeSlider.hide().attr('aria-hidden','true');
278
+ this.$volumeSliderHead.attr('tabindex','-1');
279
+ this.$volumeButton.attr('aria-expanded','false').focus();
280
+ };
281
+
282
+ AblePlayer.prototype.isMuted = function () {
283
+
284
+ if (this.player === 'html5') {
285
+ return this.media.muted;
286
+ }
287
+ else if (this.player === 'jw' && this.jwPlayer) {
288
+ return this.jwPlayer.getMute();
289
+ }
290
+ else if (this.player === 'youtube') {
291
+ return this.youTubePlayer.isMuted();
292
+ }
293
+ };
294
+
295
+ AblePlayer.prototype.setMute = function(mute) {
296
+
297
+ // mute is either true (muting) or false (unmuting)
298
+ if (mute) {
299
+ // save current volume so it can be restored after unmute
300
+ this.lastVolume = this.volume;
301
+ this.volume = 0;
302
+ }
303
+ else { // restore to previous volume
304
+ if (typeof this.lastVolume !== 'undefined') {
305
+ this.volume = this.lastVolume;
306
+ }
307
+ }
308
+
309
+ if (this.player === 'html5') {
310
+ this.media.muted = mute;
311
+ }
312
+ else if (this.player === 'jw' && this.jwPlayer) {
313
+ this.jwPlayer.setMute(mute);
314
+ }
315
+ else if (this.player === 'youtube') {
316
+ if (mute) {
317
+ this.youTubePlayer.mute();
318
+ }
319
+ else {
320
+ this.youTubePlayer.unMute();
321
+ }
322
+ }
323
+ this.refreshVolumeSlider(this.volume);
324
+ this.refreshVolumeButton(this.volume);
325
+ };
326
+
327
+ AblePlayer.prototype.setVolume = function (volume) {
328
+
329
+ // volume is 1 to 10
330
+ // convert as needed depending on player
331
+
332
+ if (this.player === 'html5') {
333
+ // volume is 0 to 1
334
+ this.media.volume = volume / 10;
335
+ if (this.hasSignLanguage && this.signVideo) {
336
+ this.signVideo.volume = 0; // always mute
337
+ }
338
+ }
339
+ else if (this.player === 'youtube') {
340
+ // volume is 0 to 100
341
+ this.youTubePlayer.setVolume(volume * 10);
342
+ this.volume = volume;
343
+ }
344
+ else if (this.player === 'vimeo') {
345
+ // volume is 0 to 1
346
+ this.vimeoPlayer.setVolume(volume / 10).then(function() {
347
+ // setVolume finished.
348
+ // could do something here
349
+ // successful completion also fires a 'volumechange' event (see event.js)
350
+ });
351
+ }
352
+ else if (this.player === 'jw' && this.jwPlayer) {
353
+ // volume is 0 to 100
354
+ this.jwPlayer.setVolume(volume * 10);
355
+ }
356
+ this.lastVolume = volume;
357
+ };
358
+
359
+ AblePlayer.prototype.getVolume = function (volume) {
360
+
361
+ // return volume using common audio control scale 1 to 10
362
+ if (this.player === 'html5') {
363
+ // uses 0 to 1 scale
364
+ return this.media.volume * 10;
365
+ }
366
+ else if (this.player === 'youtube') {
367
+ // uses 0 to 100 scale
368
+ return this.youTubePlayer.getVolume() / 10;
369
+ }
370
+ if (this.player === 'vimeo') {
371
+ // uses 0 to 1 scale
372
+ // this.vimeoPlayer.getVolume() takes too long to resolve with a value
373
+ // Just use variable that's already been defined (should be the same value anyway)
374
+ return this.volume;
375
+ }
376
+ else if (this.player === 'jw' && this.jwPlayer) {
377
+ // uses 0 to 100 scale
378
+ return this.jwPlayer.getVolume() / 10;
379
+ }
380
+ };
381
+
382
+ AblePlayer.prototype.getVolumeName = function (volume) {
383
+
384
+ // returns 'mute','soft','medium', or 'loud' depending on volume level
385
+ if (volume == 0) {
386
+ return 'mute';
387
+ }
388
+ else if (volume == 10) {
389
+ return 'loud';
390
+ }
391
+ else if (volume < 5) {
392
+ return 'soft';
393
+ }
394
+ else {
395
+ return 'medium';
396
+ }
397
+ };
383
398
 
384
399
  })(jQuery);