From cbcb270ed31876b69f1ca4b46c5b7e2a7e3df563 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Thu, 18 Jan 2018 20:57:15 -0800 Subject: [PATCH] add explicit offline mode --- bin/build-sass.js | 4 +++- package-lock.json | 5 +++++ package.json | 1 + routes/_components/Layout.html | 14 +++++++++++++- routes/_components/Timeline.html | 3 +-- routes/_components/VirtualList.html | 2 +- routes/_utils/asyncModules.js | 7 ++++++- routes/_utils/database/statuses.js | 12 ++++-------- scss/themes/_default.scss | 4 +--- scss/themes/_offline.scss | 20 ++++++++++++++++++++ templates/2xx.html | 3 ++- templates/main.js | 9 ++++++--- templates/service-worker.js | 3 ++- 13 files changed, 65 insertions(+), 22 deletions(-) create mode 100644 scss/themes/_offline.scss diff --git a/bin/build-sass.js b/bin/build-sass.js index 1d0d357c..a4fcb160 100755 --- a/bin/build-sass.js +++ b/bin/build-sass.js @@ -15,6 +15,7 @@ const now = require('performance-now') const globalScss = path.join(__dirname, '../scss/global.scss') const defaultThemeScss = path.join(__dirname, '../scss/themes/_default.scss') +const offlineThemeScss = path.join(__dirname, '../scss/themes/_offline.scss') const html2xxFile = path.join(__dirname, '../templates/2xx.html') const scssDir = path.join(__dirname, '../scss') const themesScssDir = path.join(__dirname, '../scss/themes') @@ -37,7 +38,8 @@ function doWatch() { async function compileGlobalSass() { let results = await Promise.all([ render({file: defaultThemeScss, outputStyle: 'compressed'}), - render({file: globalScss, outputStyle: 'compressed'}) + render({file: globalScss, outputStyle: 'compressed'}), + render({file: offlineThemeScss, outputStyle: 'compressed'}) ]) let css = results.map(_ => _.css).join('') diff --git a/package-lock.json b/package-lock.json index f5a85226..c0863a5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3310,6 +3310,11 @@ "repeating": "2.0.1" } }, + "indexeddb-getall-shim": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/indexeddb-getall-shim/-/indexeddb-getall-shim-1.3.1.tgz", + "integrity": "sha1-aOUV06zspHd+/9DP+ZGS248KXoY=" + }, "indexes-of": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz", diff --git a/package.json b/package.json index 3a3d94d8..bab23e21 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "fg-loadcss": "^2.0.1", "font-awesome-svg-png": "^1.2.2", "glob": "^7.1.2", + "indexeddb-getall-shim": "^1.3.1", "intersection-observer": "^0.5.0", "intl-relativeformat": "^2.1.0", "lodash": "^4.17.4", diff --git a/routes/_components/Layout.html b/routes/_components/Layout.html index def3f340..87c2dbd1 100644 --- a/routes/_components/Layout.html +++ b/routes/_components/Layout.html @@ -1,4 +1,4 @@ -<:Window bind:innerHeight='innerHeight'/> +<:Window bind:innerHeight bind:online />