Fix disqus comment count display with PJAX enabled

This commit is contained in:
Mimi 2023-01-02 13:38:50 +08:00
parent 1f02e81b70
commit 29de93d8d7
2 changed files with 8 additions and 8 deletions

View File

@ -25,7 +25,7 @@
// ================================================== // ==================================================
// Post blocks. // Post blocks.
.main-inner { .main-inner {
.sub-menu, .post-block, .tabs-comment, :not(.tab-pane) > .comments, .pagination { .sub-menu, .post-block, .tabs-comment, & > .comments, .comment-position .comments, .pagination {
gemini-block(); gemini-block();
} }
@ -35,7 +35,7 @@
} }
} }
.tabs-comment, :not(.tab-pane) > .comments, .pagination { .tabs-comment, & > .comments, .comment-position .comments, .pagination {
gemini-block-not-first(); gemini-block-not-first();
} }
} }

View File

@ -3,14 +3,14 @@
document.addEventListener('page:loaded', () => { document.addEventListener('page:loaded', () => {
if (CONFIG.disqus.count) { if (CONFIG.disqus.count) {
const loadCount = () => { if (window.DISQUSWIDGETS) {
window.DISQUSWIDGETS.getCount({ reset: true });
} else {
// Defer loading until the whole page loading is completed
NexT.utils.getScript(`https://${CONFIG.disqus.shortname}.disqus.com/count.js`, { NexT.utils.getScript(`https://${CONFIG.disqus.shortname}.disqus.com/count.js`, {
attributes: { id: 'dsq-count-scr' } attributes: { id: 'dsq-count-scr', defer: true }
}); });
}; }
// defer loading until the whole page loading is completed
window.addEventListener('load', loadCount, false);
} }
if (CONFIG.page.comments) { if (CONFIG.page.comments) {