2017-08-01 13:54:01 +02:00
< script type = "text/javascript" >
// {{ range _, cat := GetCategories(false, true) }}
2017-07-17 21:54:06 +02:00
T.Add("{{ cat.ID }}", "{{ T(cat.Name) }}")
2017-08-01 13:54:01 +02:00
// {{end}}
// {{ range _, language := GetTorrentLanguages() }}
2017-07-17 21:54:06 +02:00
T.Add("{{ language.Code }}", "{{ LanguageName(language, T) }}")
2017-08-01 13:54:01 +02:00
// {{ if language.Tag != language.Code }}
2017-07-17 21:54:06 +02:00
T.Add("{{ language.Tag }}", "{{ LanguageName(language, T) }}")
2017-08-01 13:54:01 +02:00
// {{end}}
// {{end}}
2017-07-17 21:54:06 +02:00
Templates.Add("torrents.item", function(torrent) {
2017-08-01 13:54:01 +02:00
var tr_class = "torrent-info hidden"
if (torrent.status == 2) {
tr_class += " remake"
} else if (torrent.status == 3) {
tr_class += " trusted"
} else if (torrent.status == 4) {
tr_class += " aplus"
}
var catClass = "nyaa-cat"
// {{ if Sukebei() }}
2017-08-01 14:03:19 +02:00
catClass += " sukebei-cat-"+ torrent.category + torrent.sub_category
2017-08-01 13:54:01 +02:00
// {{else}}
2017-08-01 14:03:19 +02:00
catClass += " nyaa-cat-"+ torrent.sub_category
2017-08-01 13:54:01 +02:00
// {{end}}
var languages = ""
var colspan = (torrent.comments.length == 0 ? ` colspan="2"` : "" )
2017-09-03 06:03:04 +02:00
var commentTd = ((torrent.comments.length > 0) ? `< td class = "tr-cs home-td" title = "`+torrent.comments.length + ` {{T(" comments " ) } } ` + ` " > < span > ` + torrent.comments.length + `< / span > < / td > ` : "")
2017-08-01 13:54:01 +02:00
var dlLink = (torrent.torrent != "" ? ' < a > < div class = "icon-floppy" > < / div > < / a > ' : "")
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 > < img src = "img/blank.gif" class = "flag flag-` + flagClass + `" title = "` + langs + `" > < / a > `
}
return `< tr id = "torrent_` + torrent.id + `" class = "` + tr_class + `" >
< td class = "tr-cat home-td" >
< div class = "` + catClass +`" >
< a class = "category" >
2017-09-12 00:17:35 +02:00
< / a > ` + languages + `
2017-08-01 13:54:01 +02:00
< / div > < / td >
< td class = "tr-name home-td" ` + colspan + ` > < a > ` + Templates.EncodeEntities(torrent.name) + `< / a > < / td >
`+ commentTd +`
2017-08-12 08:36:44 +02:00
< td class = "tr-links home-td" >
2017-08-01 13:54:01 +02:00
< a title = "{{ T(" magnet_link " ) } } " >
< div class = "icon-magnet" > < / div >
< / a > `+ dlLink +`
2017-08-01 23:38:13 +02:00
< / td >
2017-08-01 13:54:01 +02:00
< td class = "tr-size home-td hide-xs" > ` + humanFileSize(torrent.filesize) + `< / td >
< td class = "tr-se home-td hide-smol" > ` + torrent.seeders + `< / td >
< td class = "tr-le home-td hide-smol" > ` + 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 > `;
2017-07-17 22:52:25 +02:00
});
2017-08-09 13:48:26 +02:00
< / script >