search page overhaul

it now looks as good as the feed, the homepage
and the favourites! :3
additionally, the search page now also mentions
your search term, in case you suddenly decide
to leave that tab alone for some reason and come
back to it later, only to no longer know what you
searched for lol
merge-requests/6/head
4 raccoons in a trenchcoat. / luna vivian 2023-04-20 01:04:03 +02:00
parent 4ddf2f784a
commit 8f15262d01
2 changed files with 18 additions and 9 deletions

View File

@ -1,8 +1,15 @@
{{start _results}}
<a href='/watch?v={{.id}}'>
<img src='https://i.ytimg.com/vi/{{.id}}/mqdefault.jpg'><br>{{.title}}</a>
| {{.runtime}} seconds | {{.views}} views<br>
Uploaded by <a href='/channel/{{.channel_id}}'>{{.channel}}</a><br>
{{end _results}}
{{start ?query}}
<h1>Results for "{{.query}}"</h1>
<div style='display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));'>
{{start _results}}
<div class='video-image-container'>
<a href='watch?v={{.id}}'>
<div class='video-image' style='background-image: url(http://i.ytimg.com/vi/{{.id}}/mqdefault.jpg)'></div>
<b>{{.title}}</b></a><br>
Uploaded by <a href='/channel/{{.channel_id}}'>{{.channel}}</a> · <b>{{.runtime}}</b> · <b>{{.views}}</b> views
</div>
{{end _results}}
</div>
{{else ?query}}
<p>search for something will 'ya?</p>
{{end ?query}}

View File

@ -12,6 +12,8 @@ fi
#https://www.youtube.com/results?search_query=oooo
if [[ "${get_data[search_query]}" ]]; then
query="${get_data[search_query]}"
meow[query]=$(sed -s 's/+/ /g' <<< "${get_data[search_query]}")
meow[?query]=true
query_nice=$(sed -s 's/+/ /g' <<< "${get_data[search_query]}")
fi
@ -34,7 +36,7 @@ if [[ "${get_data[search_query]}" ]]; then
for (( i=0; i<${#id[@]}; i++ )); do
strings[id]="${id[$i]}"
strings[title]="${title[$i]}"
strings[runtime]="${runtime[$i]}"
strings[runtime]="$(date -d "@${runtime[$i]}" "+%H:%M:%S")"
strings[views]="${views[$i]}"
strings[channel_id]="${channel_id[$i]}"
strings[channel]="${channel[$i]}"