Added search refine on every pages + fixed kilo.js
Cette révision appartient à :
Parent
0cf98c91b0
révision
f8de340265
13 fichiers modifiés avec 84 ajouts et 89 suppressions
|
@ -39,7 +39,7 @@ func newSearchForm(c *gin.Context) searchForm {
|
|||
return searchForm{
|
||||
Category: "_",
|
||||
ShowItemsPerPage: true,
|
||||
ShowRefine: true,
|
||||
ShowRefine: false,
|
||||
SizeType: sizeType,
|
||||
DateType: c.Query("dateType"),
|
||||
MinSize: c.Query("minSize"), // We need to overwrite the value here, since size are formatted
|
||||
|
|
|
@ -56,8 +56,8 @@ func SearchHandler(c *gin.Context) {
|
|||
searchForm := newSearchForm(c)
|
||||
searchForm.TorrentParam, searchForm.Category = searchParam, category
|
||||
|
||||
if c.Query("refine") == "" {
|
||||
searchForm.ShowRefine = false
|
||||
if c.Query("refine") == "1" {
|
||||
searchForm.ShowRefine = true
|
||||
}
|
||||
|
||||
modelList(c, "site/torrents/listing.jet.html", models.TorrentsToJSON(torrents), nav, searchForm)
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
// @source https://github.com/NyaaPantsu/nyaa/tree/dev/public/js
|
||||
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
|
||||
var explosion = document.getElementById("explosion");
|
||||
var nyanpassu = document.getElementById("nyanpassu");
|
||||
var kawaii = document.getElementById("kawaii");
|
||||
|
||||
// Switches between themes when a new one is selected
|
||||
function switchThemes(){
|
||||
|
@ -69,35 +66,23 @@ document.addEventListener("DOMContentLoaded", function(event) {
|
|||
document.getElementsByClassName("search-box")[0].style.width = "";
|
||||
document.getElementsByClassName("h-user")[0].style.display = "inline-block";
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function playVoice() {
|
||||
if (explosion) {
|
||||
explosion.volume = 0.2;
|
||||
explosion.play();
|
||||
}
|
||||
else if (kawaii) {
|
||||
kawaii.volume = 0.2;
|
||||
kawaii.play();
|
||||
}
|
||||
else {
|
||||
nyanpassu.volume = 0.2;
|
||||
nyanpassu.play();
|
||||
}
|
||||
var mascotAudio = document.getElementById("explosion") || document.getElementById("nyanpassu") || document.getElementById("kawaii");
|
||||
if (mascotAudio !== undefined) {
|
||||
mascotAudio.volume = 0.2;
|
||||
mascotAudio.play();
|
||||
} else {
|
||||
console.log("Your mascot doesn't support yet audio files!")
|
||||
}
|
||||
}
|
||||
|
||||
var refine_button = document.getElementsByClassName("box refine")[0];
|
||||
refine_button.click(function( event ) {
|
||||
event.preventDefault();
|
||||
toggleRefine();
|
||||
document.getElementsByClassName("form-input refine")[0].addEventListener("click", function (e) {
|
||||
document.getElementsByClassName("box refine")[0].style.display = document.getElementsByClassName("box refine")[0].style.display == "none" ? "block" : "none";
|
||||
if(document.getElementsByClassName("form-input refine-searchbox")[0].value != document.getElementsByClassName("form-input search-box")[0].value)
|
||||
document.getElementsByClassName("form-input refine-searchbox")[0].value = document.getElementsByClassName("form-input search-box")[0].value;
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
function toggleRefine() {
|
||||
if(refine_button != "undefined") {
|
||||
refine_button.style.display = refine_button.style.display == "none" ? "block" : "none";
|
||||
if(document.getElementsByClassName("form-input refine-searchbox")[0].value == "")
|
||||
document.getElementsByClassName("form-input refine-searchbox")[0].value = document.getElementsByClassName("form-input search-box")[0].value;
|
||||
}
|
||||
else document.getElementById("header-form").submit();
|
||||
}
|
||||
// @license-end
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
{{ extends "layouts/index_admin" }}
|
||||
{{block title()}}{{ T("torrent_edit_panel") }}{{end}}
|
||||
{{block additional_header()}}
|
||||
<link rel="stylesheet" href="/css/flags/flags.min.css">
|
||||
{{end}}
|
||||
{{ block content_body()}}
|
||||
<div class="results box">
|
||||
<h3 id="torrents">{{ T("torrent_edit_panel") }}</h3>
|
||||
|
|
|
@ -10,4 +10,10 @@
|
|||
{{ block contclass()}}content-admin{{end}}
|
||||
|
||||
{* We add the mod panel title and the title block *}
|
||||
{{block titleBase()}}Moderation Panel - {{block title()}}{{end}}{{end}}
|
||||
{{block titleBase()}}Moderation Panel - {{block title()}}{{end}}{{end}}
|
||||
|
||||
{* We add the mod panel search refine and the body block *}
|
||||
{{ block content_body_base()}}
|
||||
{{ yield search_refine(url=URL.Parse("/mod/torrents")) }}
|
||||
{{ block content_body()}}{{end}}
|
||||
{{end}}
|
|
@ -6,4 +6,9 @@
|
|||
{{include "partials/menu/site"}}
|
||||
{{end}}
|
||||
|
||||
{{block titleBase()}} - {{block title()}}{{end}}{{end}}
|
||||
{{block titleBase()}} - {{block title()}}{{end}}{{end}}
|
||||
|
||||
{{ block content_body_base()}}
|
||||
{{ yield search_refine(url=URL.Parse("/search")) }}
|
||||
{{ block content_body()}}{{end}}
|
||||
{{end}}
|
|
@ -1,5 +1,6 @@
|
|||
{{import "helpers/errors"}}
|
||||
{{import "helpers/infos"}}
|
||||
{{import "helpers/search"}}
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ T("language_code") }}">
|
||||
<head>
|
||||
|
@ -37,6 +38,9 @@
|
|||
{{else}}
|
||||
<link rel="stylesheet" id="theme" href="/css/{{Theme}}.css?v={{ Config.Version }}{{ Config.Build }}">
|
||||
{{end}}
|
||||
<!-- Flags css -->
|
||||
<link rel="stylesheet" href="/css/flags/flags.min.css">
|
||||
<link rel="stylesheet" href="/css/flags/custom_flags.css">
|
||||
<!-- Search Box for Google -->
|
||||
<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebSite","url":"{{Config.WebAddress.Nyaa}}/","potentialAction":{"@type":"SearchAction","target":"{{Config.WebAddress.Nyaa}}/search?q={search_term_string}","query-input":"required name=search_term_string"} }</script>
|
||||
{{block additional_header()}}{{end}}
|
||||
|
@ -49,7 +53,7 @@
|
|||
<div class="content container center">
|
||||
{{ yield infos()}}
|
||||
{{ yield errors()}}
|
||||
{{ block content_body() }}{{end}}
|
||||
{{ block content_body_base() }}{{end}}
|
||||
</div>
|
||||
{{ block mascot() }}
|
||||
{{if Mascot != "hide"}}
|
||||
|
|
|
@ -10,45 +10,59 @@
|
|||
{{block search_button() }}
|
||||
<input class="form-input search-box" name="q" placeholder="{{ T("search")}}" type="text" value="{{Search.NameLike}}">
|
||||
<button type="submit" class="form-input icon-search"></button>
|
||||
<button type="submit" class="form-input refine" name="refine" value="1" onclick="toggleRefine();">{{ T("refine")}}</button>
|
||||
<button type="submit" class="form-input refine" name="refine" value="1">{{ T("refine")}}</button>
|
||||
{{end}}
|
||||
{{block search_refine() }}
|
||||
<h3>{{ T("refine_search") }}</h3>
|
||||
<form style="display: grid;" method="GET" action="">
|
||||
{{block search_refine(url="") }}
|
||||
<div style="text-align:left;{{ if !Search.ShowRefine }}display:none;{{ end }}" class="box refine">
|
||||
<h3>{{ T("refine_search") }}</h3>
|
||||
<form style="display: grid;" method="GET" action="{{ url }}">
|
||||
<input type="hidden" name="c" value="{{Search.Category}}"/>
|
||||
<input type="hidden" name="userID" value="{{Search.UserID}}"/>
|
||||
<span class="form-refine">Search for: <input type="text" class="form-input refine-searchbox" size="30" name="q" value="{{Search.NameLike}}"/></span>
|
||||
<span class="form-refine">Show: <select name="s" class="form-input" style="margin-right: 8px;">
|
||||
- <option value="0">{{ T("show_all")}}</option>
|
||||
- <option value="2" {{if Search.Status == 2}}selected{{end}}>{{ T("filter_remakes")}}</option>
|
||||
- <option value="3" {{if Search.Status == 3}}selected{{end}}>{{ T("trusted")}}</option>
|
||||
- <option value="4" {{if Search.Status == 4}}selected{{end}}>A+</option>
|
||||
- </select>Limit: <input type="number" name="limit" value="{{ Navigation.MaxItemPerPage }}" class="form-input" min="1" max="300"></span>
|
||||
<span class="form-refine">{{ T("between")}} <input class="form-input" size="7" name="minSize" type="text" value="{{Search.MinSize}}"> {{ T("and")}} <input size="7" class="form-input" name="maxSize" type="text" value="{{Search.MaxSize}}">
|
||||
<select name="sizeType" class="form-input">
|
||||
<option value="b"{{if Search.SizeType == "b"}} selected{{end}}>B</option>
|
||||
<option value="k"{{if Search.SizeType == "k"}} selected{{end}}>KiB</option>
|
||||
<option value="m"{{if Search.SizeType == "m"}} selected{{end}}>MiB</option>
|
||||
<option value="g"{{if Search.SizeType == "g"}} selected{{end}}>GiB</option>
|
||||
</select>
|
||||
{{ T("large")}}
|
||||
</span>
|
||||
<span class="form-refine">{{ T("between")}} <input class="form-input" size="7" name="fromDate" type="text" value="{{Search.FromDate}}"> {{ T("and")}} <input class="form-input" size="7" name="toDate" type="text" value="{{Search.ToDate}}">
|
||||
<select name="dateType" class="form-input">
|
||||
<option value="d"{{if Search.DateType == "d"}} selected{{end}}>{{ T("days")}}</option>
|
||||
<option value="m"{{if Search.DateType == "m"}} selected{{end}}>{{ T("months")}}</option>
|
||||
<option value="y"{{if Search.DateType == "y"}} selected{{end}}>{{ T("years")}}</option>
|
||||
</select>
|
||||
{{ T("old")}}.
|
||||
</span>
|
||||
<div name="language" class="form-refine form-input language">
|
||||
{{ range _, language := GetTorrentLanguages() }}
|
||||
<span class="input-group">
|
||||
<input type="checkbox" name="lang" id="lang-{{ language }}" value="{{language}}"{{ range _, v := Search.Languages}}{{ if v.Code == language }} checked{{end}}{{end}}>
|
||||
<label for="lang-{{ language }}" class="flag flag-{{ FlagCode(language) }}" title="{{LanguageName(language, T)}}"></label>
|
||||
<span class="form-refine">Search for:
|
||||
<input type="text" class="form-input refine-searchbox" size="30" name="q" value="{{Search.NameLike}}"/>
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
<button type="submit" class="form-input refine-btn" name="refine" value="1">{{ T("refine")}}</button>
|
||||
<span class="form-refine">Show:
|
||||
<select name="s" class="form-input" style="margin-right: 8px;">
|
||||
<option value="0">{{ T("show_all")}}</option>
|
||||
<option value="2" {{if Search.Status == 2}}selected{{end}}>{{ T("filter_remakes")}}</option>
|
||||
<option value="3" {{if Search.Status == 3}}selected{{end}}>{{ T("trusted")}}</option>
|
||||
<option value="4" {{if Search.Status == 4}}selected{{end}}>A+</option>
|
||||
</select>
|
||||
Limit: <input type="number" name="limit" value="{{ Navigation.MaxItemPerPage }}" class="form-input" min="1" max="300">
|
||||
</span>
|
||||
<span class="form-refine">{{ T("between")}}
|
||||
<input class="form-input" size="7" name="minSize" type="text" value="{{Search.MinSize}}">
|
||||
{{ T("and")}}
|
||||
<input size="7" class="form-input" name="maxSize" type="text" value="{{Search.MaxSize}}">
|
||||
<select name="sizeType" class="form-input">
|
||||
<option value="b"{{if Search.SizeType == "b"}} selected{{end}}>B</option>
|
||||
<option value="k"{{if Search.SizeType == "k"}} selected{{end}}>KiB</option>
|
||||
<option value="m"{{if Search.SizeType == "m"}} selected{{end}}>MiB</option>
|
||||
<option value="g"{{if Search.SizeType == "g"}} selected{{end}}>GiB</option>
|
||||
</select>
|
||||
{{ T("large")}}
|
||||
</span>
|
||||
<span class="form-refine">
|
||||
{{ T("between")}}
|
||||
<input class="form-input" size="7" name="fromDate" type="text" value="{{Search.FromDate}}">
|
||||
{{ T("and")}}
|
||||
<input class="form-input" size="7" name="toDate" type="text" value="{{Search.ToDate}}">
|
||||
<select name="dateType" class="form-input">
|
||||
<option value="d"{{if Search.DateType == "d"}} selected{{end}}>{{ T("days")}}</option>
|
||||
<option value="m"{{if Search.DateType == "m"}} selected{{end}}>{{ T("months")}}</option>
|
||||
<option value="y"{{if Search.DateType == "y"}} selected{{end}}>{{ T("years")}}</option>
|
||||
</select>
|
||||
{{ T("old")}}.
|
||||
</span>
|
||||
<div name="language" class="form-refine form-input language">
|
||||
{{ range _, language := GetTorrentLanguages() }}
|
||||
<span class="input-group">
|
||||
<input type="checkbox" name="lang" id="lang-{{ language }}" value="{{language}}"{{ range _, v := Search.Languages}}{{ if v.Code == language }} checked{{end}}{{end}}>
|
||||
<label for="lang-{{ language }}" class="flag flag-{{ FlagCode(language) }}" title="{{LanguageName(language, T)}}"></label>
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
<button type="submit" class="form-input refine-btn" name="refine" value="1">{{ T("refine")}}</button>
|
||||
</form>
|
||||
</div>
|
||||
{{end}}
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
{{ import "layouts/partials/helpers/csrf" }}
|
||||
{{ import "layouts/partials/helpers/errors" }}
|
||||
{{block title()}}T("torrent_edit_panel"){{end}}
|
||||
{{block additional_header()}}
|
||||
<link rel="stylesheet" href="/css/flags/flags.min.css">
|
||||
{{end}}
|
||||
{{block content_body()}}
|
||||
<div class="box results">
|
||||
<h3 id="torrents">{{ T("torrent_edit_panel") }}</h3>
|
||||
|
|
|
@ -2,13 +2,8 @@
|
|||
{{ import "layouts/partials/helpers/search" }}
|
||||
{{block title()}}{{ T("home")}}{{end}}
|
||||
{{block contclass()}}{{if User.HasAdmin() }}content-admin{{end}}{{end}}
|
||||
{{block additional_header()}}
|
||||
<link rel="stylesheet" href="/css/flags/flags.min.css">
|
||||
<link rel="stylesheet" href="/css/flags/custom_flags.css">
|
||||
{{end}}
|
||||
{{block content_body()}}
|
||||
<!-- Contain the table within a grid, as for better sizing -->
|
||||
<div style="text-align:left;{{ if !Search.ShowRefine }}display:none;{{ end }}" class="box refine">{{ yield search_refine() }}</div>
|
||||
<div class="results box">
|
||||
<table>
|
||||
<thead class="torrent-info">
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
{{ import "layouts/partials/helpers/csrf" }}
|
||||
{{ import "layouts/partials/helpers/captcha" }}
|
||||
{{block title()}}{{ T("upload")}}{{end}}
|
||||
{{block additional_header()}}
|
||||
<link rel="stylesheet" href="/css/flags/flags.min.css">
|
||||
{{end}}
|
||||
{{block content_body()}}
|
||||
<div style="text-align: left;" class="box">
|
||||
<form enctype="multipart/form-data" role="upload" method="POST">
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
{{ import "layouts/partials/helpers/captcha" }}
|
||||
{{ import "layouts/partials/helpers/treeview" }}
|
||||
{{block title()}}{{Torrent.Name}}{{end}}
|
||||
{{block additional_header()}}
|
||||
<link rel="stylesheet" href="/css/flags/flags.min.css">
|
||||
<link rel="stylesheet" href="/css/flags/custom_flags.css">
|
||||
{{end}}
|
||||
{{block content_body()}}
|
||||
<div style="text-align: left;" class="box">
|
||||
<div id="torrent-name" class="{{if Torrent.Status == 2}}remake{{else if Torrent.Status == 3}}trusted{{else if Torrent.Status == 4}}aplus{{end}}">
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{{ extends "layouts/profile" }}
|
||||
{{ import "layouts/partials/menu/profile" }}
|
||||
{{block additional_header()}}<link rel="stylesheet" href="/css/flags/flags.min.css">{{end}}
|
||||
{{ block profile_navigation()}}{{ yield profile_menu(route="profile") }}{{end}}
|
||||
{{block profile_content()}}
|
||||
{{ if len(UserProfile.Torrents) > 0 }}
|
||||
|
|
Référencer dans un nouveau ticket