+ better header
This commit is contained in:
parent
24369d406c
commit
dc016e361e
|
@ -1,7 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# TODO: move this to a *real* template
|
||||
# we'll need to figure out conditional templates first tho
|
||||
|
||||
if ! session_verify "${cookies[sh_session]}"; then
|
||||
echo "<a href='/login.shs'</a>Log in</a> | <a href='/register.shs'>Register</a>"
|
||||
else
|
||||
echo "Logged in as ${cookies[username]} | <a href='/logout.shs'>Log out</a>"
|
||||
echo "Logged in as ${cookies[username]} | <a href='/logout.shs'>Log out</a> | <a href='/'>Main</a> | <a href='/feed.shs'>Your feed</a> | <a href='/fav.shs'>Your favourites</a>"
|
||||
fi
|
||||
|
||||
render _ "${cfg[namespace]}/templates/themes/${cfg[template]}/elements/top.t"
|
||||
|
|
4
templates/themes/default/elements/top.t
Normal file
4
templates/themes/default/elements/top.t
Normal file
|
@ -0,0 +1,4 @@
|
|||
<form action='/search.shs'>
|
||||
<input name='q' type='text'>
|
||||
<input type='submit' value='Search'>
|
||||
</form>
|
|
@ -1,7 +1,3 @@
|
|||
<form action='/search.shs'>
|
||||
<input name='q' type='text'>
|
||||
<input type='submit' value='Search'>
|
||||
</form>
|
||||
<h1>All user's favourites:</h1>
|
||||
<div style='display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));'>
|
||||
{{.favourites}}
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
<form action='search.shs'>
|
||||
<input name='q' type='text'>
|
||||
<input type='submit' value='Search'>
|
||||
</form>
|
||||
<div><br>
|
||||
{{.player}}
|
||||
<h2>{{.title}}</h2>
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
<form action='search.shs'>
|
||||
<input name='q' type='text'>
|
||||
<input type='submit' value='Search'>
|
||||
</form>
|
||||
<div><br>
|
||||
{{.player}}
|
||||
<h2>{{.title}}</h2>
|
||||
<div>
|
||||
<div>
|
||||
Uploaded by <b><a href='/channel/{{.channel_id}}'>{{.uploader}}</a></b> on <b>{{.upload_date}}</b>
|
||||
</div>
|
||||
<div>
|
||||
<b>{{.view_count}}</b> views<br>
|
||||
<b>{{.like_count}}</b> likes, <b>{{.dislike_count}}</b> dislikes.<br>
|
||||
{{.fav}}
|
||||
{{.sub}}
|
||||
<br><br>
|
||||
</div>
|
||||
</div>
|
||||
<span><i>Description</i>:<br>{{.description}}</span>
|
||||
</div>
|
||||
<h1>Recommended</h1>
|
||||
<div style='display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));'>
|
||||
{{.recommended}}
|
||||
</div><h1>Comments</h1>
|
||||
{{.comments_list}}
|
||||
{{.playlist}}
|
||||
<script type='text/javascript' src='js/player.js'></script>
|
|
@ -31,4 +31,5 @@ for (( i=0; i<${#video_id[@]}; i++ )); do
|
|||
strings[videos]+="<a href='/watch?v=${video_id[$i]}'><img src='http://i.ytimg.com/vi/${video_id[$i]}/mqdefault.jpg'><br>${video_title[$i]}</a><br>"
|
||||
done
|
||||
|
||||
source "${cfg[namespace]}/templates/header.shs"
|
||||
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/channel.t"
|
||||
|
|
|
@ -23,4 +23,5 @@ for i in $(tac storage/faves | grep -P "^$(session_get_username ${cookies[sh_ses
|
|||
strings[fav]+="<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></div>";
|
||||
done
|
||||
|
||||
source "${cfg[namespace]}/templates/header.shs"
|
||||
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/fav.t"
|
||||
|
|
|
@ -28,4 +28,5 @@ else
|
|||
strings[feed]="gtfo"
|
||||
fi
|
||||
|
||||
source "${cfg[namespace]}/templates/header.shs"
|
||||
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/feed.t"
|
||||
|
|
|
@ -18,6 +18,8 @@ source templates/head.sh
|
|||
|
||||
if [[ $status == 1 && $reason != '' ]]; then
|
||||
strings[reason]="$reason"
|
||||
else
|
||||
strings[reason]=""
|
||||
fi
|
||||
|
||||
render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/login.t"
|
||||
|
|
|
@ -22,4 +22,5 @@ for (( i=0; i<${#video_id[@]}; i++ )); do
|
|||
strings[playlist]+="<a href='watch?v=${video_id[$i]}&playlist=$(html_encode "${get_data[list]}")'><img src='https://i.ytimg.com/vi/${video_id[$i]}/mqdefault.jpg'><br>${video_title[$i]}</a><br>"
|
||||
done
|
||||
|
||||
source "${cfg[namespace]}/templates/header.shs"
|
||||
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/playlist.t"
|
||||
|
|
|
@ -35,4 +35,5 @@ else
|
|||
echo "search for something will 'ya?"
|
||||
fi
|
||||
|
||||
source "${cfg[namespace]}/templates/header.shs"
|
||||
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/search.t"
|
||||
|
|
|
@ -27,4 +27,5 @@ done
|
|||
|
||||
unset IFS
|
||||
|
||||
source "${cfg[namespace]}/templates/header.shs"
|
||||
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/subscribe.t"
|
||||
|
|
|
@ -7,6 +7,9 @@ if [[ "${get_data[v]}" ]]; then
|
|||
strings[uploader]='MyMusicGroup'
|
||||
strings[title]='█▬█ █ ▀█▀ Jeden Osiem L - Jak Zapomnieć (Oficjalny Teledysk)'
|
||||
url='https://sakamoto.pl/tmp/videoplayback_.webm'
|
||||
if [[ "${r[host]}" == "${cfg[flash_host]}" ]]; then
|
||||
url='//f.sakamoto.pl/videoplayback_.flv'
|
||||
fi
|
||||
if [[ ${cfg[template]} == 'default' ]]; then
|
||||
meta[title]="${strings[title]}"
|
||||
source templates/head.sh
|
||||
|
@ -132,6 +135,7 @@ if [[ "${get_data[v]}" ]]; then
|
|||
done
|
||||
fi
|
||||
|
||||
source "${cfg[namespace]}/templates/header.shs"
|
||||
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/watch.t"
|
||||
else
|
||||
source templates/head.sh
|
||||
|
|
Loading…
Reference in a new issue