From 43eb4889503f64e35bedcbf8cfebe5a1c08ea548 Mon Sep 17 00:00:00 2001 From: Felix Nie Date: Sat, 18 Jan 2025 00:16:45 +0800 Subject: [PATCH 1/4] 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/4] 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/4] 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 5323c16d6fd57f3d5f97bfeda4572ef5bb7dc1ad Mon Sep 17 00:00:00 2001 From: Felix Nie Date: Sat, 18 Jan 2025 05:04:17 +0800 Subject: [PATCH 4/4] 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(/\/$/,''); } }); }