/[web]/doc/installer/2/el/common/main.js
ViewVC logotype

Contents of /doc/installer/2/el/common/main.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1413 - (show annotations) (download) (as text)
Mon Jul 9 14:49:12 2012 UTC (11 years, 9 months ago) by grenoya
File MIME type: application/javascript
File size: 5592 byte(s)
- add EL, EO, FR, NL, PT_BR and UK pages (still no link from index)
1 /**
2 * Miscellaneous js functions for WebHelp
3 * Kasun Gajasinghe, http://kasunbg.blogspot.com
4 * David Cramer, http://www.thingbag.net
5 *
6 */
7
8 $(document).ready(function() {
9 // $("#showHideHighlight").button(); //add jquery button styling to 'Go' button
10 //Generate tabs in nav-pane with JQuery
11 $(function() {
12 $("#tabs").tabs({
13 cookie: {
14 // store cookie for 2 days.
15 expires: 2
16 }
17 });
18 });
19
20 //Generate the tree
21 $("#ulTreeDiv").attr("style","");
22 $("#tree").treeview({
23 collapsed: true,
24 animated: "medium",
25 control: "#sidetreecontrol",
26 persist: "cookie"
27 });
28
29 //after toc fully styled, display it. Until loading, a 'loading' image will be displayed
30 $("#tocLoading").attr("style","display:none;");
31 // $("#ulTreeDiv").attr("style","display:block;");
32
33 //.searchButton is the css class applied to 'Go' button
34 $(function() {
35 $("button", ".searchButton").button();
36
37 $("button", ".searchButton").click(function() { return false; });
38 });
39
40 //'ui-tabs-1' is the cookie name which is used for the persistence of the tabs.(Content/Search tab)
41 if ($.cookie('ui-tabs-1') === '1') { //search tab is visible
42 if ($.cookie('textToSearch') != undefined && $.cookie('textToSearch').length > 0) {
43 document.getElementById('textToSearch').value = $.cookie('textToSearch');
44 Verifie('diaSearch_Form');
45 searchHighlight($.cookie('textToSearch'));
46 $("#showHideHighlight").css("display","block");
47 }
48 }
49
50 syncToc(); //Synchronize the toc tree with the content pane, when loading the page.
51 //$("#doSearch").button(); //add jquery button styling to 'Go' button
52 });
53
54 /**
55 * Synchronize with the tableOfContents
56 */
57 function syncToc(){
58 var a = document.getElementById("webhelp-currentid");
59 if (a != undefined) {
60 var b = a.getElementsByTagName("a")[0];
61
62 if (b != undefined) {
63 //Setting the background for selected node.
64 var style = a.getAttribute("style");
65 if (style != null && !style.match(/background-color: Background;/)) {
66 a.setAttribute("style", "background-color: #6495ed; " + style);
67 b.setAttribute("style", "color: white;");
68 } else if (style != null) {
69 a.setAttribute("style", "background-color: #6495ed; " + style);
70 b.setAttribute("style", "color: white;");
71 } else {
72 a.setAttribute("style", "background-color: #6495ed; ");
73 b.setAttribute("style", "color: white;");
74 }
75 }
76
77 //shows the node related to current content.
78 //goes a recursive call from current node to ancestor nodes, displaying all of them.
79 while (a.parentNode && a.parentNode.nodeName) {
80 var parentNode = a.parentNode;
81 var nodeName = parentNode.nodeName;
82
83 if (nodeName.toLowerCase() == "ul") {
84 parentNode.setAttribute("style", "display: block;");
85 } else if (nodeName.toLocaleLowerCase() == "li") {
86 parentNode.setAttribute("class", "collapsable");
87 parentNode.firstChild.setAttribute("class", "hitarea collapsable-hitarea ");
88 }
89 a = parentNode;
90 }
91 }
92 }
93
94 /**
95 * Code for Show/Hide TOC
96 *
97 */
98 function showHideToc() {
99 var showHideButton = $("#showHideButton");
100 var leftNavigation = $("#leftnavigation");
101 var content = $("#content");
102
103 if (showHideButton != undefined && showHideButton.hasClass("pointLeft")) {
104 //Hide TOC
105 showHideButton.removeClass('pointLeft').addClass('pointRight');
106 content.css("margin", "0 0 0 0");
107 leftNavigation.css("display","none");
108 showHideButton.attr("title", "Show the TOC tree");
109 } else {
110 //Show the TOC
111 showHideButton.removeClass('pointRight').addClass('pointLeft');
112 content.css("margin", "0 0 0 280px");
113 leftNavigation.css("display","block");
114 showHideButton.attr("title", "Hide the TOC Tree");
115 }
116 }
117
118 /**
119 * Code for searh highlighting
120 */
121 var highlightOn = true;
122 function searchHighlight(searchText) {
123 highlightOn = true;
124 if (searchText != undefined) {
125 var wList;
126 var sList = new Array(); //stem list
127 //Highlight the search terms
128 searchText = searchText.toLowerCase().replace(/<\//g, "_st_").replace(/\$_/g, "_di_").replace(/\.|%2C|%3B|%21|%3A|@|\/|\*/g, " ").replace(/(%20)+/g, " ").replace(/_st_/g, "</").replace(/_di_/g, "%24_")
129 searchText = searchText.replace(/ +/g, " ");
130 searchText = searchText.replace(/ $/, "").replace(/^ /, "");
131
132 wList = searchText.split(" ");
133 $("#content").highlight(wList); //Highlight the search input
134
135 if(typeof stemmer != "undefined" ){
136 //Highlight the stems
137 for (var i = 0; i < wList.length; i++) {
138 var stemW = stemmer(wList[i]);
139 sList.push(stemW);
140 }
141 } else {
142 sList = wList;
143 }
144 $("#content").highlight(sList); //Highlight the search input's all stems
145 }
146 }
147
148 function searchUnhighlight(){
149 highlightOn = false;
150 //unhighlight the search input's all stems
151 $("#content").unhighlight();
152 $("#content").unhighlight();
153 }
154
155 function toggleHighlight(){
156 if(highlightOn) {
157 searchUnhighlight();
158 } else {
159 searchHighlight($.cookie('textToSearch'));
160 }
161 }

  ViewVC Help
Powered by ViewVC 1.1.30