diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-09-03 19:29:08 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-09-03 19:29:08 +0200 |
| commit | 4ed316ba420c5a07338f783c942dce800f14476f (patch) | |
| tree | e962352207706b0101700b59880c8195f5680059 /StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js | |
| parent | 589c423f3d2d4d65347fbd074b71cc067541c477 (diff) | |
rebuild app
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js')
| -rw-r--r-- | StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js | 80 |
1 files changed, 73 insertions, 7 deletions
diff --git a/StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js b/StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js index 614c3796..3cbda2a0 100644 --- a/StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js +++ b/StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js @@ -1,9 +1,75 @@ -$(function(){ - $("h1").each(function(){ - this['aria-label'] = 'Section title is ' + this.innerText - }) -}) +var accessibility = (function() { + + var accessibility = {} + accessibility.voiceOver = false + + accessibility.DEBUG = true + + accessibility.init = function(ready) { + console.log('Accessibility init') + accessibility.bind() + if (accessibility.DEBUG) { + console.log('Accessibility debug mode') + app.accessible = true + accessibility.voiceOver = true + $('html').addClass('vscroll') + $('html').addClass('accessible') + return ready() + } + 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) { + console.log(">>>>>> actual debug mode!") + app.accessible = true + $("html").addClass('accessible') + $('html').addClass('vscroll') + } else { + $('html').addClass('iscroll') + } + 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, ' ') -}
\ No newline at end of file + return s.replace(/'9/g, '19').replace(/'0/g, '20').replace(/_/g, ' ').replace(/-/g, ' - ').replace(/^[013456789][0-9]+/, '') +} |
