summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib/etc/accessibility.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-09-03 18:14:43 +0200
committerJules Laplace <julescarbon@gmail.com>2019-09-03 18:14:43 +0200
commit0261ee59c47c4a940cd41b526bd891a97c02a6dd (patch)
treef67ee85390c75801de2312b94a624b13326dbae9 /StoneIsland/www/js/lib/etc/accessibility.js
parent6f2af841c17ff4ed28d40121114825a40e8cf6fa (diff)
ditching iscroll
Diffstat (limited to 'StoneIsland/www/js/lib/etc/accessibility.js')
-rw-r--r--StoneIsland/www/js/lib/etc/accessibility.js64
1 files changed, 58 insertions, 6 deletions
diff --git a/StoneIsland/www/js/lib/etc/accessibility.js b/StoneIsland/www/js/lib/etc/accessibility.js
index 614c3796..c1f5ce5d 100644
--- a/StoneIsland/www/js/lib/etc/accessibility.js
+++ b/StoneIsland/www/js/lib/etc/accessibility.js
@@ -1,9 +1,61 @@
-$(function(){
- $("h1").each(function(){
- this['aria-label'] = 'Section title is ' + this.innerText
- })
-})
+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, ' ')
-} \ No newline at end of file
+}