Service worker should basically be ready

This commit is contained in:
Jason McBrayer 2018-09-19 10:48:27 -04:00
parent 5d848715da
commit e065f6d050
2 changed files with 106 additions and 12 deletions

View File

@ -1,13 +1,105 @@
<!DOCTYPE html>
<html>
<head>
<title>Brutaldon is offline</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>
brutaldon
</title>
<link rel="manifest" href="/static/manifest.webmanifest">
<link rel="stylesheet"
href="/static/css/bulma.min.css">
<link rel="stylesheet"
href="/static/css/fork-awesome.min.css">
<link rel="stylesheet" href="/static/css/brutaldon.css">
<link rel="icon" href="/static/images/brutaldon.png" type="image/png">
</head>
<body>
<h1>Brutaldon is offline</h1>
<p>
Your page request will be fulfilled the next time you are online.
We don't seem to have this particular page in the cache for you.
Terribly sorry.
</p>
<body class="has-navbar-fixed-top">
<div id="page-load-indicator">&nbsp</div>
<nav class="navbar is-fixed-top is-primary" role="navigation"
aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="/home"
<img src="/static/images/brutaldon.png"
class="image is-32x32" alt="Brutaldon">
</a>
</div>
</nav>
<section id="main" class="section" ic-history-elt="true">
<div class="container">
<div class="container">
<img src="/static/images/brutaldon.png"
</div>
<h1 class="title">Brutaldon</h1>
<h2 class="subtitle">a brutalist web interface for Mastodon</h2>
<section class="section">
<p>
Either you are offline currently, or brutaldon is down. Please try again later.
</p>
</section>
</div>
</section>
<footer class="footer">
<div class="level">
<div class="level-left">
<a class="level-item is-size-7" href="/about">
About
</a>
<a class="level-item is-size-7" href="https://github.com/jfmcbrayer/brutaldon">
Source
</a>
</div>
<div class="level-right">
<a class="level-item is-size-7" href="/privacy">
Privacy
</a>
</div>
</div>
</footer>
<script type="application/javascript">
document.addEventListener('DOMContentLoaded', menuPrepare);
$(document).on('handle.onpopstate.ic',
restorePlace);
if (navigator.serviceWorker.controller) {
console.log('[PWA Builder] active service worker found, no need to register')
} else {
//Register the ServiceWorker
navigator.serviceWorker.register('pwabuilder-sw.js', {
scope: '/'
}).then(function(reg) {
console.log('Service worker has been registered for scope:'+ reg.scope);
});
}
Intercooler.ready(function ()
{
$(".attachments").photobox('a', { history: true });
var refresh = new Event('refreshOffline');
self.dispatchEvent(refresh);
});
</script>
</body>
</html>

View File

@ -213,10 +213,6 @@
document.addEventListener('DOMContentLoaded', menuPrepare);
$(document).on('handle.onpopstate.ic',
restorePlace);
Intercooler.ready(function ()
{
$(".attachments").photobox('a', { history: true });
});
if (navigator.serviceWorker.controller) {
console.log('[PWA Builder] active service worker found, no need to register')
} else {
@ -228,6 +224,12 @@
console.log('Service worker has been registered for scope:'+ reg.scope);
});
}
Intercooler.ready(function ()
{
$(".attachments").photobox('a', { history: true });
var refresh = new Event('refreshOffline');
self.dispatchEvent(refresh);
});
</script>
{% block page_scripts_inline %}
{% endblock %}