diff --git a/service-worker.js b/service-worker.js index 32922c7e..2f8cb368 100644 --- a/service-worker.js +++ b/service-worker.js @@ -1,7 +1,8 @@ //importScripts('/static/dist/lib/cache-polyfill.js'); -var version = 'v0.2'; +var version = 'v0.3'; var CACHE_FILES = [ + '/static/offline/offline.html', 'https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=https://zoff.no/&choe=UTF-8&chld=L%7C1', 'https://fonts.googleapis.com/icon?family=Material+Icons', '/static/dist/lib/jquery-2.1.3.min.js', @@ -179,12 +180,15 @@ self.addEventListener("fetch", function(event) { /* Here we're creating a response programmatically. The first parameter is the response body, and the second one defines the options for the response. */ - return new Response('

Zöff is currently unavailable, sorry

', { + /*return new Response('

Zöff is currently unavailable, sorry

', { status: 503, statusText: 'Service Unavailable', headers: new Headers({ 'Content-Type': 'text/html' }) + });*/ + return caches.open(version + "fundamentals").then(function(cache) { + return cache.match('/static/offline/offline.html'); }); } }) diff --git a/static/offline/offline.html b/static/offline/offline.html new file mode 100644 index 00000000..fb9b2f70 --- /dev/null +++ b/static/offline/offline.html @@ -0,0 +1,244 @@ + + + + + + Zöff + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ +
+
+

Zöff is currently unavailable

+

Have you checked your internet connection lately? Because we require an internet connection to be established to our servers for Zöff to work.

+
+
+ + + + + + +