all repos — honk @ 742c674f6becec0422be583c9d0baf67b15202e9

my fork of honk

fix search
Anirudh Oppiliappan x@icyphox.sh
Sun, 11 Aug 2024 22:57:41 +0300
commit

742c674f6becec0422be583c9d0baf67b15202e9

parent

46d0becbc1dca5718961e1ef9c7a78467807483f

2 files changed, 20 insertions(+), 2 deletions(-)

jump to
M views/header.htmlviews/header.html

@@ -83,8 +83,6 @@ </details>

{{ else }} <div id="topmenu"> <span><a id="homelink" href="/">home</a></span> - <span><a href="/o">tags</a></span> - <span><a href="/events">events</a></span> <span><a href="/about">about</a></span> {{ if .ShowRSS }} <span><a href="/rss">rss</a></span>
M views/honkpage.htmlviews/honkpage.html

@@ -2,6 +2,26 @@ {{ template "header.html" . }}

<main> <div class="info" id="infobox"> <div id="srvmsg"> +<form action="/q" method="GET" id="searchform"> +<input type="text" name="q" autocomplete=off size=10 id="searchbox" placeholder="search"> + {{ if .Name }} + <script> + const searchBox = document.getElementById('searchbox'); + const searchForm = document.getElementById('searchform'); + + searchForm.addEventListener('submit', function(event) { + event.preventDefault(); + + let query = searchBox.value; + let newQuery = query + ' @self'; + + searchBox.value = newQuery; + + searchForm.submit(); + }); + </script> + {{ end }} +</form> <div> {{ if .Name }} <p>{{ .Name }} <span class="left1em"><a href="/u/{{ .Name }}/rss">rss</a></span>