summaryrefslogtreecommitdiffstats
path: root/assets/js/fuji.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/js/fuji.js')
-rw-r--r--assets/js/fuji.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/assets/js/fuji.js b/assets/js/fuji.js
index 4fbd651..66892af 100644
--- a/assets/js/fuji.js
+++ b/assets/js/fuji.js
@@ -51,13 +51,18 @@ function updateUtterancesTheme(utterancesFrame) {
}
}
-// load comment
-document.querySelector('span.post-comment-notloaded').addEventListener('click', loadComment);
+// load comment button only when comment area exist
+if (document.querySelector('span.post-comment-notloaded')) {
+ document.querySelector('span.post-comment-notloaded').addEventListener('click', loadComment);
+}
// remove empty ul in toc if article only have ## and ###
-if (document.querySelectorAll('.sidebar-toc ul ul').length > 0) {
- document.querySelectorAll('.sidebar-toc ul ul').forEach((value, key, parent) => {
- value.setAttribute('style', 'display: none;');
+var secondQueryOfToc = document.querySelectorAll('.sidebar-toc ul ul');
+if (secondQueryOfToc.length > 0) {
+ secondQueryOfToc.forEach((value, key, parent) => {
+ if (value.innerText === '') {
+ value.setAttribute('style', 'display: none;');
+ }
});
}