Commit d765b795b45ba13f1099584d60f29c4d10dd7a2e

Authored by Chung Wang
1 parent e019a8dfd1

Disable button if not android/chrome

Showing 1 changed file with 14 additions and 0 deletions Side-by-side Diff

scripts/SettingsController.js View file @ d765b79
... ... @@ -6,8 +6,10 @@
6 6 };
7 7 console.log('checking to see if chrome');
8 8 if (!chrome) {
  9 + pushSwitch.disabled = true;
9 10 return;
10 11 }
  12 +
11 13 console.log('chrome');
12 14  
13 15 console.log('executing things outside of module');
14 16  
... ... @@ -270,8 +272,20 @@
270 272 }
271 273  
272 274 var enablePushSwitch = $('.js-checkbox');
  275 +
273 276 var pushSwitch = document.getElementById("notifbox");
274 277 pushSwitch.disabled = true;
  278 +
  279 + var ua = navigator.userAgent.toLowerCase();
  280 + var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
  281 +
  282 + if(!isAndroid) {
  283 + // Do something!
  284 + // Redirect to Android-site?
  285 + pushSwitch.disabled = true;
  286 + console.log("not android");
  287 + return;
  288 + }
275 289  
276 290 enablePushSwitch.change(function(e) {
277 291 console.log('checkbox changed');