Fixes #4001: TOC contains parent books, and add links to previous and next book.
[wolnelektury.git] / src / wolnelektury / static / js / book_text / toc.js
index 31f4e9f..d03bbb9 100644 (file)
@@ -1,9 +1,17 @@
 (function($){$(function(){
 
+    if ($("#toc a").length > 0) {
+        $("#toc > ol").appendTo($("#heretoc"));
+    }
 
-if ($('#toc li').length > 0) {
-    $('#menu-toc').show();
-}
+    if ($('#wltoc li').length > 0) {
+        $('#menu-toc').show();
+    }
 
+    if ($('#wltoc li a').length == 0) {
+        $('#menu li a[href="#wltoc"]').remove();
+    }
+
+    $("#toc").remove();
 
 })})(jQuery);