Skip to content

Commit 98017e8

Browse files
committed
feat: update pwa automatically
1 parent 3a8bd88 commit 98017e8

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ $ docker cp cover.webp kungfux.github.io:/workspaces/kungfux.github.io/assets/me
5353
`assets/css/jekyll-theme-chirpy.scss`
5454
- Adjust styles for schemas and code blocks
5555
`assets/css/jekyll-theme-chirpy.scss`
56-
- Align lists by center
57-
`assets/css/jekyll-theme-chirpy.scss`
5856
- Single line post titles
5957
`assets/css/jekyll-theme-chirpy.scss`
6058
- Update site title tag from `<h1>` to `<p>`
6159
`_includes/sidebar.html`
6260
- Add progress bar to back to top
63-
`assets/js/progress.js`, `assets/css/jekyll-theme-chirpy.scss`
61+
`assets/js/progress.js`, `assets/css/jekyll-theme-chirpy.scss`, `_includes/metadata-hook.html`
62+
- Trigger PWA update automatically
63+
`assets/js/auto-update.js`, `_includes/metadata-hook.html`

_includes/metadata-hook.html

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
<script src="/assets/js/progress.js" defer></script>
2+
<script src="/assets/js/auto-update.js" defer></script>

assets/js/auto-update.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const toast = document.getElementById('notification');
2+
toast.addEventListener('shown.bs.toast', () => {
3+
const button = toast.querySelector('.toast-body>button');
4+
button?.click();
5+
});

0 commit comments

Comments
 (0)