aboutsummaryrefslogtreecommitdiffstats
path: root/installer/9/es/content/nwSearchFnt.js
diff options
context:
space:
mode:
Diffstat (limited to 'installer/9/es/content/nwSearchFnt.js')
-rw-r--r--installer/9/es/content/nwSearchFnt.js77
1 files changed, 37 insertions, 40 deletions
diff --git a/installer/9/es/content/nwSearchFnt.js b/installer/9/es/content/nwSearchFnt.js
index 65a8bc94..afbb5b93 100644
--- a/installer/9/es/content/nwSearchFnt.js
+++ b/installer/9/es/content/nwSearchFnt.js
@@ -8,6 +8,8 @@
http://kasunbg.blogspot.com/ Kasun Gajasinghe
*/
+/* global txt_browser_not_supported, txt_enter_at_least_1_char, indexerLanguage, w, txt_results_for, fil, txt_no_results_for */
+
//string initialization
var htmlfileList = "htmlFileList.js";
var htmlfileinfoList = "htmlFileInfoList.js";
@@ -89,7 +91,7 @@ function Effectuer_recherche(expressionInput) {
wordsList.sort();
//set the tokenizing method
- if(typeof indexerLanguage != "undefined" && (indexerLanguage=="zh" || indexerLanguage=="ja" ||indexerLanguage=="ko")){
+ if(typeof indexerLanguage !== "undefined" && (indexerLanguage==="zh" || indexerLanguage==="ja" ||indexerLanguage==="ko")){
useCJKTokenizing=true;
} else {
useCJKTokenizing=false;
@@ -116,9 +118,9 @@ function Effectuer_recherche(expressionInput) {
var tempTab = new Array();
// console.log("finalWordsList : " );
// console.log( finalWordsList);
- for(wordToSearch in finalWordsList){
+ for(let wordToSearch in finalWordsList){
var flagAdd = false;
- for(word in w){
+ for(let word in w){
var wordNew = "" ;
wordNew = word.replace( /â/ , 'a');
wordNew = wordNew.replace( /à/g , 'a');
@@ -178,11 +180,11 @@ function Effectuer_recherche(expressionInput) {
// console.log('finalWordsList : ');
// console.log(finalWordsList);
for (var i = cpt - 1; i >= 0; i--) {
- if (fileAndWordList[i] != undefined) {
+ if (fileAndWordList[i] !== undefined) {
linkTab.push("<p>" + txt_results_for + " " + "<span class=\"searchExpression\">" + fileAndWordList[i][0].motslisteDisplay + "</span>" + "</p>");
linkTab.push("<ul class='searchresult'>");
- for (t in fileAndWordList[i]) {
+ for (let t in fileAndWordList[i]) {
//DEBUG: alert(": "+ fileAndWordList[i][t].filenb+" " +fileAndWordList[i][t].motsliste);
//linkTab.push("<li><a href=\"../"+fl[fileAndWordList[i][t].filenb]+"\">"+fl[fileAndWordList[i][t].filenb]+"</a></li>");
var tempInfo = fil[fileAndWordList[i][t].filenb];
@@ -195,7 +197,7 @@ function Effectuer_recherche(expressionInput) {
//file:///home/kasun/docbook/WEBHELP/webhelp-draft-output-format-idea/src/main/resources/web/webhelp/installation.html
var linkString = "<li><a href=" + tempPath + " class='searchResultLink'>" + tempTitle + "</a>";
// var linkString = "<li><a href=\"installation.html\">" + tempTitle + "</a>";
- if ((tempShortdesc != "null")) {
+ if ((tempShortdesc !== "null")) {
linkString += "\n<div class=\"shortdesclink\">" + tempShortdesc + "</div>";
}
linkString += "</li>";
@@ -229,7 +231,7 @@ function tokenize(wordsList){
var cleanwordsList = new Array(); // Array with the words to look for
for(var j in wordsList){
var word = wordsList[j];
- if(typeof stemmer != "undefined" ){
+ if(typeof stemmer !== "undefined" ){
stemQueryMap[stemmer(word)] = word;
} else {
stemQueryMap[word] = word;
@@ -238,13 +240,13 @@ function tokenize(wordsList){
//stemmedWordsList is the stemmed list of words separated by spaces.
for (var t in wordsList) {
wordsList[t] = wordsList[t].replace(/(%22)|^-/g, "");
- if (wordsList[t] != "%20") {
+ if (wordsList[t] !== "%20") {
scriptLetterTab.add(wordsList[t].charAt(0));
cleanwordsList.push(wordsList[t]);
}
}
- if(typeof stemmer != "undefined" ){
+ if(typeof stemmer !== "undefined" ){
//Do the stemming using Porter's stemming algorithm
for (var i = 0; i < cleanwordsList.length; i++) {
var stemWord = stemmer(cleanwordsList[i]);
@@ -280,7 +282,7 @@ function getAvgAsciiValue(word){
var tmp = 0;
var num = word.length < 5 ? word.length:5;
for(var i=0;i<num;i++){
- if(i==5) break;
+ if(i===5) break;
tmp += word.charCodeAt(i);
}
return tmp/num;
@@ -337,7 +339,7 @@ function CJKTokenizer(input){
{
for(var x = 0, y = r.length; x < y; x++)
{
- if(r[x]==a[i]) continue o;
+ if(r[x]===a[i]) continue o;
}
r[r.length] = a[i];
}
@@ -354,7 +356,7 @@ function Scriptfirstchar() {
function addLettre(caract) {
- if (this.strLetters == 'undefined') {
+ if (this.strLetters === 'undefined') {
this.strLetters = caract;
} else if (this.strLetters.indexOf(caract) < 0) {
this.strLetters += caract;
@@ -430,13 +432,13 @@ function onScriptLoadedFunc(e) {
e = e || window.event;
var target = e.target || e.srcElement;
var isComplete = true;
- if (typeof target.readyState != undefined) {
+ if (typeof target.readyState !== undefined) {
- isComplete = (target.readyState == "complete" || target.readyState == "loaded");
+ isComplete = (target.readyState === "complete" || target.readyState === "loaded");
}
if (isComplete) {
ScriptLoader.cpt++;
- if (ScriptLoader.cpt == ScriptLoader.scripts.length) {
+ if (ScriptLoader.cpt === ScriptLoader.scripts.length) {
ScriptLoader.onLoadComplete();
}
}
@@ -455,11 +457,11 @@ function unique(tab) {
var i;
var l = tab.length;
- if (tab[0] != undefined) {
+ if (tab[0] !== undefined) {
a[0] = tab[0];
}
else {
- return -1
+ return -1;
}
for (i = 1; i < l; i++) {
@@ -471,7 +473,7 @@ function unique(tab) {
}
function indexof(tab, element, begin) {
for (var i = begin; i < tab.length; i++) {
- if (tab[i] == element) {
+ if (tab[i] === element) {
return i;
}
}
@@ -492,39 +494,38 @@ function indexof(tab, element, begin) {
function SortResults(mots) {
var fileAndWordList = new Object();
- if (mots.length == 0) {
+ if (mots.length === 0) {
return null;
}
- for (var t in mots) {
+ mots.forEach( function( mot ) {
+ if (typeof mot === "string"){
// get the list of the indices of the files.
- var listNumerosDesFicStr = w[mots[t].toString()];
- //alert ("listNumerosDesFicStr "+listNumerosDesFicStr);
+ var listNumerosDesFicStr = w[ mot.toString() ];
+ if ( typeof listNumerosDesFicStr !== "undefined"){
var tab = listNumerosDesFicStr.split(",");
- //for each file (file's index):
- for (var t2 in tab) {
+ for (let t2 in tab) {
var temp = tab[t2].toString();
- if (fileAndWordList[temp] == undefined) {
-
- fileAndWordList[temp] = "" + mots[t];
+ if (fileAndWordList[temp] === undefined) {
+ fileAndWordList[temp] = "" + mot;
} else {
- fileAndWordList[temp] += "," + mots[t];
+ fileAndWordList[temp] += "," + mot;
}
- }
- }
+ }}}
+ });
var fileAndWordListValuesOnly = new Array();
// sort results according to values
var temptab = new Array();
- for (t in fileAndWordList) {
+ for (let t in fileAndWordList) {
tab = fileAndWordList[t].split(',');
var tempDisplay = new Array();
for (var x in tab) {
- if(stemQueryMap[tab[x]] != undefined){
+ if(typeof stemQueryMap[tab[x]] !== "undefined"){
tempDisplay.push(stemQueryMap[tab[x]]); //get the original word from the stem word.
} else {
tempDisplay.push(tab[x]); //no stem is available. (probably a CJK language)
@@ -536,19 +537,15 @@ function SortResults(mots) {
fileAndWordListValuesOnly.push(fileAndWordList[t]);
}
-
- //alert("t"+fileAndWordListValuesOnly.toString());
-
fileAndWordListValuesOnly = unique(fileAndWordListValuesOnly);
fileAndWordListValuesOnly = fileAndWordListValuesOnly.sort(compare_nbMots);
- //alert("t: "+fileAndWordListValuesOnly.join(';'));
var listToOutput = new Array();
for (var j in fileAndWordListValuesOnly) {
for (t in temptab) {
- if (temptab[t].motsliste == fileAndWordListValuesOnly[j]) {
- if (listToOutput[j] == undefined) {
+ if (temptab[t].motsliste === fileAndWordListValuesOnly[j]) {
+ if (typeof listToOutput[j] === "undefined") {
listToOutput[j] = new Array(temptab[t]);
} else {
listToOutput[j].push(temptab[t]);
@@ -570,7 +567,7 @@ function compare_nbMots(s1, s2) {
var t1 = s1.split(',');
var t2 = s2.split(',');
//alert ("s1:"+t1.length + " " +t2.length)
- if (t1.length == t2.length) {
+ if (t1.length === t2.length) {
return 0;
} else if (t1.length > t2.length) {
return 1;
@@ -581,7 +578,7 @@ function compare_nbMots(s1, s2) {
}
document.onreadystatechange = (function(){
- if (document.readyState == "complete") {
+ if (document.readyState === "complete") {
addHighligthToResults() ;
}
}) ;