From 068d5cf15a2c82788bf9b25b72b0e13037f3c7e7 Mon Sep 17 00:00:00 2001 From: Kasun Gajasinghe Date: Sun, 2 Oct 2011 06:38:19 +0000 Subject: [PATCH] webhelp - some small rackspace additions, and cleaning up of main.js --- xsl/webhelp/template/common/main.js | 37 ++++++++----------- .../template/content/search/nwSearchFnt.js | 34 +++++------------ 2 files changed, 26 insertions(+), 45 deletions(-) diff --git a/xsl/webhelp/template/common/main.js b/xsl/webhelp/template/common/main.js index 3a8b9a306..35415cd60 100644 --- a/xsl/webhelp/template/common/main.js +++ b/xsl/webhelp/template/common/main.js @@ -5,19 +5,10 @@ * */ -var treesettings = { - collapsed: true, - animated: "medium", - control: "#sidetreecontrol", - persist: "cookie" -}; - //Turn ON and OFF the animations for Show/Hide Sidebar. Extend this to other anime as well if any. var noAnimations=false; $(document).ready(function() { - - // When you click on a link to an anchor, scroll down // 105 px to cope with the fact that the banner // hides the top 95px or so of the page. @@ -43,15 +34,19 @@ $(document).ready(function() { $(function() { $("#tabs").tabs({ cookie: { - // store cookie for 2 days. - expires: 2 + expires: 2 // store cookie for 2 days. } }); }); //Generate the tree $("#ulTreeDiv").attr("style", ""); - $("#tree").treeview(treesettings); + $("#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;"); @@ -133,7 +128,7 @@ function syncToc() { if (style != null && !style.match(/background-color: Background;/)) { a.setAttribute("style", "background-color: #D8D8D8; " + style); b.setAttribute("style", "color: black;"); - } else if (style != null || style != "") { + } else if (style != null) { a.setAttribute("style", "background-color: #D8D8D8; " + style); b.setAttribute("style", "color: black;"); } else { @@ -192,7 +187,7 @@ function syncToc() { */ function showHideToc() { var showHideButton = $("#showHideButton"); - var leftNavigation = $("#sidebar"); + var leftNavigation = $("#sidebar"); //hide the parent div of leftnavigation, ie sidebar var content = $("#content"); var animeTime=75 @@ -200,10 +195,10 @@ function showHideToc() { //Hide TOC showHideButton.removeClass('pointLeft').addClass('pointRight'); - if(noAnimations) { - leftNavigation.css("display", "none"); - content.css("margin", "125px 0 0 0"); - } else { + if(noAnimations) { + leftNavigation.css("display", "none"); + content.css("margin", "125px 0 0 0"); + } else { leftNavigation.hide(animeTime); content.animate( { "margin-left": 0 }, animeTime); } @@ -211,10 +206,10 @@ function showHideToc() { } else { //Show the TOC showHideButton.removeClass('pointRight').addClass('pointLeft'); - if(noAnimations) { + if(noAnimations) { content.css("margin", "125px 0 0 280px"); leftNavigation.css("display", "block"); - } else { + } else { content.animate( { "margin-left": '280px' }, animeTime); leftNavigation.show(animeTime); } @@ -265,4 +260,4 @@ function toggleHighlight() { } else { searchHighlight($.cookie('textToSearch')); } -} +} \ No newline at end of file diff --git a/xsl/webhelp/template/content/search/nwSearchFnt.js b/xsl/webhelp/template/content/search/nwSearchFnt.js index ba802d224..c00a03056 100644 --- a/xsl/webhelp/template/content/search/nwSearchFnt.js +++ b/xsl/webhelp/template/content/search/nwSearchFnt.js @@ -37,10 +37,11 @@ txt_please_wait = "Please wait. Search in progress..."; txt_results_for = "Results for: "; //-------------------------OXYGEN PATCH END------------------------- -/* Cette fonction verifie la validite de la recherche entrre par l utilisateur */ -function Verifie(ditaSearch_Form) { +/* This function verify the validity of search input by the user + Cette fonction verifie la validite de la recherche entrre par l utilisateur */ +function Verifie(searchForm) { - // Check browser compatibitily + // Check browser compatibility if (navigator.userAgent.indexOf("Konquerer") > -1) { alert(txt_browser_not_supported); @@ -48,28 +49,18 @@ function Verifie(ditaSearch_Form) { } //-------------------------OXYGEN PATCH START------------------------- - /* - var expressionInput = document.ditaSearch_Form.textToSearch.value - */ searchTextField = trim(document.searchForm.textToSearch.value); - var expressionInput = searchTextField; - - + var expressionInput = searchTextField; $.cookie('textToSearch', expressionInput); - //-------------------------OXYGEN PATCH END------------------------- - if (expressionInput.length < 1) { // expression is invalid alert(txt_enter_at_least_1_char); // reactive la fenetre de search (utile car cadres) - //-------------------------OXYGEN PATCH START------------------------- - /* - document.ditaSearch_Form.textToSearch.focus(); - */ + //-------------------------OXYGEN PATCH START------------------------ document.searchForm.textToSearch.focus(); //-------------------------OXYGEN PATCH END------------------------- } @@ -113,9 +104,6 @@ function Verifie(ditaSearch_Form) { // OXYGEN PATCH END - EXM-20996 Effectuer_recherche(expressionInput); // reactive la fenetre de search (utile car cadres) - /* - document.ditaSearch_Form.textToSearch.focus(); - */ document.searchForm.textToSearch.focus(); //-------------------------OXYGEN PATCH END------------------------- } @@ -141,7 +129,9 @@ function Effectuer_recherche(expressionInput) { var txt_wordsnotfound = ""; - /*nqu: expressionInput, la recherche est lower cased, plus remplacement des char speciaux*/ + /* expressionInput, search input is lower cased, plus replacement of special chars + * nqu: expressionInput, la recherche est lower cased, plus remplacement des char speciaux + * */ searchFor = expressionInput.toLowerCase().replace(/<\//g, "_st_").replace(/\$_/g, "_di_").replace(/\.|%2C|%3B|%21|%3A|@|\/|\*/g, " ").replace(/(%20)+/g, " ").replace(/_st_/g, "