From: Kasun Gajasinghe Date: Sat, 4 Dec 2010 11:43:42 +0000 (+0000) Subject: webhelp: Usability improvement - when click on a node in the TOC tree, the child... X-Git-Tag: release/1.79.1~6^2~784 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cca00db99f53e25939f85ab8516fcba431a85542;p=docbook-dsssl webhelp: Usability improvement - when click on a node in the TOC tree, the child nodes will auto populate now. --- diff --git a/xsl/webhelp/template/common/main.js b/xsl/webhelp/template/common/main.js index dee730360..7a06c4deb 100755 --- a/xsl/webhelp/template/common/main.js +++ b/xsl/webhelp/template/common/main.js @@ -5,37 +5,41 @@ * */ -$(document).ready(function() { - // $("#showHideHighlight").button(); //add jquery button styling to 'Go' button +var treesettings = { + collapsed: true, + animated: "medium", + control: "#sidetreecontrol", + persist: "cookie" +}; + +$(document).ready(function() { + // $("#showHideHighlight").button(); //add jquery button styling to 'Go' button //Generate tabs in nav-pane with JQuery $(function() { - $("#tabs").tabs({ - cookie: { - // store cookie for 2 days. - expires: 2 - } - }); + $("#tabs").tabs({ + cookie: { + // store cookie for 2 days. + expires: 2 + } }); + }); //Generate the tree - $("#ulTreeDiv").attr("style",""); - $("#tree").treeview({ - collapsed: true, - animated: "medium", - control: "#sidetreecontrol", - persist: "cookie" - }); + $("#ulTreeDiv").attr("style", ""); + $("#tree").treeview(treesettings); //after toc fully styled, display it. Until loading, a 'loading' image will be displayed - $("#tocLoading").attr("style","display:none;"); -// $("#ulTreeDiv").attr("style","display:block;"); + $("#tocLoading").attr("style", "display:none;"); + // $("#ulTreeDiv").attr("style","display:block;"); //.searchButton is the css class applied to 'Go' button $(function() { - $("button", ".searchButton").button(); + $("button", ".searchButton").button(); - $("button", ".searchButton").click(function() { return false; }); - }); + $("button", ".searchButton").click(function() { + return false; + }); + }); //'ui-tabs-1' is the cookie name which is used for the persistence of the tabs.(Content/Search tab) if ($.cookie('ui-tabs-1') === '1') { //search tab is visible @@ -43,7 +47,7 @@ $(document).ready(function() { document.getElementById('textToSearch').value = $.cookie('textToSearch'); Verifie('diaSearch_Form'); searchHighlight($.cookie('textToSearch')); - $("#showHideHighlight").css("display","block"); + $("#showHideHighlight").css("display", "block"); } } @@ -52,11 +56,38 @@ $(document).ready(function() { }); /** - * Synchronize with the tableOfContents + * Synchronize with the tableOfContents */ -function syncToc(){ +function syncToc() { var a = document.getElementById("webhelp-currentid"); if (a != undefined) { + //Expanding the child sections of the selected node. + var nodeClass = a.getAttribute("class"); + if (nodeClass != null && !nodeClass.match(/collapsable/)) { + a.setAttribute("class", "collapsable"); + //remove display:none; css style from