Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/templates/home.html
akuma06 ae1628e921 Some js fixes and improvements
Better handling of Torrents.StopRefresh()
Keep the order of torrents
Encode html entities from torrent name (prevent execution of unwanted
html tags)
2017-05-30 15:19:45 +02:00

125 lignes
No EOL
6,4 Kio
HTML

{{define "title"}}{{call $.T "home"}}{{end}}
{{define "contclass"}}cont-home{{end}}
{{define "content"}}
<!--
<audio id="nyaapassu" hidden>
<source src="https://a.doko.moe/sewang.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio id="explosion" hidden>
<source src="https://megumin.love/sounds/explosion.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
-->
<!-- Contain the table within a grid, as for better sizing -->
<div class="results box">
<table>
<thead class="torrent-info">
<tr>
<th class="tr-cat">{{call $.T "category"}}</th>
<th class="tr-name">
<a href="{{ genSearchWithOrdering .URL "1" }}">{{call $.T "name"}}<span class="sort-arrows">{{ genSortArrows .URL "1" }}</span></a>
</th>
<th class="tr-links"></th>
<th class="tr-size hide-xs"><a href="{{ genSearchWithOrdering .URL "4" }}">{{call $.T "size"}}<span class="sort-arrows">{{ genSortArrows .URL "4" }}</span></a></th>
<th class="tr-se hide-xs">
<a href="{{ genSearchWithOrdering .URL "5" }}">{{call $.T "S"}}<span class="sort-arrows">{{ genSortArrows .URL "5" }}</span></a>
</th>
<th class="tr-le hide-xs">
<a href="{{ genSearchWithOrdering .URL "6" }}">{{call $.T "L"}}<span class="sort-arrows">{{ genSortArrows .URL "6" }}</span></a>
</th>
<th class="tr-dl hide-xs">
<a href="{{ genSearchWithOrdering .URL "7" }}">{{call $.T "D"}}<span class="sort-arrows">{{ genSortArrows .URL "7" }}</span></a>
</th>
<!-- <th><span class="glyphicon glyphicon-comment"></span></th> -->
<th class="tr-date hide-xs"><a href="{{ genSearchWithOrdering .URL "2" }}">{{call $.T "date"}}<span class="sort-arrows">{{ genSortArrows .URL "2" }}</span></a></th>
</tr>
</thead>
<tbody id="torrentListResults">
{{ range .Models}}
<tr class="torrent-info
{{if eq .Status 2}}remake{{end}}
{{if eq .Status 3}}trusted{{end}}
{{if eq .Status 4}}aplus{{end}}">
<td class="tr-cat home-td">
<a href="{{$.URL.Parse (printf "/search?c=%s_%s" .Category .SubCategory) }}">
{{ if Sukebei }}
<img src="{{$.URL.Parse (printf "/img/torrents/sukebei/%s%s.png" .Category .SubCategory) }}" title="{{ call $.T (CategoryName .Category .SubCategory) }}">
{{ else }}
<img src="{{$.URL.Parse (printf "/img/torrents/%s.png" .SubCategory) }}" title="{{ call $.T (CategoryName .Category .SubCategory) }}">
{{ end}}
</a>
</td>
<td class="tr-name home-td">
<a href="{{genRoute "view_torrent" "id" ( print .ID ) }}">
{{.Name}}
</a>
</td>
<!--
<td class="hidden-xs">
{{len .Comments}}
</td>
-->
<td class="tr-links home-td">
<a href="{{.Magnet}}" title="{{ call $.T "magnet_link" }}">
<div class="magnet-icon"></div>
</a>
{{if ne .TorrentLink ""}}
<a href="{{.TorrentLink}}" title="{{ call $.T "torrent_file" }}">
<div class="download-icon"></div>
</a>
{{end}}
</td>
<td class="tr-size home-td hide-xs">
{{ fileSize .Filesize $.T }}
</td>
{{if .LastScrape.IsZero}}
<td class="home-td hide-xs" colspan="3">{{call $.T "unknown"}}</td>
{{else}}
<td class="tr-se home-td hide-xs">{{.Seeders}}</td>
<td class="tr-le home-td hide-xs">{{.Leechers}}</td>
<td class="tr-dl home-td hide-xs">{{.Completed}}</td>
{{end}}
<td class="tr-date home-td date-short hide-xs">{{.Date}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{end}}
{{ define "footer_js"}}
<script type="text/javascript" src="{{ $.URL.Parse "/js/template.js" }}"></script>
<script type="text/javascript" src="{{ $.URL.Parse "/js/query.js" }}"></script>
<script type="text/javascript" src="{{ $.URL.Parse "/js/torrents.js" }}"></script>
<!-- JS Template -->
<script type="text/javascript">
Templates.Add("torrents.item", function(torrent) {
return "<tr class=\"torrent-info"+ ((torrent.status == 2) ? " remake" : ((torrent.status == 3) ? " trusted" : ((torrent.status == 3) ? " aplus" : "" )))+"\">"+
"<td class=\"tr-cat home-td\">"+
"<a href=\"{{$.URL.Parse "/search?c=" }}"+ torrent.category + "_" + torrent.sub_category +"\">"+
{{ if Sukebei }}
"<img src=\"{{ $.URL.Parse "/img/torrents/sukebei/" }}"+ torrent.category + torrent.sub_category+".png\" title=\""+ torrent.CategoryName +"\">"+
{{ else }}
"<img src=\"{{ $.URL.Parse "/img/torrents/" }}"+ torrent.sub_category +".png\" title=\""+ torrent.CategoryName +"\">"+
{{ end }}
"</a>"+
"</td>"+
"<td class=\"tr-name home-td\"><a href=\"/view/"+torrent.id+"\">"+Templates.EncodeEntities(torrent.name) +"</a></td>"+
"<td class=\"tr-links home-td\">"+
"<a href=\""+torrent.magnet +"\" title=\"{{ call $.T "magnet_link" }}\">"+
"<div class=\"magnet-icon\"></div>"+
"</a>"+(torrent.torrent != "" ? " <a href=\""+torrent.torrent+"\" title=\"{{ call $.T "torrent_file" }}\"><div class=\"download-icon\"></div></a>" : "") +
"</td>"+
"<td class=\"tr-size home-td hide-xs\">"+humanFileSize(torrent.filesize)+"</td>"+
"<td class=\"tr-se home-td hide-xs\">"+torrent.seeders+"</td>"+
"<td class=\"tr-le home-td hide-xs\">"+torrent.leechers+"</td>"+
"<td class=\"tr-dl home-td hide-xs\">"+torrent.completed+"</td>"+
"<td class=\"tr-date home-td date-short hide-xs\">"+torrent.date+"</td>"+
"</tr>";
});
Torrents.LastID = {{ lastID .URL .Models }};
if (Torrents.LastID > 0) Torrents.CanRefresh = true;
</script>
{{end}}