tube/templates/index.html

61 lines
2.3 KiB
HTML
Raw Normal View History

2020-03-21 13:34:37 +03:00
{{ define "content" }}
2019-06-26 22:02:31 +03:00
{{ $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>
2020-03-21 13:34:37 +03:00
<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>
2020-03-21 13:34:37 +03:00
<h1>{{ $playing.Title }}</h1>
2020-03-27 11:16:23 +03:00
<h2>{{ $playing.Views }} views • {{ $playing.Modified }}<br />{{ $playing.Size | bytes }}</h2>
2020-03-21 13:34:37 +03:00
<p>{{ $playing.Description }}</p>
{{ else }}
<video id="video" controls></video>
{{ end }}
</div>
<div id="playlist">
<div class="nav">
<ul>
2020-03-27 14:50:19 +03:00
<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>
2020-03-21 13:34:37 +03:00
{{ 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>
2020-03-27 11:16:23 +03:00
<h2>{{ $m.Views }} views • {{ $m.Modified }}<br />{{ $m.Size | bytes }}</h2>
2020-03-21 13:34:37 +03:00
</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 }}