diff --git a/SHFB/Source/PresentationStyles/Default2022/Templates/TopicTemplate.html b/SHFB/Source/PresentationStyles/Default2022/Templates/TopicTemplate.html index b1919bf2..4f5e78fe 100644 --- a/SHFB/Source/PresentationStyles/Default2022/Templates/TopicTemplate.html +++ b/SHFB/Source/PresentationStyles/Default2022/Templates/TopicTemplate.html @@ -118,12 +118,12 @@ -
+
-
+
-
+
+ +
diff --git a/SHFB/Source/PresentationStyles/Default2022/scripts/presentationStyle.js b/SHFB/Source/PresentationStyles/Default2022/scripts/presentationStyle.js index af9c1473..27a35d77 100644 --- a/SHFB/Source/PresentationStyles/Default2022/scripts/presentationStyle.js +++ b/SHFB/Source/PresentationStyles/Default2022/scripts/presentationStyle.js @@ -21,6 +21,41 @@ // Ignore Spelling: fti json +//=============================================================================================================== +// This section contains the methods used to handle resizing the TOC section + +var resizer, tocDiv; + +window.onload = function() { + resizer = document.getElementById("Resizer"); + tocDiv = document.getElementById("TOCColumn"); + + resizer.addEventListener("mousedown", function(e) { + e.preventDefault(); + document.addEventListener("mousemove", ResizerMouseMove); + document.addEventListener("mouseup", ResizerMouseUp); + }); +} + +function ResizerMouseMove(e) { + const container = document.getElementById("ContentContainer"); + const containerRect = container.getBoundingClientRect(); + const newWidth = e.clientX - containerRect.left - 80; + + // Ensure that divs are not smaller than some arbitrary minimal width + const minWidth = 50; // pixels + const contentDivWidth = containerRect.width - newWidth; + + if (newWidth > minWidth && contentDivWidth > minWidth) { + tocDiv.style.width = newWidth + 'px'; + } +} + +function ResizerMouseUp() { + document.removeEventListener("mousemove", ResizerMouseMove); + document.removeEventListener("mouseup", ResizerMouseUp); +} + //=============================================================================================================== // This section contains the methods used to implement the language filter