upd: PWA (#15)

add service worker script block, manifest file, and fix error for share button email
This commit is contained in:
2026-03-26 18:34:11 -04:00
parent 4ed6c18825
commit b1726bba34
2 changed files with 16 additions and 1 deletions

View File

@@ -8,6 +8,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" /> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel='manifest' href='{{ asset('manifest.json') }}'>
<title>{% block title %}Welcome!{% endblock %}</title> <title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}{% endblock %} {% block stylesheets %}{% endblock %}
@@ -15,5 +16,19 @@
<body class='is-preload' onload='{% if onLoad is defined %}{{ onLoad }}{% endif %}'> <body class='is-preload' onload='{% if onLoad is defined %}{{ onLoad }}{% endif %}'>
{% block body %}{% endblock %} {% block body %}{% endblock %}
{% block javascripts %}{% endblock %} {% block javascripts %}{% endblock %}
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js')
.then(registration => {
console.log('ServiceWorker registration successful with scope: ', registration.scope);
})
.catch(error => {
console.log('ServiceWorker registration failed: ', error);
});
});
}
</script>
</body> </body>
</html> </html>

View File

@@ -181,7 +181,7 @@ let saveFailureCount = {{ meta.saveFailureCount }};
<!-- The modal body --> <!-- The modal body -->
<form id="emailForm" class="modal-body"> <form id="emailForm" class="modal-body">
<label for="shareEmail">Enter Friends Email:</label> <label for="shareEmail">Enter Friends Email:</label>
<input type="email" id="shareEmail" name="email" required /> <input type="email" id="shareEmail" name="email" autocomplete=false required />
<button type='button' id="submit" class="btn btn-primary" onclick='shareNote()'>Submit</button> <button type='button' id="submit" class="btn btn-primary" onclick='shareNote()'>Submit</button>
</form> </form>