magnetico/cmd/magneticow/data/templates/torrents.html

57 lines
2.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{ if .Query }}"{{ .Query }}"{{ else }}Most recent torrents{{ end }} - magneticow</title>
<link rel="stylesheet" href="static/styles/reset.css">
<link rel="stylesheet" href="static/styles/essential.css">
<link rel="stylesheet" href="static/styles/torrents.css">
<script>
var canLoadMore = {{ if .CanLoadMore }} true {{ else }} false {{ end }};
var lastOrderedValue = {{ .LastOrderedValue }};
var lastID = {{ .LastID }};
</script>
<script src="static/scripts/torrents.js"></script>
</head>
<body>
<header>
<div><a href="/"><b>magnetico<sup>w</sup></b></a>&#8203;<sub>(pre-alpha)</sub></div>
<form action="/torrents" method="get" autocomplete="off" role="search">
<input type="search" name="query" placeholder="Search the BitTorrent DHT" value="{{ .Query }}">
</form>
<div>
<a href="{{ .SubscriptionURL }}"><img src="static/assets/feed.png"
alt="feed icon" title="subscribe" /> subscribe</a>
</div>
</header>
<main>
<table>
<thead>
<tr>
<th><!-- Magnet link --></th>
<th>Name</th>
<th>Size</th>
<th>Discovered on</th>
</tr>
</thead>
<tbody>
{{ range .Torrents }}
<tr>
<td><a href="magnet:?xt=urn:btih:{{ bytesToHex .InfoHash }}&dn={{ .Name }}">
<img src="static/assets/magnet.gif" alt="Magnet link"
title="Download this torrent using magnet" /></a></td>
<td><a href="/torrents/{{ bytesToHex .InfoHash }}/{{ .Name }}">{{ .Name }}</a></td>
<td>{{ humanizeSize .Size }}</td>
<td>{{ unixTimeToYearMonthDay .DiscoveredOn }}</td>
</tr>
{{ end }}
</tbody>
</table>
</main>
<footer>
<button onclick="loadMore();" {{ if not .CanLoadMore }} disabled {{ end }}>
Load More Results
</button>
</footer>
</body>
</html>