Commit c078db6b9e487c070dca1853f3daf7ead2a72717

Authored by Chung Wang
1 parent 5a0a5435a4

add check for serviceworker and check button

Showing 2 changed files with 14 additions and 3 deletions Side-by-side Diff

scripts/SettingsController.js View file @ c078db6
... ... @@ -28,7 +28,8 @@
28 28 }
29 29  
30 30 console.log("gonna try to launch service worker now");
31   - navigator.serviceWorker.register('scripts/service-worker.js').then(
  31 + if ('serviceWorker' in navigator) {
  32 + navigator.serviceWorker.register('scripts/service-worker.js').then(
32 33 function(serviceWorkerRegistration) {
33 34 serviceWorkerRegistration.pushManager.subscribe().then(
34 35 function(pushSubscription) {
... ... @@ -46,5 +47,11 @@
46 47 }
47 48 );
48 49 });
  50 +
  51 + } else {
  52 + console.log('Service workers aren\'t supported in this browser.');
  53 + }
  54 +
  55 +
49 56 });
templates/settings.html View file @ c078db6
1 1 <div class="card" id="resetPasswordForm">
2 2  
3   - <input type="checkbox" class="js-checkbox" name="notifbox" value="toggle notifs">Check this to enable notifications<br>
  3 + <!--
  4 + class="js-checkbox" name="notifbox" value="toggle notifs"> -->
  5 + <form action="#">
  6 + <input type="checkbox" id = "notifbox" class="js-checkbox" />
  7 + <label for="notifbox">Check this to enable notifications</label>
  8 + </form>
4 9  
5 10 <h2>Change Password</h2>
6 11  
7 12 <div class="row">
8 13 <form class="col s12">
9   -
10 14  
11 15 <div class="row">
12 16 <div class="input-field col s12">