/*! Help & Manual WebHelp 3 Script functions Copyright (c) 2015-2021 by Tim Green. All rights reserved. Contact: https://www.ec-software.com */ function hmatoc() { // General variables var self = this, atoc_tip = "Jump to: ", atoc_minHeaders = parseInt("3",10), atoc_btntip_off = "No contents for this topic", atoc_btntip_on = "Contents of this topic", atoc_toptip = "Jump to top of page", atoc_top = "Scroll to Top of Page", atoc_linklimit = parseInt("45",10), thisAtoc = "empty", isATOC = false; // Check if the current page is a search results topic function SearchCheck() { var foundHilite = window.location.search.lastIndexOf("zoom_highlight") > 0; if (!foundHilite) { var fontTags = document.getElementsByTagName("FONT"); if (fontTags.length > 0) { var hStyle = ""; for (var cCheck = 0; cCheck < fontTags.length; cCheck++) { hStyle = fontTags[cCheck].style.cssText; if (hStyle.indexOf("BACKGROUND-COLOR")===0) { foundHilite = true; break; } } } } return foundHilite; } // SearchCheck // String fix functions function truncate(str, limit) { var bits, i; if (limit===0) return str; if ((limit > 0) && (limit <= 20)) limit = 20; bits = str.split(''); if (bits.length > limit) { for (i = bits.length - 1; i > -1; --i) { if (i > limit) { bits.length = i; } else if (' ' === bits[i]) { bits.length = i; break; } } bits.push('...'); } return bits.join(''); } function trim(s) { return s.replace(/^\s+|\s+$/g, ""); } function htmlFix(hd) { heading = hd.replace(/\&/g, "&"); hd = hd.replace(//g, ">"); return hd; } // Reposition ATOC menu function atocPos() { var pBody = $("div#hmpagebody"); var headerPos = pBody.position().top + (parseFloat(pBody.css("borderTopWidth"),10) / 2); $("div#autoTocWrapper").css("top", headerPos + "px"); } function initAtoc() { var tocHeads, thisPara, linkText, thisParaClass, subStyle, fullLinkText, linkID, TOClink, autoTOCcontent, TOCbox, clickDelayA, clickDelayB, topicParas, i, isToggle = false, toggleID = "data=\"\"", $HMToggles = $("span[class*=_atoc]").children("a.dropdown-toggle"); // Get the headers with AutoTOC tags topicParas = $("[class*='_atoc']").filter("[class^='p_']").add($HMToggles);// add("span[class='temp_atoc_'],span[class='temp_atocs_']"); if (topicParas.length >= atoc_minHeaders) { tocHeads = []; for (i = 0; i < topicParas.length;i++) { isToggle = false; thisPara = topicParas[i]; linkText = $(topicParas[i]).text(); linkText = trim(linkText); linkText = htmlFix(linkText); thisParaClass = $(thisPara).attr("class"); if (thisParaClass === "dropdown-toggle") { thisParaClass = $(thisPara).parent("span").attr("class"); isToggle = true; } subStyle = (thisParaClass.indexOf("_atocs_") != -1); // Delete non-breaking space for brain-dead IE if (linkText.length == 1) linkText = linkText.replace(/\xa0/,""); if (linkText!=="") { isATOC = true; fullLinkText = linkText.replace(/\"/g,"'"); linkText = truncate(linkText,atoc_linklimit); // Create a target for non-toggles, use toggle ID for toggles if (!isToggle) { linkID = "autoTOC"+i; thisPara.innerHTML = '' + thisPara.innerHTML; toggleID = "data=\"\" "; } else { linkID = thisPara.id; toggleID = "data=\""+linkID+"\" "; } if (!subStyle) { TOClink = '
'+linkText+'
'+linkText+'
'+atoc_top+'