Upgrade to disqusjs@3 (#529)

This commit is contained in:
Mimi 2022-08-25 00:26:22 +08:00 committed by GitHub
parent aacc483fc2
commit 8876fe6238
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 7 deletions

View File

@ -93,14 +93,14 @@ quicklink:
integrity: sha256-4kQf9z5ntdQrzsBC3YSHnEz02Z9C1UeW/E9OgnvlzSY=
disqusjs_js:
name: disqusjs
version: 1.3.0
file: dist/disqus.js
integrity: sha256-LVaMHPQ2zLqOc5rXSAfr4d1PIkEGNLyyUTDNPZmTtUw=
version: 3.0.2
file: dist/browser/disqusjs.es2015.umd.min.js
integrity: sha256-okP99ZQKVpIy7+NogAMpGlIQzJa9XKXhIJcFgdju5bU=
disqusjs_css:
name: disqusjs
version: 1.3.0
file: dist/disqusjs.css
integrity: sha256-GxdCIOyfxQ1OBfS99qAIJDoGK1ADuBsxhMTqXG82fAY=
version: 3.0.2
file: dist/browser/styles/disqusjs.css
integrity: sha256-71XarXwNr1Td27HmZI9zjY+rMzRdush6/glo6VFXp7o=
gitalk_js:
name: gitalk
version: 1.7.2

View File

@ -10,7 +10,7 @@ hexo.extend.filter.register('theme_inject', injects => {
if (!config.enable || !config.shortname || !config.apikey) return;
injects.comment.raw('disqusjs', `
<div class="comments" id="disqus_thread">
<div class="comments disqusjs">
<noscript>Please enable JavaScript to view the comments powered by Disqus.</noscript>
</div>
`, {}, { cache: true });

View File

@ -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();
});