Skip to content

Commit

Permalink
Skip search suggestion of 0 frequency in 1st modal
Browse files Browse the repository at this point in the history
Show 2 types of more... (by meaning or by spelling
  • Loading branch information
patricksptang committed Oct 30, 2023
1 parent 4ece85e commit faebb1d
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions step-web/src/main/webapp/js/search_selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,7 @@ step.searchSelect = {
}
var alreadyShownStrong = [];
for (var i = 0; i < data.length; i++) {
var skipBecauseOfZeroCount = false;
var suggestionType = data[i].itemType;
var searchResultIndex = step.searchSelect.searchTypeCode.indexOf(suggestionType);
if (searchResultIndex >= step.searchSelect.numOfSearchTypesToDisplay)
Expand Down Expand Up @@ -1389,12 +1390,14 @@ step.searchSelect = {
var hasBothTestaments = ((typeof curWord.vocabInfos[0].versionCountOT === "number") && (curWord.vocabInfos[0].versionCountOT > 0) &&
(typeof curWord.vocabInfos[0].versionCountNT === "number") && (curWord.vocabInfos[0].versionCountNT > 0));
var countDisplay = step.util.formatFrequency(curWord.vocabInfos[0], parseInt(data[i].suggestion.popularity), hasBothTestaments);
if (countDisplay === "0 x") skipBecauseOfZeroCount = true;
text2Display += '<span class="srchFrequency"> ' + countDisplay + '</span>';
}
}
step.searchSelect.appendSearchSuggestionsToDisplay(searchSuggestionsToDisplay, searchResultIndex,
str2Search, suggestionType, text2Display, "", suffixToDisplay, suffixTitle, limitType,
null, false, false, "", allVersions);
if ((!skipBecauseOfZeroCount) || (limitType !== ""))
step.searchSelect.appendSearchSuggestionsToDisplay(searchSuggestionsToDisplay, searchResultIndex,
str2Search, suggestionType, text2Display, "", suffixToDisplay, suffixTitle, limitType,
null, false, false, "", allVersions);
}
break;
case REFERENCE:
Expand Down Expand Up @@ -1953,12 +1956,21 @@ step.searchSelect = {
}
if (brCount < suggestionsToDisplay) {
existingSuggestionsToDisplay[suggestToDisplayIndex] += needLineBreak +
'<a style="padding:0px" title="click to see more suggestions" href="javascript:step.searchSelect._handleEnteredSearchWord(\''
+ suggestionType + '\')"><b>' + __s.more + '...</b></a>';
'&nbsp;&nbsp;&nbsp;<a style="padding:0px" title="click to see more suggestions" href="javascript:step.searchSelect._handleEnteredSearchWord(\''
+ suggestionType + '\')"><b>' + __s.more + ' with meaning of your search word...</b></a>';
if (suggestionType === GREEK_MEANINGS) {
existingSuggestionsToDisplay[suggestToDisplayIndex] +=
'<br>&nbsp;&nbsp;&nbsp;<a style="padding:0px" title="click to see more suggestions" href="javascript:step.searchSelect._handleEnteredSearchWord(\''
+ GREEK + '\')"><b>' + __s.more + ' with similar Greek spelling...</b></a>';
}
else if (suggestionType === HEBREW_MEANINGS) {
existingSuggestionsToDisplay[suggestToDisplayIndex] +=
'<br>&nbsp;&nbsp;&nbsp;<a style="padding:0px" title="click to see more suggestions" href="javascript:step.searchSelect._handleEnteredSearchWord(\''
+ HEBREW + '\')"><b>' + __s.more + ' with similar Hebrew spelling...</b></a>';
}
}
return;
},

extractStrongFromDetailLexicalTag: function(strongNumber, detailLexicalJSON) {
if ((Array.isArray(detailLexicalJSON)) && (detailLexicalJSON.length > 0)) {
var allStrongs = [strongNumber];
Expand Down

0 comments on commit faebb1d

Please sign in to comment.