Merge branch 'hotfix/5.2.1'

This commit is contained in:
Cotes Chung 2022-06-18 00:09:27 +08:00
commit 232927c47c
No known key found for this signature in database
GPG Key ID: 0D9E54843167A808
14 changed files with 42 additions and 46 deletions

View File

@ -2,6 +2,14 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [5.2.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.2.0...v5.2.1) (2022-06-17)
### Bug Fixes
* exclude CHANGELOG from output ([971fe03](https://github.com/cotes2020/jekyll-theme-chirpy/commit/971fe03ec329ae49e7d60fe3af6101cfbd1acd6c))
* **PWA:** sometimes update notification is not triggered ([96af729](https://github.com/cotes2020/jekyll-theme-chirpy/commit/96af7291ea5b2c5ed6372e7b6f7725e67c69f1ba))
## [5.2.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.1.0...v5.2.0) (2022-06-09)

View File

@ -185,6 +185,7 @@ exclude:
- '*.gemspec'
- tools
- README.md
- CHANGELOG.md
- LICENSE
- gulpfile.js
- node_modules

View File

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View File

@ -1,7 +1,7 @@
/*!
* The styles for Jekyll theme Chirpy
*
* Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy)
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy)
* © 2019 Cotes Chung
* MIT Licensed
*/

View File

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View File

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View File

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View File

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View File

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View File

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View File

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View File

@ -3,50 +3,37 @@ layout: compress
permalink: '/app.js'
---
const keyWaiting = 'sw-waiting';
const $notification = $('#notification');
const $btnRefresh = $('#notification .toast-body>button');
function skipWating(registration) {
registration.waiting.postMessage('SKIP_WAITING');
localStorage.removeItem(keyWaiting);
}
if ('serviceWorker' in navigator) {
/* Registering Service Worker */
navigator.serviceWorker.register('{{ "/sw.js" | relative_url }}')
.then(registration => {
if (registration) {
registration.addEventListener('updatefound', () => {
let serviceWorker = registration.installing;
serviceWorker.addEventListener('statechange', () => {
if (serviceWorker.state === 'installed') {
/* in case the user ignores the notification */
if (registration.waiting) {
$notification.toast('show');
}
registration.addEventListener('updatefound', () => {
registration.installing.addEventListener('statechange', () => {
if (registration.waiting) {
if (navigator.serviceWorker.controller) {
$notification.toast('show');
/* in case the user ignores the notification */
localStorage.setItem(keyWaiting, true);
}
}
});
});
$btnRefresh.click(() => {
skipWating(registration);
if (registration.waiting) {
registration.waiting.postMessage('SKIP_WAITING');
}
$notification.toast('hide');
});
if (localStorage.getItem(keyWaiting)) {
if (registration.waiting) {
/* there's a new Service Worker waiting to be activated */
$notification.toast('show');
} else {
/* closed all open pages after receiving notification */
localStorage.removeItem(keyWaiting);
}
}
}
});
);
let refreshing = false;

View File

@ -2,7 +2,7 @@
Gem::Specification.new do |spec|
spec.name = "jekyll-theme-chirpy"
spec.version = "5.2.0"
spec.version = "5.2.1"
spec.authors = ["Cotes Chung"]
spec.email = ["cotes.chung@gmail.com"]

View File

@ -1,6 +1,6 @@
{
"name": "jekyll-theme-chirpy",
"version": "5.2.0",
"version": "5.2.1",
"description": "A minimal, responsive, and powerful Jekyll theme for presenting professional writing.",
"repository": {
"type": "git",