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;