Skip to content

Commit

Permalink
Merge branch 'hotfix/5.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
cotes2020 committed Jun 17, 2022
2 parents b032977 + 856ef11 commit 232927c
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 43 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ exclude:
- '*.gemspec'
- tools
- README.md
- CHANGELOG.md
- LICENSE
- gulpfile.js
- node_modules
Expand Down
2 changes: 1 addition & 1 deletion _javascript/copyright
Original file line number Diff line number Diff line change
@@ -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
*/
2 changes: 1 addition & 1 deletion _sass/jekyll-theme-chirpy.scss
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion assets/js/dist/categories.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/dist/commons.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/dist/home.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/dist/misc.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/dist/page.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/dist/post.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/dist/pvreport.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 19 additions & 32 deletions assets/js/pwa/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
if (navigator.serviceWorker.controller) {
$notification.toast('show');
/* in case the user ignores the notification */
localStorage.setItem(keyWaiting, true);
}
}
});
});

$btnRefresh.click(() => {
skipWating(registration);
$notification.toast('hide');
});
/* in case the user ignores the notification */
if (registration.waiting) {
$notification.toast('show');
}

if (localStorage.getItem(keyWaiting)) {
registration.addEventListener('updatefound', () => {
registration.installing.addEventListener('statechange', () => {
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);
if (navigator.serviceWorker.controller) {
$notification.toast('show');
}
}
});
});

$btnRefresh.click(() => {
if (registration.waiting) {
registration.waiting.postMessage('SKIP_WAITING');
}
}
});
$notification.toast('hide');
});
}
);

let refreshing = false;

Expand Down
2 changes: 1 addition & 1 deletion jekyll-theme-chirpy.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 232927c

Please sign in to comment.