* Move src under playlet-lib * Update configuration * Update script * Update script * Working version * Vs code config WIP * Package lock sync * Lint fix * Fix images * Reuse config files * Kind of a working setup * Lock node version * Rename scripts to tools * Fix build scripts, lib url system * Lint fix * rale * Fix args and web server * Load fallbacks and build script cleanups * Remove unused method * no message * no message * Remove generic message field * Lint fix * no message * Use loading indicator on main app * Add playlet lib version to settings --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
42 lines
923 B
Plaintext
42 lines
923 B
Plaintext
function SaveSearchHistory(q as string, maxItems = 10 as integer)
|
|
history = RegistryUtils.Read("search_history")
|
|
if history <> invalid
|
|
history = ParseJson(history)
|
|
else
|
|
history = []
|
|
end if
|
|
|
|
index = ArrayIndexOf(history, q)
|
|
if index <> -1
|
|
history.Delete(index)
|
|
end if
|
|
|
|
history.Unshift(q)
|
|
|
|
if history.Count() > maxItems
|
|
history.Pop()
|
|
end if
|
|
|
|
history = FormatJson(history)
|
|
|
|
RegistryUtils.Write("search_history", history)
|
|
end function
|
|
|
|
function GetSavedSearchHistory(q as string) as object
|
|
history = RegistryUtils.Read("search_history")
|
|
if history = invalid
|
|
return []
|
|
end if
|
|
history = ParseJson(history)
|
|
if q = ""
|
|
return history
|
|
end if
|
|
result = []
|
|
for each keyword in history
|
|
if keyword.InStr(q) = 0
|
|
result.push(keyword)
|
|
end if
|
|
end for
|
|
return result
|
|
end function
|