Merge branch 'master' into production

This commit is contained in:
Cotes Chung 2023-03-31 05:46:37 +08:00
commit 387f0ec64a
No known key found for this signature in database
GPG key ID: 0D9E54843167A808
8 changed files with 49 additions and 40 deletions

View file

@ -2,6 +2,15 @@
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. 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.6.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.6.0...v5.6.1) (2023-03-30)
### Bug Fixes
* **deps:** `tocbot` has no initialization detection ([#957](https://github.com/cotes2020/jekyll-theme-chirpy/issues/957)) ([8225174](https://github.com/cotes2020/jekyll-theme-chirpy/commit/8225174cb5e02fda7b3cc548ec821c876b0a5139))
* mode-toggle leads to Disqus loading failure ([#945](https://github.com/cotes2020/jekyll-theme-chirpy/issues/945)) ([6fec411](https://github.com/cotes2020/jekyll-theme-chirpy/commit/6fec411c18ca5689c467c7b216ddeda02df23623))
* pageviews not updated immediately ([8b4f99c](https://github.com/cotes2020/jekyll-theme-chirpy/commit/8b4f99c87f9a9227f47e84fb39d7b0f551d6f4dd))
## [5.6.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.5.2...v5.6.0) (2023-03-17) ## [5.6.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.5.2...v5.6.0) (2023-03-17)

View file

@ -1,41 +1,39 @@
<!-- <!-- The Disqus lazy loading. -->
The Disqus lazy loading.
-->
<div id="disqus_thread" class="pt-2 pb-2"> <div id="disqus_thread" class="pt-2 pb-2">
<p class="text-center text-muted small"> <p class="text-center text-muted small">Comments powered by <a href="https://disqus.com/">Disqus</a>.</p>
Comments powered by <a href="https://disqus.com/">Disqus</a>.
</p>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var disqus_config = function () { var disqus_config = function () {
this.page.url = '{{ page.url | absolute_url }}'; this.page.url = '{{ page.url | absolute_url }}';
this.page.identifier = '{{ page.url }}'; this.page.identifier = '{{ page.url }}';
}; };
/* Lazy loading */ /* Lazy loading */
var disqus_observer = new IntersectionObserver(function (entries) { var disqus_observer = new IntersectionObserver(
if(entries[0].isIntersecting) { function (entries) {
if (entries[0].isIntersecting) {
(function () { (function () {
var d = document, s = d.createElement('script'); var d = document,
s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js'; s = d.createElement('script');
s.setAttribute('data-timestamp', +new Date()); s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js';
(d.head || d.body).appendChild(s); s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})(); })();
disqus_observer.disconnect(); disqus_observer.disconnect();
} }
}, { threshold: [0] }); },
{ threshold: [0] }
);
disqus_observer.observe(document.querySelector('#disqus_thread')); disqus_observer.observe(document.querySelector('#disqus_thread'));
/* Auto switch theme */ /* Auto switch theme */
function reloadDisqus() { function reloadDisqus() {
if (event.source === window && event.data && if (event.source === window && event.data && event.data.direction === ModeToggle.ID) {
event.data.direction === ModeToggle.ID) {
/* Disqus hasn't been loaded */ /* Disqus hasn't been loaded */
if (typeof DISQUS === "undefined") { if (typeof DISQUS === 'undefined') {
return; return;
} }
@ -45,10 +43,7 @@
} }
} }
const modeToggle = document.querySelector(".mode-toggle"); if (document.querySelector('.mode-toggle')) {
window.addEventListener('message', reloadDisqus);
if (typeof modeToggle !== "undefined") {
window.addEventListener("message", reloadDisqus);
} }
</script> </script>

View file

@ -193,8 +193,8 @@ function fetchProxyPageviews() {
type: 'GET', type: 'GET',
url: PvOpts.getProxyMeta(), url: PvOpts.getProxyMeta(),
dataType: 'jsonp', dataType: 'jsonp',
jsonpCallback: 'displayPageviews',
success: (data) => { success: (data) => {
displayPageviews(data);
PvStorage.saveProxyCache(JSON.stringify(data)); PvStorage.saveProxyCache(JSON.stringify(data));
}, },
error: (jqXHR, textStatus, errorThrown) => { error: (jqXHR, textStatus, errorThrown) => {

View file

@ -1,11 +1,13 @@
export function toc() { export function toc() {
// see: https://github.com/tscanlin/tocbot#usage if (document.querySelector('#core-wrapper h2,#core-wrapper h3')) {
tocbot.init({ // see: https://github.com/tscanlin/tocbot#usage
tocSelector: '#toc', tocbot.init({
contentSelector: '.post-content', tocSelector: '#toc',
ignoreSelector: '[data-toc-skip]', contentSelector: '.post-content',
headingSelector: 'h2, h3', ignoreSelector: '[data-toc-skip]',
orderedList: false, headingSelector: 'h2, h3',
scrollSmooth: false orderedList: false,
}); scrollSmooth: false
});
}
} }

View file

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

View file

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

View file

@ -1,6 +1,6 @@
{ {
"name": "jekyll-theme-chirpy", "name": "jekyll-theme-chirpy",
"version": "5.6.0", "version": "5.6.1",
"description": "A minimal, responsive and feature-rich Jekyll theme for technical writing.", "description": "A minimal, responsive and feature-rich Jekyll theme for technical writing.",
"repository": { "repository": {
"type": "git", "type": "git",
@ -21,15 +21,15 @@
"fixlint": "npm run test -- --fix" "fixlint": "npm run test -- --fix"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.21.0", "@babel/core": "^7.21.3",
"@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.20.2", "@babel/preset-env": "^7.20.2",
"@rollup/plugin-babel": "^6.0.3", "@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-terser": "^0.4.0", "@rollup/plugin-terser": "^0.4.0",
"rimraf": "^4.4.0", "rimraf": "^4.4.1",
"rollup": "^3.19.1", "rollup": "^3.20.2",
"rollup-plugin-license": "^3.0.1", "rollup-plugin-license": "^3.0.1",
"stylelint": "^15.2.0", "stylelint": "^15.3.0",
"stylelint-config-standard-scss": "^7.0.1" "stylelint-config-standard-scss": "^7.0.1"
} }
} }

View file

@ -16,6 +16,9 @@ function build(filename) {
name: 'Chirpy', name: 'Chirpy',
sourcemap: !isProd sourcemap: !isProd
}, },
watch: {
include: `${JS_SRC}/**`
},
plugins: [ plugins: [
babel({ babel({
babelHelpers: 'bundled', babelHelpers: 'bundled',