From 845a817b85ec57b1d8092926d4118f56793d583a Mon Sep 17 00:00:00 2001 From: Mimi <1119186082@qq.com> Date: Thu, 2 Jun 2022 14:36:53 +0800 Subject: [PATCH 1/2] Upgrade to disqusjs@3 --- _vendors.yml | 10 ++++------ scripts/filters/comment/disqusjs.js | 2 +- source/js/third-party/comments/disqusjs.js | 5 +++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/_vendors.yml b/_vendors.yml index 65b74aff7..d8e99cc3f 100644 --- a/_vendors.yml +++ b/_vendors.yml @@ -99,14 +99,12 @@ quicklink: integrity: sha256-4kQf9z5ntdQrzsBC3YSHnEz02Z9C1UeW/E9OgnvlzSY= disqusjs_js: name: disqusjs - version: 1.3.0 - file: dist/disqus.js - integrity: sha256-LVaMHPQ2zLqOc5rXSAfr4d1PIkEGNLyyUTDNPZmTtUw= + version: 3.0.0 + file: dist/browser/disqusjs.es2015.umd.min.js disqusjs_css: name: disqusjs - version: 1.3.0 - file: dist/disqusjs.css - integrity: sha256-GxdCIOyfxQ1OBfS99qAIJDoGK1ADuBsxhMTqXG82fAY= + version: 3.0.0 + file: dist/browser/styles/disqusjs.css gitalk_js: name: gitalk version: 1.7.2 diff --git a/scripts/filters/comment/disqusjs.js b/scripts/filters/comment/disqusjs.js index a7a44bb95..42cd3446f 100644 --- a/scripts/filters/comment/disqusjs.js +++ b/scripts/filters/comment/disqusjs.js @@ -10,7 +10,7 @@ hexo.extend.filter.register('theme_inject', injects => { if (!config.enable || !config.shortname || !config.apikey) return; injects.comment.raw('disqusjs', ` -
+
`, {}, { cache: true }); diff --git a/source/js/third-party/comments/disqusjs.js b/source/js/third-party/comments/disqusjs.js index df5f36c26..f22579af1 100644 --- a/source/js/third-party/comments/disqusjs.js +++ b/source/js/third-party/comments/disqusjs.js @@ -14,5 +14,10 @@ document.addEventListener('page:loaded', () => { identifier: CONFIG.page.path, title : CONFIG.page.title }); + window.dsqjs.render(document.querySelector('.disqusjs')); }); }); + +document.addEventListener('pjax:send', () => { + if (window.dsqjs) window.dsqjs.destroy(); +}); From 49871fd59cc95ecc5ca73951629d59d8cc4a508b Mon Sep 17 00:00:00 2001 From: Mimi <1119186082@qq.com> Date: Wed, 24 Aug 2022 09:52:03 +0800 Subject: [PATCH 2/2] Update CDN version --- _vendors.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/_vendors.yml b/_vendors.yml index d8e99cc3f..812fdc969 100644 --- a/_vendors.yml +++ b/_vendors.yml @@ -99,12 +99,14 @@ quicklink: integrity: sha256-4kQf9z5ntdQrzsBC3YSHnEz02Z9C1UeW/E9OgnvlzSY= disqusjs_js: name: disqusjs - version: 3.0.0 + version: 3.0.2 file: dist/browser/disqusjs.es2015.umd.min.js + integrity: sha256-okP99ZQKVpIy7+NogAMpGlIQzJa9XKXhIJcFgdju5bU= disqusjs_css: name: disqusjs - version: 3.0.0 + version: 3.0.2 file: dist/browser/styles/disqusjs.css + integrity: sha256-71XarXwNr1Td27HmZI9zjY+rMzRdush6/glo6VFXp7o= gitalk_js: name: gitalk version: 1.7.2