Load every soundtrack when the search page opens
This commit is contained in:
1 parent
080bacae80
commit
b5dc42b654
1 file changed
+2
-4
@@ -3,14 +3,12 @@ package web
|
||||
templ SearchForm() {
|
||||
@Base() {
|
||||
<button id="dark-mode-toggle">🌙</button>
|
||||
<input id="search_term" name="search_term" type="text" hx-post="/find" hx-trigger="keyup changed delay:0.25s" hx-target="#soundtracks-container"/>
|
||||
<input id="search_term" name="search_term" type="text" hx-post="/find" hx-trigger="load, keyup changed delay:0.25s" hx-target="#soundtracks-container"/>
|
||||
<button type="button" id="clear" name="clear">Clear</button>
|
||||
<div id="soundtracks-container"></div>
|
||||
<script>
|
||||
document.addEventListener('readystatechange', () => {
|
||||
if (document.readyState == 'complete') {
|
||||
// Initialize search
|
||||
htmlx.ajax('POST', '/find', '#soundtracks-container');
|
||||
document.getElementById("search_term").focus();
|
||||
|
||||
// Initialize theme from localStorage (default to dark)
|
||||
@@ -35,7 +33,7 @@ templ SearchForm() {
|
||||
|
||||
document.getElementById("clear").addEventListener("click", function (event) {
|
||||
document.getElementById("search_term").value = "";
|
||||
htmlx.ajax('POST', '/find', '#soundtracks-container');
|
||||
htmx.ajax('POST', '/find', '#soundtracks-container');
|
||||
document.getElementById("search_term").focus();
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user