* default: update watch for new renderer

merge-requests/6/head
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>
<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>

View File

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

View File

@ -5,19 +5,23 @@ source ${cfg[namespace]}/templates/header.shs
declare -A strings
if [[ -s storage/faves ]]; then
strings[favourites]=""
else
strings[favourites]="No favorite videos found,<br>you can do it first! ^w^"
strings[?favourites]=true
fi
nested_declare fav
declare -A fav_
IFS=$'\n'
for i in $(tac storage/faves); do
IFS=':'
array=($i)
array=($i) # please redo me i'm stupid
if [[ ${array[1]} == '' ]]; then
break
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
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.'
fi
# source "${cfg[namespace]}/templates/header.shs"
# echo "$player_render"
strings[@player]="meow$player_render"
[[ "${cfg[template]}" == "default" ]] && source "${cfg[namespace]}/templates/header.shs"
strings[@player]="$player_render"
strings[@header]="$(cat "${cfg[namespace]}/templates/themes/${cfg[template]}/elements/top.html")"
strings[@footer]="$(cat "${cfg[namespace]}/templates/themes/${cfg[template]}/elements/footer.html")"
render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/watch.html"