diff --git a/public/css/flags/flags.min.css b/public/css/flags/flags.min.css index 0ecc81bf..94029a37 100644 --- a/public/css/flags/flags.min.css +++ b/public/css/flags/flags.min.css @@ -1,3 +1,3 @@ /*! * Generated with CSS Flag Sprite generator (https://www.flag-sprites.com - */.flag{display:inline-block;width:16px;height:11px;background:url(flags.png) no-repeat}.flag.flag-zh{background-position:-16px 0}.flag.flag-sv{background-position:-16px -33px}.flag.flag-th{background-position:-32px -33px}.flag.flag-mx{background-position:0 -22px}.flag.flag-pt{background-position:-48px -22px}.flag.flag-ro{background-position:-64px -22px}.flag.flag-nb{background-position:-32px -22px}.flag.flag-es{background-position:-48px 0}.flag.flag-Hant{background-position:-48px -33px}.flag.flag-ru{background-position:0 -33px}.flag.flag-ko{background-position:-64px -11px}.flag.flag-br{background-position:-80px 0}.flag.flag-it{background-position:-32px -11px}.flag.flag-nl{background-position:-16px -22px}.flag.flag-fr{background-position:-64px 0}.flag.flag-de{background-position:-32px 0}.flag.flag-ja{background-position:-48px -11px}.flag.flag-hu{background-position:0 -11px}.flag.flag-en{background-position:-64px -33px}.flag.flag-is{background-position:-16px -11px}.flag.flag-ca{background-position:-80px -11px}.flag.flag-multiple{background-position:-80px -22px} + */.flag{display:inline-block;width:16px;height:11px;background:url(flags.png) no-repeat}.flag.flag-zh{background-position:-16px 0}.flag.flag-sv{background-position:-16px -33px}.flag.flag-th{background-position:-32px -33px}.flag.flag-mx{background-position:0 -22px}.flag.flag-pt{background-position:-48px -22px}.flag.flag-ro{background-position:-64px -22px}.flag.flag-nb{background-position:-32px -22px}.flag.flag-es{background-position:-48px 0}.flag.flag-Hant{background-position:-48px -33px}.flag.flag-ru{background-position:0 -33px}.flag.flag-ko{background-position:-64px -11px}.flag.flag-br{background-position:-80px 0}.flag.flag-it{background-position:-32px -11px}.flag.flag-nl{background-position:-16px -22px}.flag.flag-fr{background-position:-64px 0}.flag.flag-de{background-position:-32px 0}.flag.flag-ja{background-position:-48px -11px}.flag.flag-hu{background-position:0 -11px}.flag.flag-en{background-position:-64px -33px}.flag.flag-is{background-position:-16px -11px}.flag.flag-ca{background-position:-80px -11px}.flag.flag-multiple{background-position:-80px -22px}.flag.flag-other{background: none} diff --git a/public/css/main.css b/public/css/main.css index f45b6205..560631da 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -151,6 +151,7 @@ select.form-input { } .language span.input-group { display: inline-block; } +.language span.input-group span { display: none; } .language .input-group label { margin-bottom: 1px; } .language .input-group input { margin-right: 4px; } @@ -1005,27 +1006,27 @@ details[open] summary:after { } .nyaa-cat { background: url('/img/categories.png') no-repeat; background-position-x: right!important; max-width: 80px; min-width: 68px; height: 28px; display: block; } -.nyaa-cat-1 { background-position: 0 0; } -.nyaa-cat-2 { background-position: 0 -26px; } -.nyaa-cat-4 { background-position: 0 -52px; } -.nyaa-cat-3 { background-position: 0 -78px; } -.nyaa-cat-6 { background-position: 0 -104px; } -.nyaa-cat-5 { background-position: 0 -130px; } -.nyaa-cat-8 { background-position: 0 -156px; } -.nyaa-cat-7 { background-position: 0 -182px; } -.nyaa-cat-9 { background-position: 0 -208px; } -.nyaa-cat-10 { background-position: 0 -234px; } -.nyaa-cat-11 { background-position: 0 -260px; } -.nyaa-cat-12 { background-position: 0 -286px; } -.nyaa-cat-13 { background-position: 0 -312px; } -.nyaa-cat-14 { background-position: 0 -338px; } -.nyaa-cat-15 { background-position: 0 -364px; } -.nyaa-cat-16 { background-position: 0 -390px; } -.nyaa-cat-18 { background-position: 0 -416px; } -.sukebei-cat-11 { background-position: 0 -442px; } -.sukebei-cat-12 { background-position: 0 -468px; } -.sukebei-cat-13 { background-position: 0 -494px; } -.sukebei-cat-14 { background-position: 0 -520px; } -.sukebei-cat-15 { background-position: 0 -546px; } -.sukebei-cat-21 { background-position: 0 -572px; } +.nyaa-cat-1 { background-position: 0 -26px; } +.nyaa-cat-2 { background-position: 0 -52px; } +.nyaa-cat-4 { background-position: 0 -78px; } +.nyaa-cat-3 { background-position: 0 -104px; } +.nyaa-cat-6 { background-position: 0 -130px; } +.nyaa-cat-5 { background-position: 0 -156px; } +.nyaa-cat-8 { background-position: 0 -182px; } +.nyaa-cat-7 { background-position: 0 -208px; } +.nyaa-cat-9 { background-position: 0 -234px; } +.nyaa-cat-10 { background-position: 0 -260px; } +.nyaa-cat-11 { background-position: 0 -286px; } +.nyaa-cat-12 { background-position: 0 -312px; } +.nyaa-cat-13 { background-position: 0 -338px; } +.nyaa-cat-14 { background-position: 0 -364px; } +.nyaa-cat-15 { background-position: 0 -390px; } +.nyaa-cat-16 { background-position: 0 -416px; } +.nyaa-cat-18 { background-position: 0 -442px; } +.sukebei-cat-11 { background-position: 0 -468px; } +.sukebei-cat-12 { background-position: 0 -494px; } +.sukebei-cat-13 { background-position: 0 -420px; } +.sukebei-cat-14 { background-position: 0 -546px; } +.sukebei-cat-15 { background-position: 0 -572px; } +.sukebei-cat-21 { background-position: 0 -598px; } .sukebei-cat-22 { background-position: 0 -598px; } diff --git a/public/img/categories.png b/public/img/categories.png index 43ed2f95..3ce7c0e9 100644 Binary files a/public/img/categories.png and b/public/img/categories.png differ diff --git a/public/js/kilo.js b/public/js/kilo.js index b8d4edab..004c5b7e 100644 --- a/public/js/kilo.js +++ b/public/js/kilo.js @@ -1,23 +1,50 @@ -document.getElementsByClassName("form-torrent-name")[0].onkeyup = function(){ - document.getElementsByClassName("table-torrent-name")[0].innerText = document.getElementsByClassName("form-torrent-name")[0].value; +var Sukebei = document.getElementById("IsUploadingToSukebei").value == "yes" ? 1 : 0; + + +document.getElementsByClassName("torrent-preview-table")[0].style.display = "block"; +document.getElementsByClassName("table-torrent-date")[0].innerText = new Date(Date.now()).toLocaleString(document.getElementsByTagName("html")[0].getAttribute("lang"), { year: "numeric", month: "short", day: "numeric" }); + +for(var lang_index = 0; lang_index < document.getElementsByName("languages").length; lang_index++) + document.getElementsByName("languages")[lang_index].addEventListener("change", UpdateTorrentLang); +document.getElementsByClassName("form-torrent-category")[0].addEventListener("change", UpdatePreviewCategory); +document.getElementsByClassName("form-torrent-name")[0].addEventListener("keyup", UpdatePreviewTorrentName); +document.getElementsByClassName("form-torrent-remake")[0].onchange = function(){ + document.getElementsByName("torrent-info tr")[0].className = "torrent-info" + (UserTrusted ? " trusted" : "") + (document.getElementsByClassName("form-torrent-remake")[0].checked ? " remake" : ""); }; -function UpdatePreviewCategory(){ - document.getElementsByClassName("table-torrent-category")[0].className = "nyaa-cat table-torrent-category "+ Sukebei ? "sukebei" : "nyaa" + "-cat-" + Categorylist[Sukebei][document.getElementsByClassName("form-torrent-category")[0].selectedIndex]; + +function UpdatePreviewTorrentName(){ + document.getElementsByClassName("table-torrent-name")[0].innerText = document.getElementsByClassName("form-torrent-name")[0].value; +} + +function UpdatePreviewCategory(){ + document.getElementsByClassName("table-torrent-category")[0].className = "nyaa-cat table-torrent-category "+ (Sukebei ? "sukebei" : "nyaa") + "-cat-" + CategoryList[Sukebei][document.getElementsByClassName("form-torrent-category")[0].selectedIndex]; +} + +function UpdateTorrentLang() { + var lang_count, + lang_value = "other", + lang_title = ""; + + lang_count = 0; + + for(var lang_index = 0, title_index = 0; lang_index < document.getElementsByName("languages").length; lang_index++) { + if(document.getElementsByName("languages")[lang_index].checked) { + lang_title= lang_title + document.getElementsByName("upload-lang-languagename")[lang_index].innerText + ","; + if(++lang_count > 1){ + lang_value = "multiple"; + continue; + } + lang_value = document.getElementsByName("languages")[lang_index].value; + } + } + var lang_cat = lang_value != "other" ? (lang_value > 1 ? "multiple" : lang_value) : "other"; + document.getElementsByClassName("table-torrent-flag")[0].className = "table-torrent-flag flag flag-" + lang_cat; + document.getElementsByClassName("table-torrent-flag")[0].title = lang_title; } -document.getElementsByClassName("form-torrent-remake")[0].onchange = function(){ - document.getElementsByClassName("table-torrent-thead")[0].className = "torrent-info table-torrent-thead" + (UserTrusted ? " trusted" : "") + (document.getElementsByClassName("form-torrent-remake")[0].checked ? " remake" : ""); -}; - -document.getElementsByClassName("form-torrent-hidden")[0].onchange = function(){ - document.getElementsByClassName("table-torrent-thead")[0].className = "torrent-info table-torrent-thead" + (document.getElementsByClassName("form-torrent-remake")[0].checked ? " remake" : ""); - if(UserTrusted && !document.getElementsByClassName("form-torrent-hidden")[0].checked) - document.getElementsByClassName("table-torrent-thead")[0].className = document.getElementsByClassName("table-torrent-thead")[0].className + " trusted"; -}; ' - var CategoryList = [ - [5 + [0, 12, 5, 13, diff --git a/templates/layouts/partials/base.jet.html b/templates/layouts/partials/base.jet.html index a8f7a038..53bd33d4 100644 --- a/templates/layouts/partials/base.jet.html +++ b/templates/layouts/partials/base.jet.html @@ -39,7 +39,6 @@ {{end}} - {{block additional_header()}}{{end}} @@ -90,4 +89,4 @@ {{block footer_js()}}{{end}} - \ No newline at end of file + diff --git a/templates/layouts/partials/helpers/flags.jet.html b/templates/layouts/partials/helpers/flags.jet.html index 421c37a6..8deaf421 100644 --- a/templates/layouts/partials/helpers/flags.jet.html +++ b/templates/layouts/partials/helpers/flags.jet.html @@ -1,9 +1,9 @@ -{{ block flagList(languages=nil, selected="", inputname="languages")}} +{{ block flagList(languages=nil, selected="", inputname="languages", id="lang")}} {{ if isset(languages) }} {{ range _, language := languages }} - + {{LanguageName(language, T)}} {{ end }} {{ end }} -{{ end }} +{{ end }} diff --git a/templates/site/torrents/upload.jet.html b/templates/site/torrents/upload.jet.html index ce526c39..52bfabe2 100644 --- a/templates/site/torrents/upload.jet.html +++ b/templates/site/torrents/upload.jet.html @@ -13,7 +13,7 @@