From 98017e82babe3f188cd30ee45b5adfb9b128bce5 Mon Sep 17 00:00:00 2001 From: Alexander Fuks Date: Sat, 26 Oct 2024 11:49:43 +0000 Subject: [PATCH] feat: update pwa automatically --- README.md | 6 +++--- _includes/metadata-hook.html | 1 + assets/js/auto-update.js | 5 +++++ 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 assets/js/auto-update.js diff --git a/README.md b/README.md index 0be4b25..2be1586 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,11 @@ $ docker cp cover.webp kungfux.github.io:/workspaces/kungfux.github.io/assets/me `assets/css/jekyll-theme-chirpy.scss` - Adjust styles for schemas and code blocks `assets/css/jekyll-theme-chirpy.scss` -- Align lists by center - `assets/css/jekyll-theme-chirpy.scss` - Single line post titles `assets/css/jekyll-theme-chirpy.scss` - Update site title tag from `

` to `

` `_includes/sidebar.html` - Add progress bar to back to top - `assets/js/progress.js`, `assets/css/jekyll-theme-chirpy.scss` + `assets/js/progress.js`, `assets/css/jekyll-theme-chirpy.scss`, `_includes/metadata-hook.html` +- Trigger PWA update automatically + `assets/js/auto-update.js`, `_includes/metadata-hook.html` diff --git a/_includes/metadata-hook.html b/_includes/metadata-hook.html index 2b59de2..9bd8d4b 100644 --- a/_includes/metadata-hook.html +++ b/_includes/metadata-hook.html @@ -1 +1,2 @@ + diff --git a/assets/js/auto-update.js b/assets/js/auto-update.js new file mode 100644 index 0000000..ae015cb --- /dev/null +++ b/assets/js/auto-update.js @@ -0,0 +1,5 @@ +const toast = document.getElementById('notification'); +toast.addEventListener('shown.bs.toast', () => { + const button = toast.querySelector('.toast-body>button'); + button?.click(); +});