e62ebb05ba
* Mass Edit MOD api JS (WIP) In continuity with the mass edit mod api, this is the javascript use of it. ##What does it do? * Delete of multiple torrents on index/search * Category change of multiple torrents * Change of owner of multiple torrents * Lock & delete of multiple torrents ##How? * New toolbar only visible for mods * Checkboxes added only for mods * Selection and click on the button in toolbar * Nothing is submitted, you have to review the changes in a modal window listing them. * Then the ajax queries are initialized one at a time with a progression bar * You can always at any moment delete entries from the queuing list * Improved progress bar * Deleting part almost done Improved modal design All dom interactions should be done Prepared Query for only one callback Improved Modal to keep a link to the active modal * Finished =D Added some translation string * Forgot the refreshing of the page Just an option that can be disabled by making refreshTimeout to 0
235 lignes
Pas d'EOL
12 Kio
HTML
235 lignes
Pas d'EOL
12 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>
|
|
{{ if HasAdmin $.User }}
|
|
<th class="tr-cb"><input type="checkbox" name="select_all" onchange="TorrentsMod.selectAll(this.checked)"></th>
|
|
{{end}}
|
|
<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 id="torrent_{{ .ID }}" class="torrent-info
|
|
{{if eq .Status 2}}remake{{end}}
|
|
{{if eq .Status 3}}trusted{{end}}
|
|
{{if eq .Status 4}}aplus{{end}}" id="torrent{{ .ID }}">
|
|
{{ if HasAdmin $.User }}
|
|
<td class="tr-cb">
|
|
<input data-name="{{ .Name }}" type="checkbox" id="torrent_cb_{{ .ID }}" name="torrent_id" value="{{ .ID }}">
|
|
</td>
|
|
{{ 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>
|
|
{{ if HasAdmin $.User }}
|
|
<div class="modtools">
|
|
<button id="show_actions" data-toggle-text="{{call $.T "hide_mod_tools"}}">{{call $.T "show_mod_tools"}}</button>
|
|
<span class="actions">
|
|
<span class="btn-group">
|
|
<select class="cb_action" name="category_id">
|
|
<option value="">{{call $.T "category"}}</option>
|
|
{{ range $name_cat, $id_cat := (GetCategories true) }}
|
|
<option value="{{ $id_cat }}">{{call $.T $name_cat }}</option>
|
|
{{ end }}
|
|
</select>
|
|
<input class="cb_action" type="text" name="owner_id" placeholder="Owner ID (eg. Renchon = 0)">
|
|
<select class="cb_action" name="status_id">
|
|
<option value="">{{call $.T "torrent_status"}}</option>
|
|
<option value="5">{{ call $.T "torrent_status_blocked" }}</option>
|
|
<option value="1">{{call $.T "torrent_status_normal"}}</option>
|
|
<option value="2" >{{call $.T "torrent_status_remake"}}</option>
|
|
<option value="3">{{call $.T "trusted"}}</option>
|
|
<option value="4">A+</option>
|
|
</select>
|
|
<button class="cb_action" id="edit">{{ call $.T "edit" }}</button>
|
|
</span>
|
|
<span class="btn-group">
|
|
<button class="cb_action" id="lock_delete">{{ call $.T "lock_delete" }}</button>
|
|
<button class="cb_action" id="delete">{{ call $.T "delete" }}</button>
|
|
</span>
|
|
<span class="btn-group">
|
|
<button class="cb_submit" id="modal_active">{{ call $.T "save_changes" }}</button>
|
|
</span>
|
|
</span>
|
|
</div>
|
|
<!-- Modal -->
|
|
<div id="modal_mod_tools" class="modal">
|
|
<!-- Modal content -->
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<span class="close">×</span>
|
|
<h2>{{ call $.T "following_changes_applied" }}</h2>
|
|
</div>
|
|
<div class="modal-body">
|
|
<h3>{{ call $.T "changes_in_following_order" }}</h3>
|
|
<div class="progress-bar" id="progress_modtool" style="display: none;"><div class="progress-green"></div></div>
|
|
<hr>
|
|
<div class="logs_mess" style="display: none;"></div>
|
|
<h2>{{ call $.T "edit_changes" }}</h2>
|
|
<div class="edit_changes"></div>
|
|
<h2>{{ call $.T "delete_changes" }}</h2>
|
|
<div class="delete_changes"></div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<span><button id="confirm_changes" onclick="TorrentsMod.ApplyChanges();">{{ call $.T "yes"}}</button>
|
|
<button class="close" onclick="Modal.CloseActive();">{{ call $.T "no"}}</button></span>
|
|
<h3>{{ call $.T "are_you_sure" }} </h3>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
{{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/modal.js" }}"></script>
|
|
<script type="text/javascript" src="{{ $.URL.Parse "/js/torrents.js" }}"></script>
|
|
{{ if HasAdmin $.User }}
|
|
<script type="text/javascript" src="{{ $.URL.Parse "/js/torrentsMod.js" }}"></script>
|
|
<script type="text/javascript">
|
|
Modal.Init({elements: document.getElementsByClassName("modal"),
|
|
button: "#modal_active",
|
|
before: function() {
|
|
TorrentsMod.generatingModal();
|
|
},
|
|
close: function() {
|
|
TorrentsMod.resetModal();
|
|
}
|
|
});
|
|
Templates.Add("torrents.delete.item", function(torrent) {
|
|
return '<div class="delete_item" id="list_item_'+torrent.id+'"><span>'+Templates.EncodeEntities(torrent.name)+'</span>'+
|
|
'<a href="#" onclick="return TorrentsMod.RemoveItemFromQueue('+torrent.key+', '+torrent.id+')"><i class="trash-icon"></i></a></div>'
|
|
});
|
|
Templates.Add("torrents.delete.block", function(torrentQuery){
|
|
return '<div class="delete_list" id="list_'+torrentQuery.unique_id+'"><div class="title">'+
|
|
'<h3 style="display:inline-block;" onclick="TorrentsMod.toggleList(this);">Query #'+torrentQuery.unique_id+
|
|
'</h3>'+
|
|
'<span class="infos">'+torrentQuery.infos+'<a href="#" class="icon" onclick="return TorrentsMod.RemoveFromQueue('+torrentQuery.key+')"><div class="trash-icon"></div></a>'+
|
|
'</span></div>'+
|
|
'<div class="list">'+torrentQuery.list+'</div></div>';
|
|
});
|
|
Templates.Add("torrents.edit.item", function(torrent) {
|
|
return '<div class="edit_item" id="list_item_'+torrent.id+'"><span>'+Templates.EncodeEntities(torrent.name)+'</span>'+
|
|
'<a href="#" onclick="return TorrentsMod.RemoveItemFromQueue('+torrent.key+', '+torrent.id+')"><i class="trash-icon"></i></a></div>'
|
|
});
|
|
Templates.Add("torrents.edit.block", function(torrentQuery){
|
|
return '<div class="edit_list" id="list_'+torrentQuery.unique_id+'"><div class="title">'+
|
|
'<h3 style="display:inline-block;" onclick="TorrentsMod.toggleList(this);">Query #'+torrentQuery.unique_id+
|
|
'</h3>'+
|
|
'<span class="infos">'+torrentQuery.infos+'<a href="#" class="icon" onclick="return TorrentsMod.RemoveFromQueue('+torrentQuery.key+')"><div class="trash-icon"></div></a>'+
|
|
'</span></div>'+
|
|
'<div class="list">'+torrentQuery.list+'</div></div>';
|
|
});
|
|
Templates.Add("torrents.logs.error", function(msg) {
|
|
return '<div class="error">'+msg+'</div>';
|
|
});
|
|
Templates.Add("torrents.logs.success", function(msg) {
|
|
return '<div class="success">'+msg+'</div>';
|
|
});
|
|
</script>
|
|
{{end}}
|
|
<!-- 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}} |