wai-website-theme 1.3.1 → 1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/different.html +2 -1
- data/_includes/external.html +2 -1
- data/_includes/header.html +2 -1
- data/_includes/menuitem.html +6 -2
- data/_includes/peoplelist.html +21 -0
- data/_includes/prevnext-navigation.html +56 -0
- data/_includes/{prevnext.html → prevnext-order.html} +9 -0
- data/_includes/translation-note-msg.html +5 -3
- data/_includes/video-player.html +2 -2
- data/_layouts/default.html +8 -1
- data/_layouts/news.html +7 -1
- data/_layouts/policy.html +7 -1
- data/_layouts/sidenav.html +8 -1
- data/_layouts/sidenavsidebar.html +8 -1
- data/assets/ableplayer/Gruntfile.js +2 -1
- data/assets/ableplayer/README.md +158 -85
- data/assets/ableplayer/build/ableplayer.dist.js +15445 -13823
- data/assets/ableplayer/build/ableplayer.js +15445 -13823
- data/assets/ableplayer/build/ableplayer.min.css +1 -2
- data/assets/ableplayer/build/ableplayer.min.js +3 -10
- data/assets/ableplayer/package-lock.json +944 -346
- data/assets/ableplayer/package.json +8 -8
- data/assets/ableplayer/scripts/ableplayer-base.js +515 -524
- data/assets/ableplayer/scripts/browser.js +158 -158
- data/assets/ableplayer/scripts/buildplayer.js +1750 -1682
- data/assets/ableplayer/scripts/caption.js +424 -401
- data/assets/ableplayer/scripts/chapters.js +259 -259
- data/assets/ableplayer/scripts/control.js +1831 -1594
- data/assets/ableplayer/scripts/description.js +333 -256
- data/assets/ableplayer/scripts/dialog.js +145 -145
- data/assets/ableplayer/scripts/dragdrop.js +746 -749
- data/assets/ableplayer/scripts/event.js +875 -696
- data/assets/ableplayer/scripts/initialize.js +819 -912
- data/assets/ableplayer/scripts/langs.js +979 -743
- data/assets/ableplayer/scripts/metadata.js +124 -124
- data/assets/ableplayer/scripts/misc.js +170 -137
- data/assets/ableplayer/scripts/preference.js +904 -904
- data/assets/ableplayer/scripts/search.js +172 -172
- data/assets/ableplayer/scripts/sign.js +82 -78
- data/assets/ableplayer/scripts/slider.js +449 -448
- data/assets/ableplayer/scripts/track.js +409 -309
- data/assets/ableplayer/scripts/transcript.js +684 -595
- data/assets/ableplayer/scripts/translation.js +63 -67
- data/assets/ableplayer/scripts/ttml2webvtt.js +85 -85
- data/assets/ableplayer/scripts/vimeo.js +448 -0
- data/assets/ableplayer/scripts/volume.js +395 -380
- data/assets/ableplayer/scripts/vts.js +1077 -1077
- data/assets/ableplayer/scripts/webvtt.js +766 -763
- data/assets/ableplayer/scripts/youtube.js +695 -478
- data/assets/ableplayer/styles/ableplayer.css +54 -46
- data/assets/ableplayer/translations/nl.js +54 -54
- data/assets/ableplayer/translations/pt-br.js +311 -0
- data/assets/ableplayer/translations/tr.js +311 -0
- data/assets/ableplayer/translations/zh-tw.js +1 -1
- data/assets/css/style.css +1 -1
- data/assets/css/style.css.map +1 -1
- data/assets/images/icons.svg +5 -5
- data/assets/scripts/main.js +7 -0
- data/assets/search/tipuesearch.js +3 -3
- metadata +8 -3
@@ -1,455 +1,456 @@
|
|
1
1
|
(function ($) {
|
2
2
|
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
4
|
+
// Events:
|
5
|
+
// startTracking(event, position)
|
6
|
+
// tracking(event, position)
|
7
|
+
// stopTracking(event, position)
|
8
|
+
|
9
|
+
window. AccessibleSlider = function(mediaType, div, orientation, length, min, max, bigInterval, label, className, trackingMedia, initialState) {
|
10
|
+
|
11
|
+
// mediaType is either 'audio' or 'video'
|
12
|
+
// div is the host element around which the slider will be built
|
13
|
+
// orientation is either 'horizontal' or 'vertical'
|
14
|
+
// length is the width or height of the slider, depending on orientation
|
15
|
+
// min is the low end of the slider scale
|
16
|
+
// max is the high end of the slider scale
|
17
|
+
// bigInterval is the number of steps supported by page up/page down (set to 0 if not supported)
|
18
|
+
// (smallInterval, defined as nextStep below, is always set to 1) - this is the interval supported by arrow keys
|
19
|
+
// label is used within an aria-label attribute to identify the slider to screen reader users
|
20
|
+
// className is used as the root within class names (e.g., 'able-' + classname + '-head')
|
21
|
+
// trackingMedia is true if this is a media timeline; otherwise false
|
22
|
+
// initialState is either 'visible' or 'hidden'
|
23
|
+
|
24
|
+
var thisObj;
|
25
|
+
|
26
|
+
thisObj = this;
|
27
|
+
|
28
|
+
// Initialize some variables.
|
29
|
+
this.position = 0; // Note: position does not change while tracking.
|
30
|
+
this.tracking = false;
|
31
|
+
this.trackDevice = null; // 'mouse' or 'keyboard'
|
32
|
+
this.keyTrackPosition = 0;
|
33
|
+
this.lastTrackPosition = 0;
|
34
|
+
this.nextStep = 1;
|
35
|
+
this.inertiaCount = 0;
|
36
|
+
|
37
|
+
this.bodyDiv = $(div);
|
38
|
+
|
39
|
+
// Add divs for tracking amount of media loaded and played
|
40
|
+
if (trackingMedia) {
|
41
|
+
this.loadedDiv = $('<div></div>');
|
42
|
+
this.playedDiv = $('<div></div>');
|
43
|
+
}
|
44
|
+
|
45
|
+
// Add a seekhead
|
46
|
+
this.seekHead = $('<div>',{
|
47
|
+
'orientation': orientation,
|
48
|
+
'class': 'able-' + className + '-head'
|
49
|
+
});
|
50
|
+
|
51
|
+
if (initialState === 'visible') {
|
52
|
+
this.seekHead.attr('tabindex', '0');
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
this.seekHead.attr('tabindex', '-1');
|
56
|
+
}
|
57
|
+
// Since head is focusable, it gets the aria roles/titles.
|
58
|
+
this.seekHead.attr({
|
59
|
+
'role': 'slider',
|
60
|
+
'aria-label': label,
|
61
|
+
'aria-valuemin': min,
|
62
|
+
'aria-valuemax': max
|
63
|
+
});
|
64
|
+
|
65
|
+
this.timeTooltip = $('<div>');
|
66
|
+
this.bodyDiv.append(this.timeTooltip);
|
67
|
+
|
68
|
+
this.timeTooltip.attr('role', 'tooltip');
|
69
|
+
this.timeTooltip.addClass('able-tooltip');
|
70
|
+
this.timeTooltip.hide();
|
71
|
+
|
72
|
+
this.bodyDiv.append(this.loadedDiv);
|
73
|
+
this.bodyDiv.append(this.playedDiv);
|
74
|
+
this.bodyDiv.append(this.seekHead);
|
75
|
+
|
76
|
+
this.bodyDiv.wrap('<div></div>');
|
77
|
+
this.wrapperDiv = this.bodyDiv.parent();
|
78
|
+
|
79
|
+
if (orientation === 'horizontal') {
|
80
|
+
this.wrapperDiv.width(length);
|
81
|
+
this.loadedDiv.width(0);
|
82
|
+
}
|
83
|
+
else {
|
84
|
+
this.wrapperDiv.height(length);
|
85
|
+
this.loadedDiv.height(0);
|
86
|
+
}
|
87
|
+
this.wrapperDiv.addClass('able-' + className + '-wrapper');
|
88
|
+
|
89
|
+
if (trackingMedia) {
|
90
|
+
this.loadedDiv.addClass('able-' + className + '-loaded');
|
91
|
+
|
92
|
+
this.playedDiv.width(0);
|
93
|
+
this.playedDiv.addClass('able-' + className + '-played');
|
94
|
+
|
95
|
+
// Set a default duration. User can call this dynamically if duration changes.
|
96
|
+
this.setDuration(max);
|
97
|
+
}
|
98
|
+
|
99
|
+
this.seekHead.hover(function (e) {
|
100
|
+
thisObj.overHead = true;
|
101
|
+
thisObj.refreshTooltip();
|
102
|
+
}, function (e) {
|
103
|
+
thisObj.overHead = false;
|
104
|
+
|
105
|
+
if (!thisObj.overBody && thisObj.tracking && thisObj.trackDevice === 'mouse') {
|
106
|
+
thisObj.stopTracking(thisObj.pageXToPosition(e.pageX));
|
107
|
+
}
|
108
|
+
thisObj.refreshTooltip();
|
109
|
+
});
|
110
|
+
|
111
|
+
this.seekHead.mousemove(function (e) {
|
112
|
+
if (thisObj.tracking && thisObj.trackDevice === 'mouse') {
|
113
|
+
thisObj.trackHeadAtPageX(e.pageX);
|
114
|
+
}
|
115
|
+
});
|
116
|
+
|
117
|
+
this.seekHead.focus(function (e) {
|
118
|
+
thisObj.overHead = true;
|
119
|
+
thisObj.refreshTooltip();
|
120
|
+
});
|
121
|
+
|
122
|
+
this.seekHead.blur(function (e) {
|
123
|
+
thisObj.overHead = false;
|
124
|
+
thisObj.refreshTooltip();
|
125
|
+
});
|
126
|
+
|
127
|
+
this.bodyDiv.hover(function () {
|
128
|
+
thisObj.overBody = true;
|
129
|
+
thisObj.refreshTooltip();
|
130
|
+
}, function (e) {
|
131
|
+
thisObj.overBody = false;
|
132
|
+
thisObj.overBodyMousePos = null;
|
133
|
+
thisObj.refreshTooltip();
|
134
|
+
|
135
|
+
if (!thisObj.overHead && thisObj.tracking && thisObj.trackDevice === 'mouse') {
|
136
|
+
thisObj.stopTracking(thisObj.pageXToPosition(e.pageX));
|
137
|
+
}
|
138
|
+
});
|
139
|
+
|
140
|
+
this.bodyDiv.mousemove(function (e) {
|
141
|
+
thisObj.overBodyMousePos = {
|
142
|
+
x: e.pageX,
|
143
|
+
y: e.pageY
|
144
|
+
};
|
145
|
+
if (thisObj.tracking && thisObj.trackDevice === 'mouse') {
|
146
|
+
thisObj.trackHeadAtPageX(e.pageX);
|
147
|
+
}
|
148
|
+
thisObj.refreshTooltip();
|
149
|
+
});
|
150
|
+
|
151
|
+
this.bodyDiv.mousedown(function (e) {
|
152
|
+
thisObj.startTracking('mouse', thisObj.pageXToPosition(e.pageX));
|
153
|
+
thisObj.trackHeadAtPageX(e.pageX);
|
154
|
+
if (!thisObj.seekHead.is(':focus')) {
|
155
|
+
thisObj.seekHead.focus();
|
156
|
+
}
|
157
|
+
e.preventDefault();
|
158
|
+
});
|
159
|
+
|
160
|
+
this.seekHead.mousedown(function (e) {
|
161
|
+
thisObj.startTracking('mouse', thisObj.pageXToPosition(thisObj.seekHead.offset() + (thisObj.seekHead.width() / 2)));
|
162
|
+
if (!thisObj.bodyDiv.is(':focus')) {
|
163
|
+
thisObj.bodyDiv.focus();
|
164
|
+
}
|
165
|
+
e.preventDefault();
|
166
|
+
});
|
167
|
+
|
168
|
+
this.bodyDiv.mouseup(function (e) {
|
169
|
+
if (thisObj.tracking && thisObj.trackDevice === 'mouse') {
|
170
|
+
thisObj.stopTracking(thisObj.pageXToPosition(e.pageX));
|
171
|
+
}
|
172
|
+
})
|
173
|
+
|
174
|
+
this.seekHead.mouseup(function (e) {
|
175
|
+
if (thisObj.tracking && thisObj.trackDevice === 'mouse') {
|
176
|
+
thisObj.stopTracking(thisObj.pageXToPosition(e.pageX));
|
177
|
+
}
|
178
|
+
});
|
179
|
+
|
180
|
+
this.bodyDiv.keydown(function (e) {
|
181
|
+
// Home
|
182
|
+
if (e.which === 36) {
|
183
|
+
thisObj.trackImmediatelyTo(0);
|
184
|
+
}
|
185
|
+
// End
|
186
|
+
else if (e.which === 35) {
|
187
|
+
thisObj.trackImmediatelyTo(thisObj.duration);
|
188
|
+
}
|
189
|
+
// Left arrow or down arrow
|
190
|
+
else if (e.which === 37 || e.which === 40) {
|
191
|
+
thisObj.arrowKeyDown(-1);
|
192
|
+
}
|
193
|
+
// Right arrow or up arrow
|
194
|
+
else if (e.which === 39 || e.which === 38) {
|
195
|
+
thisObj.arrowKeyDown(1);
|
196
|
+
}
|
197
|
+
// Page up
|
198
|
+
else if (e.which === 33 && bigInterval > 0) {
|
199
|
+
thisObj.arrowKeyDown(bigInterval);
|
200
|
+
}
|
201
|
+
// Page down
|
202
|
+
else if (e.which === 34 && bigInterval > 0) {
|
203
|
+
thisObj.arrowKeyDown(-bigInterval);
|
204
|
+
}
|
205
|
+
|
206
|
+
else {
|
207
|
+
return;
|
208
|
+
}
|
209
|
+
e.preventDefault();
|
210
|
+
});
|
211
|
+
|
212
|
+
this.bodyDiv.keyup(function (e) {
|
213
|
+
if (e.which >= 33 && e.which <= 40) {
|
214
|
+
if (thisObj.tracking && thisObj.trackDevice === 'keyboard') {
|
215
|
+
thisObj.stopTracking(thisObj.keyTrackPosition);
|
216
|
+
}
|
217
|
+
e.preventDefault();
|
218
|
+
}
|
219
|
+
});
|
220
|
+
}
|
221
|
+
|
222
|
+
AccessibleSlider.prototype.arrowKeyDown = function (multiplier) {
|
223
|
+
if (this.tracking && this.trackDevice === 'keyboard') {
|
224
|
+
this.keyTrackPosition = this.boundPos(this.keyTrackPosition + (this.nextStep * multiplier));
|
225
|
+
this.inertiaCount += 1;
|
226
|
+
if (this.inertiaCount === 20) {
|
227
|
+
this.inertiaCount = 0;
|
228
|
+
this.nextStep *= 2;
|
229
|
+
}
|
230
|
+
this.trackHeadAtPosition(this.keyTrackPosition);
|
231
|
+
}
|
232
|
+
else {
|
233
|
+
this.nextStep = 1;
|
234
|
+
this.inertiaCount = 0;
|
235
|
+
this.keyTrackPosition = this.boundPos(this.position + (this.nextStep * multiplier));
|
236
|
+
this.startTracking('keyboard', this.keyTrackPosition);
|
237
|
+
this.trackHeadAtPosition(this.keyTrackPosition);
|
238
|
+
}
|
239
|
+
};
|
240
240
|
/*
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
241
|
+
AccessibleSlider.prototype.pageUp = function (multiplier) {
|
242
|
+
if (this.tracking && this.trackDevice === 'keyboard') {
|
243
|
+
this.keyTrackPosition = this.boundPos(this.keyTrackPosition + (this.nextStep * multiplier));
|
244
|
+
this.inertiaCount += 1;
|
245
|
+
if (this.inertiaCount === 20) {
|
246
|
+
this.inertiaCount = 0;
|
247
|
+
this.nextStep *= 2;
|
248
|
+
}
|
249
|
+
this.trackHeadAtPosition(this.keyTrackPosition);
|
250
|
+
}
|
251
|
+
else {
|
252
|
+
this.nextStep = 1;
|
253
|
+
this.inertiaCount = 0;
|
254
|
+
this.keyTrackPosition = this.boundPos(this.position + (this.nextStep * multiplier));
|
255
|
+
this.startTracking('keyboard', this.keyTrackPosition);
|
256
|
+
this.trackHeadAtPosition(this.keyTrackPosition);
|
257
|
+
}
|
258
|
+
};
|
259
259
|
*/
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
260
|
+
AccessibleSlider.prototype.pageXToPosition = function (pageX) {
|
261
|
+
var offset = pageX - this.bodyDiv.offset().left;
|
262
|
+
var position = this.duration * (offset / this.bodyDiv.width());
|
263
|
+
return this.boundPos(position);
|
264
|
+
};
|
265
|
+
|
266
|
+
AccessibleSlider.prototype.boundPos = function (position) {
|
267
|
+
return Math.max(0, Math.min(position, this.duration));
|
268
|
+
}
|
269
|
+
|
270
|
+
AccessibleSlider.prototype.setDuration = function (duration) {
|
271
|
+
|
272
|
+
if (duration !== this.duration) {
|
273
|
+
this.duration = duration;
|
274
|
+
this.resetHeadLocation();
|
275
|
+
this.seekHead.attr('aria-valuemax', duration);
|
276
|
+
}
|
277
|
+
};
|
278
|
+
|
279
|
+
AccessibleSlider.prototype.setWidth = function (width) {
|
280
|
+
this.wrapperDiv.width(width);
|
281
|
+
this.resizeDivs();
|
282
|
+
this.resetHeadLocation();
|
283
|
+
};
|
284
|
+
|
285
|
+
AccessibleSlider.prototype.getWidth = function () {
|
286
|
+
return this.wrapperDiv.width();
|
287
|
+
};
|
288
|
+
|
289
|
+
AccessibleSlider.prototype.resizeDivs = function () {
|
290
|
+
this.playedDiv.width(this.bodyDiv.width() * (this.position / this.duration));
|
291
|
+
this.loadedDiv.width(this.bodyDiv.width() * this.buffered);
|
292
|
+
};
|
293
|
+
|
294
|
+
// Stops tracking, sets the head location to the current position.
|
295
|
+
AccessibleSlider.prototype.resetHeadLocation = function () {
|
296
|
+
var ratio = this.position / this.duration;
|
297
|
+
var center = this.bodyDiv.width() * ratio;
|
298
|
+
this.seekHead.css('left', center - (this.seekHead.width() / 2));
|
299
|
+
|
300
|
+
if (this.tracking) {
|
301
|
+
this.stopTracking(this.position);
|
302
|
+
}
|
303
|
+
};
|
304
|
+
|
305
|
+
AccessibleSlider.prototype.setPosition = function (position, updateLive) {
|
306
|
+
this.position = position;
|
307
|
+
this.resetHeadLocation();
|
308
|
+
this.refreshTooltip();
|
309
|
+
this.resizeDivs();
|
310
|
+
this.updateAriaValues(position, updateLive);
|
311
|
+
}
|
312
|
+
|
313
|
+
// TODO: Native HTML5 can have several buffered segments, and this actually happens quite often. Change this to display them all.
|
314
|
+
AccessibleSlider.prototype.setBuffered = function (ratio) {
|
315
|
+
this.buffered = ratio;
|
316
|
+
this.redrawDivs;
|
317
|
+
}
|
318
|
+
|
319
|
+
AccessibleSlider.prototype.startTracking = function (device, position) {
|
320
|
+
if (!this.tracking) {
|
321
|
+
this.trackDevice = device;
|
322
|
+
this.tracking = true;
|
323
|
+
this.bodyDiv.trigger('startTracking', [position]);
|
324
|
+
}
|
325
|
+
};
|
326
|
+
|
327
|
+
AccessibleSlider.prototype.stopTracking = function (position) {
|
328
|
+
this.trackDevice = null;
|
329
|
+
this.tracking = false;
|
330
|
+
this.bodyDiv.trigger('stopTracking', [position]);
|
331
|
+
this.setPosition(position, true);
|
332
|
+
};
|
333
|
+
|
334
|
+
AccessibleSlider.prototype.trackHeadAtPageX = function (pageX) {
|
335
|
+
var position = this.pageXToPosition(pageX);
|
336
|
+
var newLeft = pageX - this.bodyDiv.offset().left - (this.seekHead.width() / 2);
|
337
|
+
newLeft = Math.max(0, Math.min(newLeft, this.bodyDiv.width() - this.seekHead.width()));
|
338
|
+
this.lastTrackPosition = position;
|
339
|
+
this.seekHead.css('left', newLeft);
|
340
|
+
this.reportTrackAtPosition(position);
|
341
|
+
};
|
342
|
+
|
343
|
+
AccessibleSlider.prototype.trackHeadAtPosition = function (position) {
|
344
|
+
var ratio = position / this.duration;
|
345
|
+
var center = this.bodyDiv.width() * ratio;
|
346
|
+
this.lastTrackPosition = position;
|
347
|
+
this.seekHead.css('left', center - (this.seekHead.width() / 2));
|
348
|
+
this.reportTrackAtPosition(position);
|
349
|
+
};
|
350
|
+
|
351
|
+
AccessibleSlider.prototype.reportTrackAtPosition = function (position) {
|
352
|
+
this.bodyDiv.trigger('tracking', [position]);
|
353
|
+
this.updateAriaValues(position, true);
|
354
|
+
};
|
355
|
+
|
356
|
+
AccessibleSlider.prototype.updateAriaValues = function (position, updateLive) {
|
357
|
+
// TODO: Localize, move to another function.
|
358
|
+
var pHours = Math.floor(position / 3600);
|
359
|
+
var pMinutes = Math.floor((position % 3600) / 60);
|
360
|
+
var pSeconds = Math.floor(position % 60);
|
361
|
+
|
362
|
+
var pHourWord = pHours === 1 ? 'hour' : 'hours';
|
363
|
+
var pMinuteWord = pMinutes === 1 ? 'minute' : 'minutes';
|
364
|
+
var pSecondWord = pSeconds === 1 ? 'second' : 'seconds';
|
365
|
+
|
366
|
+
var descriptionText;
|
367
|
+
if (pHours > 0) {
|
368
|
+
descriptionText = pHours +
|
369
|
+
' ' + pHourWord +
|
370
|
+
', ' + pMinutes +
|
371
|
+
' ' + pMinuteWord +
|
372
|
+
', ' + pSeconds +
|
373
|
+
' ' + pSecondWord;
|
374
|
+
}
|
375
|
+
else if (pMinutes > 0) {
|
376
|
+
descriptionText = pMinutes +
|
377
|
+
' ' + pMinuteWord +
|
378
|
+
', ' + pSeconds +
|
379
|
+
' ' + pSecondWord;
|
380
|
+
}
|
381
|
+
else {
|
382
|
+
descriptionText = pSeconds + ' ' + pSecondWord;
|
383
|
+
}
|
384
|
+
|
385
|
+
/* Comment to stop live region from generating or being used. */
|
386
|
+
if (!this.liveAriaRegion) {
|
387
|
+
this.liveAriaRegion = $('<span>', {
|
388
|
+
'class': 'able-offscreen',
|
389
|
+
'aria-live': 'polite'
|
390
|
+
});
|
391
|
+
this.wrapperDiv.append(this.liveAriaRegion);
|
392
|
+
}
|
393
|
+
if (updateLive && (this.liveAriaRegion.text() !== descriptionText)) {
|
394
|
+
this.liveAriaRegion.text(descriptionText);
|
395
|
+
}
|
396
|
+
|
397
|
+
// Uncomment the following lines to use aria values instead of separate live region.
|
398
|
+
this.seekHead.attr('aria-valuetext', descriptionText);
|
399
|
+
this.seekHead.attr('aria-valuenow', Math.floor(position).toString());
|
400
|
+
};
|
401
|
+
|
402
|
+
AccessibleSlider.prototype.trackImmediatelyTo = function (position) {
|
403
|
+
this.startTracking('keyboard', position);
|
404
|
+
this.trackHeadAtPosition(position);
|
405
|
+
this.keyTrackPosition = position;
|
406
|
+
};
|
407
|
+
|
408
|
+
AccessibleSlider.prototype.refreshTooltip = function () {
|
409
|
+
if (this.overHead) {
|
410
|
+
this.timeTooltip.show();
|
411
|
+
if (this.tracking) {
|
412
|
+
this.timeTooltip.text(this.positionToStr(this.lastTrackPosition));
|
413
|
+
}
|
414
|
+
else {
|
415
|
+
this.timeTooltip.text(this.positionToStr(this.position));
|
416
|
+
}
|
417
|
+
this.setTooltipPosition(this.seekHead.position().left + (this.seekHead.width() / 2));
|
418
|
+
}
|
419
|
+
else if (this.overBody && this.overBodyMousePos) {
|
420
|
+
this.timeTooltip.show();
|
421
|
+
this.timeTooltip.text(this.positionToStr(this.pageXToPosition(this.overBodyMousePos.x)));
|
422
|
+
this.setTooltipPosition(this.overBodyMousePos.x - this.bodyDiv.offset().left);
|
423
|
+
}
|
424
|
+
else {
|
425
|
+
this.timeTooltip.hide();
|
426
|
+
}
|
427
|
+
};
|
428
|
+
|
429
|
+
AccessibleSlider.prototype.setTooltipPosition = function (x) {
|
430
|
+
this.timeTooltip.css({
|
431
|
+
left: x - (this.timeTooltip.width() / 2) - 10,
|
432
|
+
bottom: this.seekHead.height() + 10
|
433
|
+
});
|
434
|
+
};
|
435
|
+
|
436
|
+
AccessibleSlider.prototype.positionToStr = function (seconds) {
|
437
|
+
|
438
|
+
// same logic as misc.js > formatSecondsAsColonTime()
|
439
|
+
var dHours = Math.floor(seconds / 3600);
|
440
|
+
var dMinutes = Math.floor(seconds / 60) % 60;
|
441
|
+
var dSeconds = Math.floor(seconds % 60);
|
442
|
+
if (dSeconds < 10) {
|
443
|
+
dSeconds = '0' + dSeconds;
|
444
|
+
}
|
445
|
+
if (dHours > 0) {
|
446
|
+
if (dMinutes < 10) {
|
447
|
+
dMinutes = '0' + dMinutes;
|
448
|
+
}
|
449
|
+
return dHours + ':' + dMinutes + ':' + dSeconds;
|
450
|
+
}
|
451
|
+
else {
|
452
|
+
return dMinutes + ':' + dSeconds;
|
453
|
+
}
|
454
|
+
};
|
454
455
|
|
455
456
|
})(jQuery);
|