1
0
mirror of https://gitlab.com/brutaldon/brutaldon.git synced 2024-12-04 14:46:24 -05:00

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> <html>
<head> <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> </head>
<body> <body class="has-navbar-fixed-top">
<h1>Brutaldon is offline</h1> <div id="page-load-indicator">&nbsp</div>
<p>
Your page request will be fulfilled the next time you are online. <nav class="navbar is-fixed-top is-primary" role="navigation"
We don't seem to have this particular page in the cache for you. aria-label="main navigation">
Terribly sorry. <div class="navbar-brand">
</p> <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> </body>
</html> </html>

View File

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