blob: c1f5ce5d91ad4e6e9fb13a277fdc3b1e840f99e8 (
plain)
1
2
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
|
var accessibility = (function() {
var accessibility = {}
accessibility.voiceOver = false
accessibility.init = function(ready) {
accessibility.bind()
if ('MobileAccessibility' in window) {
accessibility.build(ready)
} else {
ready()
}
}
accessibility.build = function(ready) {
MobileAccessibility.usePreferredTextZoom(true);
MobileAccessibility.getTextZoom(function getTextZoomCallback(textZoom) {
console.log('WebView text should be scaled to the preferred value ' + textZoom + '%')
if (textZoom > 100) {
app.accessible = true
$("html").addClass('accessible')
}
});
MobileAccessibility.isVoiceOverRunning(function(state){
console.log('Screen reader: ' + state)
accessibility.voiceOver = state
if (state) {
$('html').addClass('iscroll')
} else {
$('html').addClass('vscroll')
}
ready()
})
}
accessibility.bind = function() {
$("h1").each(function(){
this['aria-label'] = 'Section title is ' + this.innerText
})
if ('MobileAccessibilityNotifications' in window) {
window.addEventListener(MobileAccessibilityNotifications.SCREEN_READER_STATUS_CHANGED,
accessibility.onScreenReaderStatusChanged, false)
}
}
accessibility.onScreenReaderStatusChanged = function(info) {
if (info && typeof info.isScreenReaderRunning !== "undefined") {
if (info.isScreenReaderRunning) {
console.log("Screen reader: ON");
} else {
console.log("Screen reader: OFF");
}
}
}
return accessibility
})()
function stonewash (s) {
return s.replace(/'0/g, '20').replace(/_/g, ' ')
}
|