From 418099227222baac6c7dab74d40de751325ffd82 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 3 Dec 2024 22:22:20 +0800 Subject: [PATCH 1/6] style: add indentation to js code --- _includes/pageviews/goatcounter.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/_includes/pageviews/goatcounter.html b/_includes/pageviews/goatcounter.html index 20719b4..265b224 100644 --- a/_includes/pageviews/goatcounter.html +++ b/_includes/pageviews/goatcounter.html @@ -8,14 +8,14 @@ const url = `https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/${encodeURIComponent(uri)}.json`; fetch(url) - .then((response) => response.json()) - .then((data) => { - const count = data.count.replace(/\s/g, ''); - pv.innerText = new Intl.NumberFormat().format(count); - }) - .catch((error) => { - pv.innerText = '1'; - }); + .then((response) => response.json()) + .then((data) => { + const count = data.count.replace(/\s/g, ''); + pv.innerText = new Intl.NumberFormat().format(count); + }) + .catch((error) => { + pv.innerText = '1'; + }); } }); From 8280adb901b9d15cc1bc18009553aae8746121d8 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 3 Dec 2024 22:41:28 +0800 Subject: [PATCH 2/6] fix(toc): resume fade up animation in desktop mode (#2085) --- _includes/toc.html | 2 +- _javascript/modules/components/toc/toc-desktop.js | 5 ++++- _sass/pages/_post.scss | 5 +---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/_includes/toc.html b/_includes/toc.html index 883bf13..4dccb2a 100644 --- a/_includes/toc.html +++ b/_includes/toc.html @@ -2,7 +2,7 @@ {% if enable_toc %}
-
+ diff --git a/_javascript/modules/components/toc/toc-desktop.js b/_javascript/modules/components/toc/toc-desktop.js index 5021a72..0aaba48 100644 --- a/_javascript/modules/components/toc/toc-desktop.js +++ b/_javascript/modules/components/toc/toc-desktop.js @@ -15,8 +15,11 @@ export class TocDesktop { } static init() { - if (document.getElementById('toc-wrapper')) { + const $tocWrapper = document.getElementById('toc-wrapper'); + + if ($tocWrapper) { tocbot.init(this.options); + $tocWrapper.classList.remove('invisible'); } } } diff --git a/_sass/pages/_post.scss b/_sass/pages/_post.scss index 19adf3f..caa2fe6 100644 --- a/_sass/pages/_post.scss +++ b/_sass/pages/_post.scss @@ -234,14 +234,11 @@ header { @keyframes fade-up { from { opacity: 0; - position: relative; - top: 2rem; + margin-top: 4rem; } to { opacity: 1; - position: relative; - top: 0; } } From 7ea3545ba3748a25cd234bbaaed3a4e47055ed97 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 5 Dec 2024 21:09:07 +0800 Subject: [PATCH 3/6] refactor: reduce the height of the TOC bottom overlay in desktop mode --- _includes/toc.html | 2 +- _sass/pages/_post.scss | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_includes/toc.html b/_includes/toc.html index 4dccb2a..0f87726 100644 --- a/_includes/toc.html +++ b/_includes/toc.html @@ -2,7 +2,7 @@ {% if enable_toc %}
-