tube/templates/index.html

60 lines
2.3 KiB
HTML

{{ define "content" }}
{{ $playing := .Playing }}
<div class="topnav" id="myTopnav">
<a href="javascript:void(0);" class="icon" onclick="myFunction()">
<i class="fa fa-cogs"></i>
</a>
<a {{ if eq $.Quality "" }}class="active"{{ end }} href="/v/{{ $playing.ID }}">fullHD</a>
<a {{ if eq $.Quality "720p" }}class="active"{{ end }} href="/v/{{ $playing.ID }}?quality=720p">720p</a>
<a {{ if eq $.Quality "480p" }}class="active"{{ end }} href="/v/{{ $playing.ID }}?quality=480p">480p</a>
<a {{ if eq $.Quality "360p" }}class="active"{{ end }} href="/v/{{ $playing.ID }}?quality=360p">360p</a>
<a {{ if eq $.Quality "240p" }}class="active"{{ end }} href="/v/{{ $playing.ID }}?quality=240p">240p</a>
</div>
<div id="player">
{{ if $playing.ID }}
<video id="video" controls preload="metadata" poster="/t/{{ $playing.ID}}">
<source src="/v/{{ $playing.ID }}.mp4?quality={{ $.Quality }}" type="video/mp4" />
</video>
<h1>{{ $playing.Title }}</h1>
<h2>{{ $playing.Views }} views • {{ $playing.Modified }}<br />{{ $playing.Size | bytes }}</h2>
<p>{{ $playing.Description }}</p>
{{ else }}
<video id="video" controls></video>
{{ end }}
</div>
<div id="playlist">
<div class="nav">
<ul>
<li><a {{ if or (eq $.Sort "timestamp") (eq $.Sort "") }}class="active"{{ end }} href="?sort=timestamp">Recent</a></li>
<li><a {{ if eq $.Sort "views" }}class="active"{{ end }} href="?sort=views">Views</a></li>
</ul>
</div>
{{ range $m := .Playlist }}
{{ if eq $m.ID $playing.ID }}
<a href="/v/{{ $m.ID }}" class="playing">
{{ else }}
<a href="/v/{{ $m.ID }}">
{{ end }}
<img src="/t/{{ $m.ID }}">
<div>
<h1>{{ $m.Title }}</h1>
<h2>{{ $m.Views }} views • {{ $m.Modified }}<br />{{ $m.Size | bytes }}</h2>
</div>
</a>
{{ end }}
</div>
{{end}}
{{ define "scripts" }}
<script type="application/javascript">
/* Toggle between adding and removing the "responsive" class to topnav when the user clicks on the icon */
function myFunction() {
var x = document.getElementById("myTopnav");
if (x.className === "topnav") {
x.className += " responsive";
} else {
x.className = "topnav";
}
}
</script>
{{ end }}