save username when searching
I CAN program offline without an LLM. ; ) modified: app.py modified: templates/base.html modified: templates/search.html
This commit is contained in:
parent
77c2ef1d83
commit
5577821855
3 changed files with 50 additions and 24 deletions
|
|
@ -172,6 +172,7 @@
|
|||
<div id="search-form" style="width: 90%;">
|
||||
<form action="/search" method="get">
|
||||
<input type="text" id="search-keywords" name="keywords" placeholder="Search for keywords..." style="width: 90%;">
|
||||
<input type="hidden" id="username" name="username" value="{{ username }}">
|
||||
</form>
|
||||
</div>
|
||||
<!-- Chatroom list -->
|
||||
|
|
@ -196,13 +197,14 @@
|
|||
// Function to perform the search
|
||||
function performSearch() {
|
||||
const keywords = document.getElementById("search-keywords").value;
|
||||
const username = document.getElementById("username").value;
|
||||
if (!keywords) {
|
||||
alert("Please enter keywords to search.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Navigate to the search results page with the keywords as a query parameter
|
||||
window.location.href = `/search?keywords=${encodeURIComponent(keywords)}`;
|
||||
window.location.href = `/search?keywords=${encodeURIComponent(keywords)}&username=${username}`;
|
||||
}
|
||||
|
||||
// Add event listener for keyword search the "Enter" key
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue