* default: update watch for new renderer

This commit is contained in:
Dominique Liberda 2023-01-18 06:08:55 +01:00
parent a8596af27c
commit fb6aef0ba6
4 changed files with 27 additions and 10 deletions

View file

@ -1,4 +1,16 @@
<h1>All user's favourites:</h1> <h1>All user's favourites:</h1>
<div style='display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));'> <div style='display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));'>
{{.favourites}} {{start ?favourites}}
{{start _favourites}}
<div>
<a href='watch?v={{.id}}'>
<img src='https://i.ytimg.com/vi/{{.id}}/mqdefault.jpg'><br>
<b>{{.title}}</b>
</a>
<br>Favourited by {{.favourited_by}}
</div>
{{end _favourites}}
{{else ?favourites}}
No favourite videos found :(
{{end ?favourites}}
</div> </div>

View file

@ -1,3 +1,4 @@
{{@player}}
<div><br> <div><br>
<h2>{{.title}}</h2> <h2>{{.title}}</h2>
<div> <div>

View file

@ -5,19 +5,23 @@ source ${cfg[namespace]}/templates/header.shs
declare -A strings declare -A strings
if [[ -s storage/faves ]]; then if [[ -s storage/faves ]]; then
strings[favourites]="" strings[?favourites]=true
else
strings[favourites]="No favorite videos found,<br>you can do it first! ^w^"
fi fi
nested_declare fav
declare -A fav_
IFS=$'\n' IFS=$'\n'
for i in $(tac storage/faves); do for i in $(tac storage/faves); do
IFS=':' IFS=':'
array=($i) array=($i) # please redo me i'm stupid
if [[ ${array[1]} == '' ]]; then if [[ ${array[1]} == '' ]]; then
break break
fi fi
strings[favourites]+="<div><a href='watch?v=${array[1]}'><img src='https://i.ytimg.com/vi/${array[1]}/mqdefault.jpg'><br><b>${array[@]:2:999}</b></a><br>Favourited by ${array[0]}</div>"; fav_[favourited_by]="${array[0]}"
fav_[id]=${array[1]}
fav_[title]=${array[@]:2:999}
nested_add fav fav_
done done
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/index.html" strings[_favourites]="fav"
render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/index.html"

View file

@ -226,9 +226,9 @@ if [[ "${get_data[v]}" ]]; then
strings[comments_list]='An error ocurred during fetching comments.' strings[comments_list]='An error ocurred during fetching comments.'
fi fi
# source "${cfg[namespace]}/templates/header.shs" [[ "${cfg[template]}" == "default" ]] && source "${cfg[namespace]}/templates/header.shs"
# echo "$player_render"
strings[@player]="meow$player_render" strings[@player]="$player_render"
strings[@header]="$(cat "${cfg[namespace]}/templates/themes/${cfg[template]}/elements/top.html")" strings[@header]="$(cat "${cfg[namespace]}/templates/themes/${cfg[template]}/elements/top.html")"
strings[@footer]="$(cat "${cfg[namespace]}/templates/themes/${cfg[template]}/elements/footer.html")" strings[@footer]="$(cat "${cfg[namespace]}/templates/themes/${cfg[template]}/elements/footer.html")"
render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/watch.html" render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/watch.html"