This is an automated email from the ASF dual-hosted git repository.

fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-site.git


The following commit(s) were added to refs/heads/main by this push:
     new 5598c94a fix paradox document blank toc entry (#72)
5598c94a is described below

commit 5598c94a5ef5f05443a20322e62509062e4dc646
Author: AndyChen <[email protected]>
AuthorDate: Wed Jan 24 18:17:43 2024 +0800

    fix paradox document blank toc entry (#72)
    
    * fix blank toc entry
    
    * update the original script
---
 content/assets/javascripts/groups.js               | 31 ++++++++++++++++++++++
 .../paradox/_template/assets/javascripts/groups.js | 31 ++++++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git a/content/assets/javascripts/groups.js 
b/content/assets/javascripts/groups.js
index cf812be1..65614b56 100644
--- a/content/assets/javascripts/groups.js
+++ b/content/assets/javascripts/groups.js
@@ -148,6 +148,37 @@ $(function() {
       });
     });
 
+     // Index Page toc
+     $(".toc").each(function() {
+      var tocRoot = $(this);
+      function findHeaderElements(element) {
+        var headerElements = element.find(".header").filter("a");
+        headerElements.each(function() {
+          var headerElement = $(this);
+          // if header hiding by group switch, hide they li parent
+          // otherwise display there li parent
+          if (headerElement.css("display") === "none" ) {
+            var parentLi = headerElement.closest('li');
+            if (parentLi) {
+              parentLi.hide();
+            }
+          } else {
+            var parentLi = headerElement.closest('li');
+            if (parentLi) {
+              parentLi.show();
+            }
+          }
+        });
+        // just in case there is a nested header
+        element.children().each(function() {
+          var childElement = $(this);
+          findHeaderElements(childElement);
+        });
+      }
+
+      findHeaderElements(tocRoot);
+    })
+
     groupChangeListeners.forEach(listener => listener(group, supergroup, 
catalog));
   }
 
diff --git a/src/main/paradox/_template/assets/javascripts/groups.js 
b/src/main/paradox/_template/assets/javascripts/groups.js
index cf812be1..65614b56 100644
--- a/src/main/paradox/_template/assets/javascripts/groups.js
+++ b/src/main/paradox/_template/assets/javascripts/groups.js
@@ -148,6 +148,37 @@ $(function() {
       });
     });
 
+     // Index Page toc
+     $(".toc").each(function() {
+      var tocRoot = $(this);
+      function findHeaderElements(element) {
+        var headerElements = element.find(".header").filter("a");
+        headerElements.each(function() {
+          var headerElement = $(this);
+          // if header hiding by group switch, hide they li parent
+          // otherwise display there li parent
+          if (headerElement.css("display") === "none" ) {
+            var parentLi = headerElement.closest('li');
+            if (parentLi) {
+              parentLi.hide();
+            }
+          } else {
+            var parentLi = headerElement.closest('li');
+            if (parentLi) {
+              parentLi.show();
+            }
+          }
+        });
+        // just in case there is a nested header
+        element.children().each(function() {
+          var childElement = $(this);
+          findHeaderElements(childElement);
+        });
+      }
+
+      findHeaderElements(tocRoot);
+    })
+
     groupChangeListeners.forEach(listener => listener(group, supergroup, 
catalog));
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to