diff options
| author | Bobby <[email protected]> | 2026-02-11 12:48:01 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-02-11 12:48:01 +0530 |
| commit | 2c567dd96712a887b42cf4df3bdaa9f5f2b51a43 (patch) | |
| tree | 82c408110dff2898e64688111b08c1d79043d247 /static/js/app.js | |
| parent | 519a4a81bc3ae4738835a1fcb7cfaf72a06bf13b (diff) | |
| download | cafe-2c567dd96712a887b42cf4df3bdaa9f5f2b51a43.tar.xz cafe-2c567dd96712a887b42cf4df3bdaa9f5f2b51a43.zip | |
Refactor homepage and error templates, add service worker and manifest for PWA support
Diffstat (limited to 'static/js/app.js')
| -rw-r--r-- | static/js/app.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/static/js/app.js b/static/js/app.js new file mode 100644 index 0000000..f1ec61e --- /dev/null +++ b/static/js/app.js @@ -0,0 +1,23 @@ +if ('serviceWorker' in navigator) { + window.addEventListener('load', () => { + navigator.serviceWorker.register('/worker.js') + .then(registration => { + console.log('ServiceWorker registered:', registration); + }) + .catch(error => { + console.log('ServiceWorker registration failed:', error); + }); + }); +} + +let deferredPrompt; +window.addEventListener('beforeinstallprompt', (e) => { + e.preventDefault(); + deferredPrompt = e; +}); + +document.body.addEventListener('htmx:afterSwap', (event) => { + event.detail.elt.querySelectorAll('.animate-slide-up').forEach((el, i) => { + el.style.animationDelay = `${i * 0.1}s`; + }); +});
\ No newline at end of file |
