Permalink
Browse files

Design and ServiceWorker changes

- async/await & better http error behavior in ServiceWorker
- single column main section, with CSS Grid for two-column sticky footer
- more custom header (you do the block manually)
- CSS Custom Properties in production, it's almost 2018, it's time
- custom CSS in database instead of custom colors
  • Loading branch information...
myfreeweb committed Nov 6, 2017
1 parent b7fe8d3 commit 83312d85ec464508322869557f3a9c5e64d7038a
View
@@ -18,5 +18,5 @@ windows:
start_directory: sweetroll-be/
layout: main-horizontal
panes:
- stack ghci --with-ghc intero
- stack ghci
- vi library/Sweetroll
View
@@ -17,7 +17,7 @@ The `:serve` command in ghci runs the server in test mode, which means you don't
```bash
$ stack build
$ stack ghci --no-load
$ stack ghci
:serve
$ http -f post localhost:3000/login x=x | sed -Ee 's/.*access_token=([^&]+).*/\1/' > token
View
@@ -45,8 +45,6 @@ styles = new SourceMapExtractor(new PostCSS(styles, {
{ module: require('postcss-nesting') },
{ module: require('postcss-responsive-type') },
{ module: require('postcss-flexbugs-fixes') },
{ module: require('postcss-custom-properties') },
{ module: require('postcss-color-function') },
{ module: require('autoprefixer') },
{ module: require('cssnano') },
],
@@ -115,6 +113,7 @@ const errPages = new Pug([new MergeTrees([
pretty: true,
_: require('lodash'),
qs: require('qs'),
revHash: require('rev-hash'),
helpers: require('./lib/helpers'),
assets: {
hashes: null,
@@ -63,7 +63,7 @@ a, body .ref-context-meta a {
}
}
.entry, .site-author-block, .entry-webmention-form {
.entry, .block {
background: var(--layer-1-color);
border-color: var(--accent-color);
}
@@ -1,6 +1,14 @@
/*! Sweetroll by https://unrelenting.technology */
/* global localforage */
if (!navigator.onLine) {
const title = document.getElementById('cached-title')
title.innerText = 'You are offline'
window.addEventListener('online', e => {
location.reload(true)
})
}
localforage.getItem('cached-pages').then(pages => {
const list = document.getElementById('cached-list')
for (const page of pages) {
@@ -21,12 +21,6 @@ for (i = 0; i < reloaders.length; i++) {
})
}
document.getElementById('author-link').onclick = function () {
var a = document.getElementById('author')
a.setAttribute('tabindex', '-1')
a.focus()
}
function loadJs (u) {
return new Promise(function (resolve, reject) {
const el = document.createElement('script')
@@ -122,11 +116,15 @@ if ('serviceWorker' in navigator) {
})
navigator.serviceWorker.addEventListener('message', e => {
const data = JSON.parse(e.data)
console.log(data)
if (data.event === 'refreshed-in-cache') {
window.location.reload()
} else if (data.event === 'failed') {
document.querySelector('.offline-popup').innerText = 'Failed to load the page: ' + data.err + '. This cached copy is all you have…'
}
})
if ((document.querySelector('meta[name=sw-offline]') || {}).content === 'true') {
document.querySelector('.site-main').insertAdjacentHTML('afterbegin', '<div class="offline-popup">You are offline or on a slow connection. The page is still loading if you are not completely disconnected…</div>')
const msg = navigator.onLine ? 'This page is still loading (either your connection is slow or this server is experiencing problems), it will be refreshed automatically. Maybe.' : 'You are offline, but this page has been cached locally.'
document.querySelector('.site-main').insertAdjacentHTML('afterbegin', '<div class="offline-popup layer-sticky">' + msg + '</div>')
}
}
Oops, something went wrong.

0 comments on commit 83312d8

Please sign in to comment.