From c33d3676d0bbe5abc6657ba778bdcc73eecf03b9 Mon Sep 17 00:00:00 2001 From: danpros Date: Wed, 21 Feb 2024 14:00:03 +0700 Subject: [PATCH] Update functions.php --- system/includes/functions.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/system/includes/functions.php b/system/includes/functions.php index f483c35..1e49d85 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -523,7 +523,13 @@ function get_posts($posts, $page = 1, $perpage = 0) $load = << document.addEventListener("DOMContentLoaded", function() { - generateTOC('.post-{$post->date}'); + if (document.getElementById('toc-wrapper.post-{$post->date}').parentNode.classList.contains('post-{$post->date}')) { + generateTOC('.post-{$post->date}'); + } else { + document.getElementById('toc-wrapper.post-{$post->date}').parentNode.classList.add('post-{$post->date}'); + generateTOC('.post-{$post->date}'); + } + }); EOF;