diff options
Diffstat (limited to 'assets/js/fuji.js')
-rw-r--r-- | assets/js/fuji.js | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/assets/js/fuji.js b/assets/js/fuji.js index fbd0359..4bc9d56 100644 --- a/assets/js/fuji.js +++ b/assets/js/fuji.js @@ -98,17 +98,19 @@ document.querySelector('.btn .btn-toggle-mode').addEventListener('click', () => // update medium background updateMeidumTheme(mediumInst); // switch comment area theme - // only works after comment area are initialized + // if this page has comment area let commentArea = document.querySelector('.post-comment'); - let commentStatus = document.querySelector('span.post-comment-notloaded').getAttribute('style'); - if (commentStatus) { - if (commentArea.getAttribute('data-comment') === 'utterances') { - updateUtterancesTheme(document.querySelector('.post-comment iframe')); - } - if (commentArea.getAttribute('data-comment') === 'disqus') { - DISQUS.reset({ - reload: true, - }); + if (commentArea) { + // if comment area loaded + if (document.querySelector('span.post-comment-notloaded').getAttribute('style')) { + if (commentArea.getAttribute('data-comment') === 'utterances') { + updateUtterancesTheme(document.querySelector('.post-comment iframe')); + } + if (commentArea.getAttribute('data-comment') === 'disqus') { + DISQUS.reset({ + reload: true, + }); + } } } }); |