Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Search history improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Sep 24, 2022
1 parent b53725f commit de98192
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions interface/windows/codes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export const generateCodeElements = (data: LibImportFile) => {
// latest search from history
const latestSearch = settings.searchHistory.latest

if (latestSearch !== null && latestSearch.trim() !== "" && settings.settings.searchHistory === true) {
if (latestSearch !== null && latestSearch.trim() !== "") {
const searchBar: HTMLInputElement = document.querySelector(".search")
searchBar.value = settings.searchHistory.latest

Expand Down Expand Up @@ -218,13 +218,6 @@ export const search = () => {
const input = searchBar.value.toLowerCase()
let noResults = 0

// save results
if (settings.settings.searchHistory === true) {
settings.searchHistory.latest = input

setSettings(settings)
}

// restart
for (let i = 0; i < searchQuery.length; i++) {
const div = document.querySelector(`#codes${[i]}`)
Expand Down Expand Up @@ -259,6 +252,10 @@ export const search = () => {
if (searchQuery.length === noResults) {
document.querySelector(".noSearchResults").style.display = "block"
document.querySelector(".searchResult").textContent = input
} else {
// save results
settings.searchHistory.latest = input
setSettings(settings)
}
}

Expand Down

0 comments on commit de98192

Please sign in to comment.