mirror of https://github.com/kiwix/libkiwix.git
Hiding of the suggestions drop-down list
- Suggestions disappear when search is performed as a result of pressing enter in the search box.
This commit is contained in:
parent
2083c390b5
commit
9a193735fb
|
@ -125,7 +125,17 @@ function getSearchPattern() {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
let autoCompleteJS = null;
|
||||
|
||||
function closeSuggestions() {
|
||||
if ( autoCompleteJS ) {
|
||||
autoCompleteJS.close();
|
||||
}
|
||||
}
|
||||
|
||||
function updateSearchBoxForLocationChange() {
|
||||
closeSuggestions();
|
||||
document.getElementById("kiwixsearchbox").value = getSearchPattern();
|
||||
}
|
||||
|
||||
|
@ -217,7 +227,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
const kiwixSearchBox = document.querySelector('#kiwixsearchbox');
|
||||
const kiwixSearchFormWrapper = document.querySelector('.kiwix_searchform');
|
||||
|
||||
const autoCompleteJS = new autoComplete(
|
||||
autoCompleteJS = new autoComplete(
|
||||
{
|
||||
selector: "#kiwixsearchbox",
|
||||
placeHolder: kiwixSearchBox.title,
|
||||
|
@ -263,6 +273,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
);
|
||||
|
||||
document.querySelector('#kiwixsearchform').addEventListener('submit', function(event) {
|
||||
closeSuggestions();
|
||||
try {
|
||||
const selectedElem = document.querySelector('.autoComplete_selected > a');
|
||||
if (selectedElem) {
|
||||
|
|
|
@ -202,7 +202,7 @@ R"EXPECTEDRESULT( <img src="../skin/download.png?
|
|||
/* url */ "/ROOT/viewer",
|
||||
R"EXPECTEDRESULT( <link type="text/css" href="./skin/taskbar.css?cacheid=26082885" rel="Stylesheet" />
|
||||
<link type="text/css" href="./skin/css/autoComplete.css?cacheid=08951e06" rel="Stylesheet" />
|
||||
<script type="text/javascript" src="./skin/viewer.js?cacheid=fd00ded7" defer></script>
|
||||
<script type="text/javascript" src="./skin/viewer.js?cacheid=775a48fa" defer></script>
|
||||
<script type="text/javascript" src="./skin/autoComplete.min.js?cacheid=1191aaaf"></script>
|
||||
const blankPageUrl = `${root}/skin/blank.html`;
|
||||
<label for="kiwix_button_show_toggle"><img src="./skin/caret.png?cacheid=22b942b4" alt=""></label>
|
||||
|
|
Loading…
Reference in New Issue