diff options
author | rstular <rok@stular.eu> | 2020-01-29 17:54:19 +0100 |
---|---|---|
committer | rstular <rok@stular.eu> | 2020-01-29 17:54:19 +0100 |
commit | ad02878561178429e4b8fcbd4594d9ce78f4c407 (patch) | |
tree | 075afb9e8bdc32925743a076f4bf1e2af1d7743c | |
parent | TOS & PP changes (diff) | |
download | beziapp-ad02878561178429e4b8fcbd4594d9ce78f4c407.tar beziapp-ad02878561178429e4b8fcbd4594d9ce78f4c407.tar.gz beziapp-ad02878561178429e4b8fcbd4594d9ce78f4c407.tar.bz2 beziapp-ad02878561178429e4b8fcbd4594d9ce78f4c407.tar.lz beziapp-ad02878561178429e4b8fcbd4594d9ce78f4c407.tar.xz beziapp-ad02878561178429e4b8fcbd4594d9ce78f4c407.tar.zst beziapp-ad02878561178429e4b8fcbd4594d9ce78f4c407.zip |
-rw-r--r-- | js/app.js | 11 | ||||
-rw-r--r-- | js/login.js | 2 | ||||
-rw-r--r-- | pages/about.html | 4 | ||||
-rw-r--r-- | pages/absences.html | 2 | ||||
-rw-r--r-- | pages/grades.html | 1 | ||||
-rw-r--r-- | pages/teachers.html | 1 | ||||
-rw-r--r-- | sw.js | 27 |
7 files changed, 32 insertions, 16 deletions
@@ -1,5 +1,12 @@ if ("serviceWorker" in navigator) { navigator.serviceWorker.register("/sw.js") - .then(() => {}) + .then(() => { }) .catch((err) => console.log("Service worker registration failed", err)); -}
\ No newline at end of file +} + +// Listen to messages from service workers. +navigator.serviceWorker.addEventListener('message', (event) => { + if (event.data.msg === "install") { + window.location.replace("/index.html"); + } +});
\ No newline at end of file diff --git a/js/login.js b/js/login.js index ff8d4ed..a7ab25c 100644 --- a/js/login.js +++ b/js/login.js @@ -47,7 +47,7 @@ function login() { localforage.setItem("password", password) ]; Promise.all(promises_to_run).then(function () { - window.location.replace("/pages/teachers.html"); + window.location.replace("/pages/timetable.html"); }); } diff --git a/pages/about.html b/pages/about.html index 1db7e07..28626be 100644 --- a/pages/about.html +++ b/pages/about.html @@ -71,7 +71,7 @@ <div class="col s12"> <h3><b class="title-secondary">Beži</b><span class="title-primary">App</span> </h3> - <h5 class="subheader">Version 1.0.1b</h5> + <h5 class="subheader">Version 1.0.2-beta</h5> </div> </div> <div class="row"> @@ -103,7 +103,7 @@ <div class="collection"> <a href="/pages/tos.html" class="collection-item">Terms of Service</a> <a href="/pages/privacypolicy.html" class="collection-item">Privacy policy</a> - <a href="https://instagram.com/beziapp/" target="_blank" class="collection-item">Report a bug</a> + <a href="https://instagram.com/beziapp/" target="_blank" class="collection-item">Report a bug / Send a suggestion</a> </div> </div> </div> diff --git a/pages/absences.html b/pages/absences.html index d7dbdbf..78bfd79 100644 --- a/pages/absences.html +++ b/pages/absences.html @@ -68,7 +68,7 @@ </li> </ul> - + <br> <div class="container"> <div class="row"> <div class="col s6 l6"> diff --git a/pages/grades.html b/pages/grades.html index 2d6c761..95acd22 100644 --- a/pages/grades.html +++ b/pages/grades.html @@ -88,6 +88,7 @@ <li><a class="waves-effect" id="grade-type"></a></li> </ul> + <br> <div class="container"> <ul class="collapsible" id="grades-collapsible"></ul> </div> diff --git a/pages/teachers.html b/pages/teachers.html index 53eea2a..7e869ca 100644 --- a/pages/teachers.html +++ b/pages/teachers.html @@ -84,6 +84,7 @@ <li><a class="waves-effect" id="teacher-office"></a></li> </ul> + <br> <div class="container"> <table class="highlight"> <thead> @@ -1,5 +1,5 @@ // Change version to cause cache refresh -const static_cache_name = "site-static-v1.0.1"; +const static_cache_name = "site-static-v1.0.2"; // Got them with du -a and minor cleaning up const assets = [ "/img/avatars/asijanec.png", @@ -72,22 +72,29 @@ const assets = [ "/", "/index.html", "/login.html", - "/logout.js" + "/logout.html" ]; importScripts("/js/lib/localforage.min.js"); self.addEventListener("install", (evt) => { // Add localforage.clear() if storage purge is required - evt.waitUntil( - localforage.clear() - ); - - evt.waitUntil( + evt.waitUntil(async function () { + localforage.clear(); caches.open(static_cache_name).then((cache) => { cache.addAll(assets); - }) - ); + }); + + if (!evt.clientId) return; + const client = await clients.get(event.clientId); + + if (!client) return; + + client.postMessage({ + msg: "install" + }); + + }); }); // Delete old caches @@ -106,4 +113,4 @@ self.addEventListener("fetch", (evt) => { evt.respondWith(caches.match(evt.request).then((cache_res) => { return cache_res || fetch(evt.request); })) -});
\ No newline at end of file +}); |