From bc9121af29cae735cb0bf1463422e8fd9bc88598 Mon Sep 17 00:00:00 2001 From: Patrick Tang <36460266+patricksptang@users.noreply.github.com> Date: Mon, 30 Oct 2023 11:11:14 -0700 Subject: [PATCH] fix the search of more... --- .../src/main/webapp/js/search_selection.js | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/step-web/src/main/webapp/js/search_selection.js b/step-web/src/main/webapp/js/search_selection.js index 5f260d3adf..ff3426fb54 100644 --- a/step-web/src/main/webapp/js/search_selection.js +++ b/step-web/src/main/webapp/js/search_selection.js @@ -1252,7 +1252,7 @@ step.searchSelect = { } if (text2Display.length == 0) console.log('group, but no examples'); else { - text2Display = '' + __s.more + '...'; + text2Display = '   ' + __s.more + '...'; if (searchSuggestionsToDisplay[searchResultIndex] !== "") searchSuggestionsToDisplay[searchResultIndex] += "
"; searchSuggestionsToDisplay[searchResultIndex] += '' + text2Display + ""; } @@ -1324,7 +1324,6 @@ step.searchSelect = { str2Search = '%22' + str2Search + '%22'; } else { - if ((str2Search.slice(-1) !== "*") && (!step.searchSelect.wordsWithNoInflection(str2Search))) { step.searchSelect.appendSearchSuggestionsToDisplay(searchSuggestionsToDisplay, searchResultIndex, str2Search, suggestionType, text2Display, "", "", "", limitType, null, false, false, "", ""); @@ -1960,19 +1959,28 @@ step.searchSelect = { return; } if (brCount < suggestionsToDisplay) { - existingSuggestionsToDisplay[suggestToDisplayIndex] += needLineBreak + - '   ' + __s.more + ' with meaning of your search word...'; - if (suggestionType === GREEK_MEANINGS) { - existingSuggestionsToDisplay[suggestToDisplayIndex] += - '
   ' + __s.more + ' with similar Greek spelling...'; + var additionalSuggestionType = suggestionType; + if ((suggestionType === GREEK_MEANINGS) || (suggestionType === HEBREW_MEANINGS)) { + // It it runs out of space to display GREEK_MEANINGS / HEBREW_MEANINGS, the suggestions for GREEK and HEBREW are + // not displayed. Therefore, provide a "more..." option to get the GREEK_MEANINGS / HEBREW_MEANINGS search suggestions + // and another "more..." option to get the GREEK / HEBREW search suggestions. + existingSuggestionsToDisplay[suggestToDisplayIndex] += needLineBreak + + '   ' + __s.more + ' with meaning of your search word...'; + additionalSuggestionType = (suggestionType === GREEK_MEANINGS) ? GREEK : HEBREW; } - else if (suggestionType === HEBREW_MEANINGS) { + if ((additionalSuggestionType === GREEK) || (additionalSuggestionType === HEBREW)) { + if (suggestionType !== additionalSuggestionType ) + existingSuggestionsToDisplay[suggestToDisplayIndex] += '
'; existingSuggestionsToDisplay[suggestToDisplayIndex] += - '
   ' + __s.more + ' with similar Hebrew spelling...'; + '   ' + __s.more + ' with similar ' + additionalSuggestionType.charAt(0) + additionalSuggestionType.slice(1).toLowerCase() + + ' spelling...'; } + else + existingSuggestionsToDisplay[suggestToDisplayIndex] += needLineBreak + + '   ' + __s.more + '...'; } return; },