From 43eb4889503f64e35bedcbf8cfebe5a1c08ea548 Mon Sep 17 00:00:00 2001 From: Felix Nie Date: Sat, 18 Jan 2025 00:16:45 +0800 Subject: [PATCH 1/8] Fixed the Disqus iframe transparency issue on some browsers --- _includes/my-comments.html | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/_includes/my-comments.html b/_includes/my-comments.html index 8e4377a868f..df81c6b43c3 100644 --- a/_includes/my-comments.html +++ b/_includes/my-comments.html @@ -1,5 +1,17 @@ {% assign disqus = site.disqus | default:site.disqus_shortname %} {% if disqus %} + + + +
-{% endif %} +{% endif %} \ No newline at end of file From 7acc0e48a6f3d24aa7d59ce34f41d170b1267610 Mon Sep 17 00:00:00 2001 From: Felix Nie Date: Sat, 18 Jan 2025 00:27:31 +0800 Subject: [PATCH 2/8] Refined the Disqus config with additional parameter page.identifier --- _includes/my-comments.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_includes/my-comments.html b/_includes/my-comments.html index df81c6b43c3..889d837a11f 100644 --- a/_includes/my-comments.html +++ b/_includes/my-comments.html @@ -22,14 +22,16 @@ config() { this.page.url = w.location.href; this.page.title = d.title; + this.page.identifier = w.location.pathname; }, }); } else { w.disqus_config = function disqusConfig() { this.page.url = w.location.href; this.page.title = d.title; + this.page.identifier = w.location.pathname; }; - w.loadJSDeferred(d.getElementById("_hrefDisqus").href + '/embed.js'); + w.loadJSDeferred(d.getElementById("_hrefDisqus").href + 'embed.js'); } } }(window, document); From d81ba75d04b7312c1bdde72ebd064cc1748de921 Mon Sep 17 00:00:00 2001 From: Felix Nie Date: Sat, 18 Jan 2025 00:37:02 +0800 Subject: [PATCH 3/8] Fixed the light-dark switching functionality of Disqus to work with Hydejack --- _includes/my-comments.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/_includes/my-comments.html b/_includes/my-comments.html index 889d837a11f..2cc81baf1f7 100644 --- a/_includes/my-comments.html +++ b/_includes/my-comments.html @@ -34,5 +34,21 @@ w.loadJSDeferred(d.getElementById("_hrefDisqus").href + 'embed.js'); } } + + d.addEventListener('hydejack-dark-mode-toggle', (e) => { + setTimeout(() => { + if (w.DISQUS) { + w.DISQUS.reset({ + reload: true, + config: function () { + this.page.url = w.location.href; + this.page.title = d.title; + this.page.identifier = w.location.pathname; + } + }); + } + }, 500); + }); + }(window, document); {% endif %} \ No newline at end of file From de1721ea9363777adda74c55a65776206dbf5731 Mon Sep 17 00:00:00 2001 From: Felix Nie Date: Sat, 18 Jan 2025 03:56:06 +0800 Subject: [PATCH 4/8] Modified _config structure to allow the switching among multiple comment platforms --- _includes/head/links-static.html | 4 ++-- _includes/my-comments.html | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/_includes/head/links-static.html b/_includes/head/links-static.html index 18362c67776..7a581db468f 100644 --- a/_includes/head/links-static.html +++ b/_includes/head/links-static.html @@ -25,7 +25,7 @@ {% endif %} -{% assign disqus = site.disqus | default:site.disqus_shortname %} +{% assign disqus = site.comments.disqus %} {% if disqus %} - + {% endif %} \ No newline at end of file diff --git a/_includes/my-comments.html b/_includes/my-comments.html index 8e4377a868f..af549bc64cd 100644 --- a/_includes/my-comments.html +++ b/_includes/my-comments.html @@ -1,4 +1,8 @@ -{% assign disqus = site.disqus | default:site.disqus_shortname %} +{% assign provider = site.comments.provider | default: 'disqus' %} + +{% if provider == "disqus" %} + +{% assign disqus = site.comments.disqus %} {% if disqus %}
@@ -22,3 +26,12 @@ } }(window, document); {% endif %} + +{% elsif provider == "waline" %} + +{% assign waline = site.comments.waline %} +{% if waline %} + +{% endif %} + +{% endif %} \ No newline at end of file From 251033c00d98418ac2a7f095dc69ab8b1a7ef7b1 Mon Sep 17 00:00:00 2001 From: Felix Nie Date: Sat, 18 Jan 2025 05:00:22 +0800 Subject: [PATCH 5/8] Added Waline with auto dark mode --- _includes/my-comments.html | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/_includes/my-comments.html b/_includes/my-comments.html index af549bc64cd..b5e50131ca6 100644 --- a/_includes/my-comments.html +++ b/_includes/my-comments.html @@ -31,7 +31,33 @@ {% assign waline = site.comments.waline %} {% if waline %} - + + + + +
+ + + {% endif %} {% endif %} \ No newline at end of file From e54a6ba1882cef845291b88f7eb92e77af84cf6c Mon Sep 17 00:00:00 2001 From: Felix Nie Date: Sat, 18 Jan 2025 05:03:12 +0800 Subject: [PATCH 6/8] Let /path/ and /path point to the same page --- _includes/my-comments.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_includes/my-comments.html b/_includes/my-comments.html index b5e50131ca6..cd57f11110a 100644 --- a/_includes/my-comments.html +++ b/_includes/my-comments.html @@ -48,7 +48,8 @@ el: '#waline', serverURL: '{{ waline.server }}', dark: document.body.classList.contains('dark-mode') ? 'html.dark-mode' : false, - lang: '{{ waline.locale | default: "en-US" }}' + lang: '{{ waline.locale | default: "en-US" }}', + path: window.location.pathname.replace(/\/$/,'') }); document.addEventListener('hydejack-dark-mode-toggle', (e) => { From 5323c16d6fd57f3d5f97bfeda4572ef5bb7dc1ad Mon Sep 17 00:00:00 2001 From: Felix Nie Date: Sat, 18 Jan 2025 05:04:17 +0800 Subject: [PATCH 7/8] Let /path/ and /path point to the same page --- _includes/my-comments.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_includes/my-comments.html b/_includes/my-comments.html index 2cc81baf1f7..c2ac3991566 100644 --- a/_includes/my-comments.html +++ b/_includes/my-comments.html @@ -22,14 +22,14 @@ config() { this.page.url = w.location.href; this.page.title = d.title; - this.page.identifier = w.location.pathname; + this.page.identifier = w.location.pathname.replace(/\/$/,''); }, }); } else { w.disqus_config = function disqusConfig() { this.page.url = w.location.href; this.page.title = d.title; - this.page.identifier = w.location.pathname; + this.page.identifier = w.location.pathname.replace(/\/$/,''); }; w.loadJSDeferred(d.getElementById("_hrefDisqus").href + 'embed.js'); } @@ -43,7 +43,7 @@ config: function () { this.page.url = w.location.href; this.page.title = d.title; - this.page.identifier = w.location.pathname; + this.page.identifier = w.location.pathname.replace(/\/$/,''); } }); } From 68701c45fa7ea0b74a1002741cc02d5057947945 Mon Sep 17 00:00:00 2001 From: Felix Nie Date: Sun, 19 Jan 2025 03:34:09 +0800 Subject: [PATCH 8/8] Added Waline theme switching for Hydejack --- _includes/my-comments.html | 56 ++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/_includes/my-comments.html b/_includes/my-comments.html index ba09c85e088..22b59d45b30 100644 --- a/_includes/my-comments.html +++ b/_includes/my-comments.html @@ -61,33 +61,55 @@ {% assign waline = site.comments.waline %} {% if waline %} - - + + - -
+ + - + + + + +
{% endif %}