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/layouts/partials/torrent_item.jet.html
kilo dd94402f04
Fixes & improvements (#1684)
* Update main.css

* Update torrent_item.jet.html

* Update main.js

* Update torrent_item.jet.html

* Update main.js

* Update main.js

* Update main.js

* Update main.js

* Update main.js

* Update template_functions_test.go

* Update template_functions_test.go

* Update user.go

* Update profile.jet.html

* Update view.jet.html

* Update template_functions.go

* Update en-us.all.json

* Add files via upload

* Update CHANGELOG.md

* Update main.css

* Update template_functions.go

* Add files via upload

* Update en-us.all.json

* Update template_functions_test.go

* Update view.jet.html

* Update main.css

* Update ja-jp.all.json

* Update main.css

* Update edit.jet.html

* Update main.css

* Update tomorrow.css

* Update ja-jp.all.json

* Update main.css

* Update view.jet.html

* Update comment.go

* Update create.go

* Update classic.css

* Make GetOldNavFromRequest return true by default

* Update view.jet.html

* Force torrent date in UTC+0 timezone during display

* ditto

* Update ja-jp.all.json

* Update oldNav.jet.html

* Update structs.go

* Update default_config.yml

* Update torrent.go

* Update stats.go

* Update stats.go

* Update user.go

* Update template_functions.go

* Update template_functions_test.go

* Update torrent.go

* Update comment.go

* Update view.jet.html

* Update main.css

* Update user.go

* Update template_functions.go

* Update profile.jet.html

* Update main.js
2017-10-28 18:28:59 +02:00

70 lignes
3,5 Kio
HTML

<script type="text/javascript">
// {{ range _, cat := GetCategories(false, true) }}
T.Add("{{ cat.ID }}", "{{ T(cat.Name) }}")
// {{end}}
// {{ range _, language := GetTorrentLanguages() }}
T.Add("{{ language.Code }}", "{{ LanguageName(language, T) }}")
// {{ if language.Tag != language.Code }}
T.Add("{{ language.Tag }}", "{{ LanguageName(language, T) }}")
// {{end}}
// {{end}}
Templates.Add("torrents.item", function(torrent) {
var tr_class = "torrent-info"
if (torrent.status == 2) {
tr_class += " remake"
} else if (torrent.status == 3) {
tr_class += " trusted"
} else if (torrent.status == 4) {
tr_class += " aplus"
}
// {{ if User.HasAdmin() }}
var cb_hide = (!TorrentsMod.enabled) ? " hide" : ""
var cb_show = (TorrentsMod.enabled) ? ' style="display:table-cell;"' : ""
// {{ end }}
var catClass = "nyaa-cat"
// {{ if Sukebei() }}
catClass += " sukebei-cat-"+ torrent.category + torrent.sub_category
// {{else}}
catClass += " nyaa-cat-"+ torrent.sub_category
// {{end}}
var languages = ""
var colspan = (torrent.comments.length == 0 ? ` colspan="2"` : "" )
var commentTd = ((torrent.comments.length > 0) ? `<td class="tr-cs home-td" title="`+torrent.comments.length + ` {{T("comments")}}` +`"><a href="/view/` + torrent.id + `#comments">` + torrent.comments.length + `</a></td>` : "")
var stats = ["-", "-", "-"]
if(torrent.seeders != 0 || torrent.leechers != 0 || torrent.completed != 0)
stats = [torrent.seeders, torrent.leechers, torrent.completed]
if (torrent.languages[0] != "") {
var flagClass = (torrent.languages.length == 1) ? Templates.FlagCode(torrent.languages[0]) : "multiple"
var langs = torrent.languages.map(function (el, i) { return T.r(el)}).join(",")
languages = `<a href="{{ URL.Parse("/search?c=") }}` + torrent.category + `_` + torrent.sub_category + `&lang=` + torrent.languages.join(",") + `"><img src="img/blank.gif" class="flag flag-` + flagClass + `" title="` + langs + `" alt="` + langs + `"></a>`
}
return `<tr id="torrent_` + torrent.id + `" class="` + tr_class + `">
{{ if User.HasAdmin() }}
<td class="tr-cb` + cb_hide + `"` + cb_show + `>
<input data-name="` + Templates.EncodeEntities(torrent.name) + `" type="checkbox" id="torrent_cb_` + torrent.id + `" name="torrent_id" value="` + torrent.id + `">
</td>
{{ end }}
<td class="tr-cat home-td">
<div class="` + catClass +`">
<a href="{{ URL.Parse("/search?c=") }}` + torrent.category + `_` + torrent.sub_category + `" class="category">
</a> ` + languages + `
</div></td>
<td class="tr-name home-td"` + colspan + `><a href="/view/` + torrent.id + `">` + Templates.EncodeEntities(torrent.name) + `</a></td>
`+ commentTd +`
<td class="tr-links home-td">
<a href="` + torrent.magnet + `" title="{{ T("magnet_link") }}">
<div class="icon-magnet"></div>
</a>`+ ` <a href="` + torrent.torrent + `" title="{{ T("torrent_file") }}"><div class="icon-floppy"></div></a>` +`
</td>
<td class="tr-size home-td hide-xs">` + humanFileSize(torrent.filesize) + `</td>
<td class="tr-se home-td hide-smol">` + stats[0] + `</td>
<td class="tr-le home-td hide-smol">` + stats[1] + `</td>
<td class="tr-dl home-td hide-xs">` + stats[2] + `</td>
<td class="tr-date home-td date-short hide-xs" title="` + torrent.date + `">` + torrent.date + `</td>
</tr>`;
});
</script>