aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/bbcode.php2
-rw-r--r--library/tableofcontents/jquery.toc.js6
2 files changed, 4 insertions, 4 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 6a1a5a01e..fd92af61e 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -1400,7 +1400,7 @@ function bbcode($Text, $options = []) {
// Check for table of content without params
while(strpos($Text,'[toc]') !== false) {
$toc_id = 'toc-' . random_string(10);
- $Text = preg_replace("/\[toc\]/ism", '<ul id="' . $toc_id . '" class="toc" data-toc=".section-content-wrapper"></ul><script>$("#' . $toc_id . '").toc();</script>', $Text, 1);
+ $Text = preg_replace("/\[toc\]/ism", '<ul id="' . $toc_id . '" class="toc"></ul><script>$(document).ready(function() { let toc_container = $("#' . $toc_id . '").parent().closest("div").attr("id") || ".section-content-wrapper"; $("#' . $toc_id . '").toc({content: "#" + toc_container}); });</script>', $Text, 1);
}
// Check for table of content with params
while(strpos($Text,'[toc') !== false) {
diff --git a/library/tableofcontents/jquery.toc.js b/library/tableofcontents/jquery.toc.js
index fe10850a3..dffbac38f 100644
--- a/library/tableofcontents/jquery.toc.js
+++ b/library/tableofcontents/jquery.toc.js
@@ -2,7 +2,7 @@
* Table of Contents jQuery Plugin - jquery.toc
*
* Copyright 2013 Nikhil Dabas
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
@@ -12,7 +12,7 @@
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations
* under the License.
- *
+ *
* The original script was modified to work within the red#martrix
* - added var pathname
*/
@@ -53,7 +53,7 @@
// What level is the current heading?
var elem = $(this), level = $.map(headingSelectors, function (selector, index) {
return elem.is(selector) ? index : undefined;
- })[0];
+ })[0];
if (level > currentLevel) {
// If the heading is at a deeper level than where we are, start a new nested
// list, but only if we already have some list items in the parent. If we do