/* global stemmer */ /** * Miscellaneous js functions for WebHelp * Kasun Gajasinghe, http://kasunbg.blogspot.com * David Cramer, http://www.thingbag.net * */ function adjust(){ var headerHeight = $("#header").outerHeight( true ); $("#leftnavigation").css('top' , headerHeight); if(document.body.clientWidth >= 701) $("#content").css('top' , headerHeight+'px'); else $("#content").css('top' , 0+'px'); } $( window ).resize(function() { adjust(); }); $(document).ready(function() { adjust(); var href = window.location.href; var indexOfTermToSearch = href.indexOf('?search='); if (indexOfTermToSearch !== -1) { var term = decodeURI(href.substring(indexOfTermToSearch+8)); $('#textToSearch').val(term); document.cookie='textToSearch='+term; searchHighlight(term); } $(function() { $("#tabs").tabs({ cookie: { expires: 2 } }); }); //Generate the tree $("#ulTreeDiv").attr("style",""); $("#tree").treeview({ collapsed: true, animated: "medium", control: "#sidetreecontrol", persist: "cookie" }); //after toc fully styled, display it. Until loading, a 'loading' image will be displayed $("#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").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 let textToSearch = $.cookie('textToSearch') ; if ( textToSearch !== undefined && textToSearch !== null && textToSearch.length > 0) { document.getElementById('textToSearch').value = $.cookie('textToSearch'); Verifie('diaSearch_Form'); var hcookie = selectTxtToHigh() ; searchHighlight(hcookie); } } syncToc(); //Synchronize the toc tree with the content pane, when loading the page. //$("#doSearch").button(); //add jquery button styling to 'Go' button }); function selectTxtToHigh() { var allCookies = document.cookie.split(";"); var hcookie; for (var iCookie = 0; iCookie < allCookies.length; iCookie++) { var cookie = allCookies[iCookie]; var indexOfEq = cookie.indexOf('='); var key = cookie.substring(0, indexOfEq); if (key.includes( "highlight")){ hcookie = cookie.substring(indexOfEq + 1); } } return hcookie; } /** * Synchronize with the tableOfContents */ function syncToc() { var tocid = document.getElementById("zz_current-id").getAttribute("data-id"); var a = document.getElementById(tocid); if (a !== undefined && a !== null ) { //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