summaryrefslogtreecommitdiffstats
path: root/src/ftvhelp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ftvhelp.cpp')
-rw-r--r--src/ftvhelp.cpp96
1 files changed, 52 insertions, 44 deletions
diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp
index da38392..27310ca 100644
--- a/src/ftvhelp.cpp
+++ b/src/ftvhelp.cpp
@@ -663,54 +663,64 @@ void FTVHelp::generateTreeView()
t << " <script type=\"text/javascript\">\n";
t << " <!-- // Hide script from old browsers\n";
t << " \n";
- t << " function findChildNode(node, name) \n";
- t << " {\n";
- t << " var temp;\n";
- t << " if (node == null) \n";
- t << " {\n";
- t << " return null;\n";
- t << " } \n";
- t << " node = node.firstChild;\n";
- t << " while (node != null) \n";
- t << " {\n";
- t << " if (node.nodeName == name) \n";
- t << " {\n";
- t << " return node;\n";
- t << " }\n";
- t << " temp = findChildNode(node, name);\n";
- t << " if (temp != null) \n";
- t << " {\n";
- t << " return temp;\n";
- t << " }\n";
- t << " node = node.nextSibling;\n";
- t << " }\n";
- t << " return null;\n";
- t << " }\n";
- t << "\n";
+ //t << " function findChildNode(node, name) \n";
+ //t << " {\n";
+ //t << " var temp;\n";
+ //t << " if (node == null) \n";
+ //t << " {\n";
+ //t << " return null;\n";
+ //t << " } \n";
+ //t << " node = node.firstChild;\n";
+ //t << " while (node != null) \n";
+ //t << " {\n";
+ //t << " if (node.nodeName == name) \n";
+ //t << " {\n";
+ //t << " return node;\n";
+ //t << " }\n";
+ //t << " temp = findChildNode(node, name);\n";
+ //t << " if (temp != null) \n";
+ //t << " {\n";
+ //t << " return temp;\n";
+ //t << " }\n";
+ //t << " node = node.nextSibling;\n";
+ //t << " }\n";
+ //t << " return null;\n";
+ //t << " }\n";
+ //t << "\n";
+
+ /* User has clicked on a node (folder or +/-) in the tree */
t << " function toggleFolder(id, imageNode) \n";
t << " {\n";
t << " var folder = document.getElementById(id);\n";
- t << " var l = 0;\n";
- t << " var vl = \"" FTV_ICON_FILE(vertline) "\";\n";
- t << " if (imageNode != null && imageNode.nodeName != \"IMG\") \n";
+ t << " var l = imageNode.src.length;\n";
+ /* If the user clicks on the book icon, we move left one image so
+ * the code (below) will also adjust the '+' icon.
+ */
+ t << " if (imageNode.src.substring(l-20,l)==\"" FTV_ICON_FILE(folderclosed) "\" || \n";
+ t << " imageNode.src.substring(l-18,l)==\"" FTV_ICON_FILE(folderopen) "\")\n";
t << " {\n";
- t << " imageNode = findChildNode(imageNode, \"IMG\");\n";
- t << " if (imageNode!=null) l = imageNode.src.length;\n";
+ t << " imageNode = imageNode.previousSibling;\n";
+ t << " l = imageNode.src.length;\n";
t << " }\n";
+ //t << " var vl = \"" FTV_ICON_FILE(vertline) "\";\n";
+ //t << " if (imageNode != null && imageNode.nodeName != \"IMG\") \n";
+ //t << " {\n";
+ //t << " imageNode = findChildNode(imageNode, \"IMG\");\n";
+ //t << " if (imageNode!=null) l = imageNode.src.length;\n";
+ //t << " }\n";
t << " if (folder == null) \n";
t << " {\n";
t << " } \n";
+ /* Node controls a open section, we need to close it */
t << " else if (folder.style.display == \"block\") \n";
t << " {\n";
- t << " while (imageNode != null && \n";
- t << " imageNode.src.substring(l-vl.length,l) == vl)\n";
- t << " {\n";
- t << " imageNode = imageNode.nextSibling;\n";
- t << " l = imageNode.src.length;\n";
- t << " }\n";
+ //t << " while (imageNode != null && \n";
+ //t << " imageNode.src.substring(l-vl.length,l) == vl)\n";
+ //t << " {\n";
+ //t << " imageNode = imageNode.nextSibling;\n";
+ //t << " }\n";
t << " if (imageNode != null) \n";
t << " {\n";
- t << " l = imageNode.src.length;\n";
t << " imageNode.nextSibling.src = \"" FTV_ICON_FILE(folderclosed) "\";\n";
t << " if (imageNode.src.substring(l-13,l) == \"" FTV_ICON_FILE(mnode) "\")\n";
t << " {\n";
@@ -723,17 +733,15 @@ void FTVHelp::generateTreeView()
t << " }\n";
t << " folder.style.display = \"none\";\n";
t << " } \n";
- t << " else \n";
+ t << " else \n"; /* section is closed, we need to open it */
t << " {\n";
- t << " while (imageNode != null && \n";
- t << " imageNode.src.substring(l-vl.length,l) == vl)\n";
- t << " {\n";
- t << " imageNode = imageNode.nextSibling;\n";
- t << " l = imageNode.src.length;\n";
- t << " }\n";
+ //t << " while (imageNode != null && \n";
+ //t << " imageNode.src.substring(l-vl.length,l) == vl)\n";
+ //t << " {\n";
+ //t << " imageNode = imageNode.nextSibling;\n";
+ //t << " }\n";
t << " if (imageNode != null) \n";
t << " {\n";
- t << " l = imageNode.src.length;\n";
t << " imageNode.nextSibling.src = \"" FTV_ICON_FILE(folderopen) "\";\n";
t << " if (imageNode.src.substring(l-13,l) == \"" FTV_ICON_FILE(pnode) "\")\n";
t << " {\n";