Add optionalSW parameter

This parameter allows the page to continue loading even if the service
worker does not register correctly. This happens sometimes when
embedding the page via an iframe.

Change-Id: I3eeb866a47673f2a0f1357ec20b6de6c549c7f4c
diff --git a/js/script.js b/js/script.js
index 0daa399..7f5414e 100644
--- a/js/script.js
+++ b/js/script.js
@@ -168,6 +168,23 @@
   document.getElementById('update-available').removeAttribute('hidden');
 }
 
+function initBooklets() {
+  var promises = [];
+  bookletNames.forEach(name => {
+    var p = fetch('concerts/' + name + '.json').then(res => res.json());
+    promises.push(p);
+  });
+
+  Promise.all(promises).then(booklets => {
+    showSection('wait-screen');
+    loadPreviousBookletsList(booklets);
+    checkBooklets(booklets);
+    interval = window.setInterval(_ => {
+      checkBooklets(booklets);
+    }, 15 * 1000);
+  });
+}
+
 window.addEventListener('load', _ => {
   document.getElementById('previous-concerts-btn')
       .addEventListener('click', e => {
@@ -189,24 +206,15 @@
             showUpdateFooter();
           });
 
-          var promises = [];
-          bookletNames.forEach(name => {
-            var p = fetch('concerts/' + name + '.json').then(res => res.json());
-            promises.push(p);
-          });
-
-          Promise.all(promises).then(booklets => {
-            showSection('wait-screen');
-            loadPreviousBookletsList(booklets);
-            checkBooklets(booklets);
-            interval = window.setInterval(_ => {
-              checkBooklets(booklets);
-            }, 15 * 1000);
-          });
+          initBooklets();
         })
         .catch(err => {
-          showSection('cant-install');
-          console.error('The service worker failed to be registered.');
+          if (searchParams.has('optionalSW')) {
+            initBooklets();
+          } else {
+            showSection('cant-install');
+            console.error('The service worker failed to be registered.');
+          }
         });
   } else {
     showSection('no-service-worker');
diff --git a/sw.js b/sw.js
index 006530f..0408279 100644
--- a/sw.js
+++ b/sw.js
@@ -1,4 +1,4 @@
-var CACHE_NAME = 'all-v1.1.4';
+var CACHE_NAME = 'all-v1.1.5';
 var urlsToCache = [
   '/',
   '/css/styles.css',