mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-09 04:06:27 -04:00
Ensure highlighting is cleared when user empties field
Former-commit-id: d9c7cb92d82dd1b94fc7621ae58dda5dd6aa36fe [formerly 5e13078daecafbf8e549fdec1bc312058d6486f9] Former-commit-id: c39cd7c6b8fb7306a702438084fd6006783499ee
This commit is contained in:
parent
7e0da0e3c9
commit
58ae3d4176
@ -336,15 +336,13 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
||||
window.clearTimeout(window.timeoutFIAKeyup);
|
||||
}
|
||||
window.timeoutFIAKeyup = window.setTimeout(function () {
|
||||
if (val && val.length > 0) {
|
||||
findInArticleInitiate(val);
|
||||
}
|
||||
findInArticleInitiate(val);
|
||||
}, 500);
|
||||
};
|
||||
var findInArticleInitiate = function (val) {
|
||||
//Ensure nothing happens if only one or two ASCII values have been entered (search is not specific enough)
|
||||
//if no value has been entered (clears highlighting if user deletes all values in search field)
|
||||
if (!/^\s*[\w\s]{1,2}$/.test(val)) {
|
||||
if (!/^\s*[A-Za-z\s]{1,2}$/.test(val)) {
|
||||
localSearch.scrollFrom = 0;
|
||||
localSearch.lastScrollValue = val;
|
||||
localSearch.setMatchType('open');
|
||||
|
Loading…
x
Reference in New Issue
Block a user