Merge branch 'dev' of https://github.com/NyaaPantsu/nyaa into dev
Cette révision appartient à :
révision
68a9453c68
19 fichiers modifiés avec 914 ajouts et 58 suppressions
2
public/css/classic.css
Fichier normal
2
public/css/classic.css
Fichier normal
|
@ -0,0 +1,2 @@
|
|||
/* This is a placeholder so the classic theme can be used */
|
||||
/* Ideally, the decorative parts of main.css would be here instead of there. This will have to do for now though */
|
|
@ -43,8 +43,8 @@ th a { color: #7A5C94; }
|
|||
th { border-color: #cbbdd7 !important; }
|
||||
td { border-color: #e6eff4 !important; }
|
||||
|
||||
td.tr-se { color: #22A243; }
|
||||
td.tr-le { color: #E84C4C; }
|
||||
td.tr-se, .success-text { color: #22A243; }
|
||||
td.tr-le, .error-text { color: #E84C4C; }
|
||||
|
||||
.aplus { background: hsla(200, 100%, 50%, 0.2) !important; }
|
||||
.trusted { background: hsla(100, 100%, 50%, 0.2) !important; }
|
||||
|
|
|
@ -424,8 +424,8 @@ th a { color: #6E96AA; }
|
|||
th { border-color: #ddd !important; }
|
||||
td { border-color: #ccc !important; }
|
||||
|
||||
td.tr-se { color: #22A243; }
|
||||
td.tr-le { color: #E84C4C; }
|
||||
td.tr-se, .success-text { color: #22A243; }
|
||||
td.tr-le, .error-text { color: #E84C4C; }
|
||||
|
||||
/* Original Nyaa colors, do NOT change! */
|
||||
.aplus { background: #60B0F0; }
|
||||
|
@ -600,6 +600,12 @@ div.profile-content.box > nav > ul > li {
|
|||
height: 13px;
|
||||
width: 13px;
|
||||
}
|
||||
.trash-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
display: inline-block;
|
||||
background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTkuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeD0iMHB4IiB5PSIwcHgiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MTIgNTEyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCI+CjxnPgoJPGc+CgkJPHBhdGggZD0iTTQ2NS40MjMsNDguMjQxaC0xMzcuNjFWMjMuOTU1QzMyNy44MTMsMTAuNzQ2LDMxNy4wODIsMCwzMDMuODkzLDBoLTk1Ljc4NWMtMTMuMTksMC0yMy45MiwxMC43NDYtMjMuOTIsMjMuOTU1VjQ4LjI0ICAgIEg0Ni41NzdjLTYuNjU1LDAtMTIuMDQ5LDUuMzk0LTEyLjA0OSwxMi4wNDljMCw2LjY1NSw1LjM5NCwxMi4wNDksMTIuMDQ5LDEyLjA0OWgyMi4zMzJsMTUuMjI4LDM5Ni4zOTYgICAgQzg1LjA2OSw0OTIuOTk1LDEwNC44MTgsNTEyLDEyOS4wOTksNTEyaDI1My44MDRjMjQuMjgxLDAsNDQuMDMtMTkuMDA2LDQ0Ljk2LTQzLjI2N2wxNS4yMjgtMzk2LjM5NmgyMi4zMzIgICAgYzYuNjUzLDAsMTIuMDQ5LTUuMzk0LDEyLjA0OS0xMi4wNDlDNDc3LjQ3Miw1My42MzUsNDcyLjA3OCw0OC4yNDEsNDY1LjQyMyw0OC4yNDF6IE0yMDguMjg1LDI0LjA5N2g5NS40M3YyNC4xNDNoLTk1LjQzVjI0LjA5N3ogICAgIE00MDMuNzg0LDQ2Ny44MDljLTAuNDMzLDExLjI2OC05LjYwNSwyMC4wOTQtMjAuODgyLDIwLjA5NEgxMjkuMDk5Yy0xMS4yNzYsMC0yMC40NDgtOC44MjctMjAuODgyLTIwLjA5NUw5My4wMjUsNzIuMzM4aDMyNS45NTIgICAgTDQwMy43ODQsNDY3LjgwOXoiIGZpbGw9IiMwMDAwMDAiLz4KCTwvZz4KPC9nPgo8Zz4KCTxnPgoJCTxwYXRoIGQ9Ik0xODIuNjMsMTgxLjU3MWMtMC4xMjctNi41NzUtNS40OTQtMTEuODE3LTEyLjA0Mi0xMS44MTdjLTAuMDc4LDAtMC4xNTgsMC0wLjIzNiwwLjAwMiAgICBjLTYuNjUyLDAuMTI4LTExLjk0Myw1LjYyNi0xMS44MTUsMTIuMjc4bDMuNzgxLDE5Ni42MzRjMC4xMjYsNi41NzUsNS40OTUsMTEuODE3LDEyLjA0MiwxMS44MTdjMC4wNzgsMCwwLjE1OCwwLDAuMjM2LTAuMDAyICAgIGM2LjY1My0wLjEyOCwxMS45NDMtNS42MjQsMTEuODE1LTEyLjI3OEwxODIuNjMsMTgxLjU3MXoiIGZpbGw9IiMwMDAwMDAiLz4KCTwvZz4KPC9nPgo8Zz4KCTxnPgoJCTxwYXRoIGQ9Ik0yNTUuOTk4LDE2OS43NTNjLTYuNjU0LDAtMTIuMDQ5LDUuMzk0LTEyLjA0OSwxMi4wNDl2MTk2LjYzNGMwLDYuNjU0LDUuMzk0LDEyLjA0OSwxMi4wNDksMTIuMDQ5ICAgIGM2LjY1NSwwLDEyLjA0OS01LjM5NCwxMi4wNDktMTIuMDQ5VjE4MS44MDJDMjY4LjA0NywxNzUuMTQ4LDI2Mi42NTMsMTY5Ljc1MywyNTUuOTk4LDE2OS43NTN6IiBmaWxsPSIjMDAwMDAwIi8+Cgk8L2c+CjwvZz4KPGc+Cgk8Zz4KCQk8cGF0aCBkPSJNMzQxLjY0NSwxNjkuNzU2Yy02LjYyOC0wLjE0Ny0xMi4xNTEsNS4xNjItMTIuMjc4LDExLjgxNWwtMy43ODEsMTk2LjYzNGMtMC4xMjksNi42NTMsNS4xNjIsMTIuMTUsMTEuODE1LDEyLjI3OCAgICBjMC4wNzgsMC4wMDEsMC4xNTgsMC4wMDIsMC4yMzYsMC4wMDJjNi41NDYsMCwxMS45MTYtNS4yNDQsMTIuMDQyLTExLjgxN2wzLjc4MS0xOTYuNjM0ICAgIEMzNTMuNTg4LDE3NS4zOCwzNDguMjk5LDE2OS44ODMsMzQxLjY0NSwxNjkuNzU2eiIgZmlsbD0iIzAwMDAwMCIvPgoJPC9nPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=)
|
||||
}
|
||||
/* Filelist */
|
||||
.filelist-control {
|
||||
cursor: pointer;
|
||||
|
@ -712,3 +718,210 @@ input.filelist-checkbox:checked + table.table-filelist {
|
|||
.editor-preview-side {
|
||||
top: 110px;
|
||||
}
|
||||
|
||||
/* Mod Tools */
|
||||
.modtools {
|
||||
position: fixed;
|
||||
top:60px;
|
||||
padding: 1px 10px;
|
||||
max-width: 1060px;
|
||||
width:100%;
|
||||
background: #111;
|
||||
border: 1px solid #222;
|
||||
height: 25px;
|
||||
}
|
||||
.tr-cb {
|
||||
width: 20px;
|
||||
text-align: left;
|
||||
display: none;
|
||||
}
|
||||
.modtools .actions {
|
||||
display: none;
|
||||
}
|
||||
.modtools span.btn-group {
|
||||
margin-left: 20px;
|
||||
}
|
||||
.modtools .cb_action {
|
||||
height: 100%;
|
||||
}
|
||||
/* Modal box */
|
||||
/* The Modal (background) */
|
||||
.modal {
|
||||
display: none; /* Hidden by default */
|
||||
position: fixed; /* Stay in place */
|
||||
z-index: 4; /* Sit on top */
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%; /* Full width */
|
||||
height: 100%; /* Full height */
|
||||
overflow: auto; /* Enable scroll if needed */
|
||||
background-color: rgb(0,0,0); /* Fallback color */
|
||||
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
||||
}
|
||||
|
||||
/* Modal Content/Box */
|
||||
/* Modal Header */
|
||||
.modal-header {
|
||||
padding: 2px 16px;
|
||||
background: #111; /* Old browsers */
|
||||
background: -moz-linear-gradient(bottom, #222 0%, #111 100%);
|
||||
background: -webkit-linear-gradient(bottom, #222 0%, #111 100%);
|
||||
background: linear-gradient(to top, #222 0%, #111 100%);
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Modal Body */
|
||||
.modal-body {padding: 2px 16px;}
|
||||
|
||||
/* Modal Footer */
|
||||
.modal-footer {
|
||||
padding: 2px 16px;
|
||||
background: #222; /* Old browsers */
|
||||
background: -moz-linear-gradient(bottom, #111 0%, #222 100%);
|
||||
background: -webkit-linear-gradient(bottom, #111 0%, #222 100%);
|
||||
background: linear-gradient(to top, #111 0%, #222 100%);
|
||||
color: white;
|
||||
}
|
||||
.modal-footer span {
|
||||
float: right;
|
||||
margin-right: 20px;
|
||||
}
|
||||
.modal-footer span button {
|
||||
margin-right: 5px;
|
||||
padding: 1em 2em;
|
||||
background: none;
|
||||
border: 1px solid white;
|
||||
border-radius: 3px;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
}
|
||||
.modal-footer span .close {
|
||||
font-size: 1em;
|
||||
float: none;
|
||||
background: #E84C4C;
|
||||
}
|
||||
.modal-footer span #confirm_changes {
|
||||
font-size: 1em;
|
||||
background: #98D9A8;
|
||||
}
|
||||
|
||||
/* Modal Content */
|
||||
.modal-content {
|
||||
position: relative;
|
||||
background-color: #fefefe;
|
||||
margin: auto;
|
||||
padding: 0;
|
||||
border: 1px solid #888;
|
||||
width: 80%;
|
||||
margin-top: 20%;
|
||||
max-width: 1000px;
|
||||
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
|
||||
-webkit-animation-name: animatetop;
|
||||
-webkit-animation-duration: 0.4s;
|
||||
animation-name: animatetop;
|
||||
animation-duration: 0.4s
|
||||
}
|
||||
.modal .close {
|
||||
float: right;
|
||||
font-size: 2em;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.modal a.icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.modal .edit_list {
|
||||
background: #98D9A8;
|
||||
padding: 0.3em;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.modal .delete_list {
|
||||
background: #E84C4C;
|
||||
padding: 0.3em;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.modal .delete_item {
|
||||
font-weight: bold;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.modal .edit_item {
|
||||
font-weight: bold;
|
||||
padding: 3px;
|
||||
}
|
||||
.delete_item a, .delete_item span.infos, .edit_item a, .edit_item span.infos {
|
||||
float: right;
|
||||
}
|
||||
.delete_list span.infos, .edit_list span.infos {
|
||||
float: right;
|
||||
margin-top: 1em;
|
||||
}
|
||||
.modal-body div .title h3 {
|
||||
cursor: pointer;
|
||||
}
|
||||
.modal .list {
|
||||
border: 1px solid #222;
|
||||
margin-bottom: 0.5em;
|
||||
display: none;
|
||||
}
|
||||
.modal .list .delete_item:nth-child(even), .modal .list .edit_item:nth-child(even) {background: #CCC}
|
||||
.modal .list .delete_item:nth-child(odd), .modal .list .edit_item:nth-child(odd) {background: #FFF}
|
||||
|
||||
.modal-footer button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.modal .close:hover, .modal-footer span button:hover, .modal a.icon:hover {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* Add Animation */
|
||||
@-webkit-keyframes animatetop {
|
||||
from {top: -300px; opacity: 0}
|
||||
to {top: 0; opacity: 1}
|
||||
}
|
||||
|
||||
@keyframes animatetop {
|
||||
from {top: -300px; opacity: 0}
|
||||
to {top: 0; opacity: 1}
|
||||
}
|
||||
.progress-bar {
|
||||
height:1.5em;
|
||||
width: 100%;
|
||||
background: #333;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.progress-green {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
background: #22A243;
|
||||
text-align: right;
|
||||
padding-right: 2px;
|
||||
color: white;
|
||||
padding-top: 0.25em;
|
||||
}
|
||||
|
||||
.logs_mess {
|
||||
background: #ddd;
|
||||
height: 100px;
|
||||
overflow: auto;
|
||||
padding: 3px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.logs_mess div.success {
|
||||
color: #22A243;
|
||||
}
|
||||
|
||||
.logs_mess div.error {
|
||||
color: #893636;
|
||||
|
||||
.error-text, .success-text {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ th a { color: #c5c8c6; }
|
|||
|
||||
th, td { border-color: #141517 !important; }
|
||||
|
||||
td.tr-se { color: #b5bd68; }
|
||||
td.tr-le { color: #cc6666; }
|
||||
td.tr-se, .success-text { color: #b5bd68; }
|
||||
td.tr-le, .error-text { color: #cc6666; }
|
||||
|
||||
.aplus { background: hsla(180, 50%, 50%, 0.2) !important; }
|
||||
.trusted { background: hsla(90, 50%, 50%, 0.2) !important; }
|
||||
|
|
84
public/js/modal.js
Fichier normal
84
public/js/modal.js
Fichier normal
|
@ -0,0 +1,84 @@
|
|||
// Get the modal
|
||||
var Modal = {
|
||||
active: 0,
|
||||
Init: function (params) {
|
||||
var elements = params.elements
|
||||
var button = (params.button != undefined) ? params.button : false
|
||||
if (elements.innerHTML != undefined) {
|
||||
|
||||
} else {
|
||||
var nbEl = elements.length
|
||||
for (var i=0; i < nbEl; i++) {
|
||||
var modal = elements[i];
|
||||
this.addModal(modal, button, i, params.before, params.after, params.close)
|
||||
}
|
||||
}
|
||||
},
|
||||
addModal: function(modal, btn, i, before_callback, after_callback, close_callback) {
|
||||
var isBtnArray = false;
|
||||
// Get the button that opens the modal
|
||||
if (!btn) {
|
||||
btn = document.getElementById("modal_btn_"+modal.id)
|
||||
} else if (btn.match(/^#/)) {
|
||||
btn = document.getElementById(btn.substr(1));
|
||||
} else if (btn.match(/^\./)) {
|
||||
btn = document.getElementsByClassName(btn.substr(1));
|
||||
isBtnArray = true;
|
||||
} else {
|
||||
console.error("Couldn't find the button")
|
||||
return
|
||||
}
|
||||
if ((isBtnArray) && (i > 0) && (btn.length > 0) && (btn.length > i)) {
|
||||
btn[i].addEventListener("click", function(e) {
|
||||
if (before_callback != undefined) before_callback()
|
||||
modal.style.display = "block";
|
||||
Modal.active = modal;
|
||||
if (after_callback != undefined) after_callback()
|
||||
e.preventDefault();
|
||||
});
|
||||
} else {
|
||||
btn = (isBtnArray) ? btn[0] : btn;
|
||||
// When the user clicks on the button, open the modal
|
||||
btn.addEventListener("click", function(e) {
|
||||
if (before_callback != undefined) before_callback()
|
||||
modal.style.display = "block";
|
||||
Modal.active = modal;
|
||||
if (after_callback != undefined) after_callback()
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
// Get the <span> element that closes the modal
|
||||
var span = document.querySelectorAll("#"+modal.id+" .close")[0]
|
||||
// When the user clicks on <span> (x), close the modal
|
||||
span.addEventListener("click", function(e) {
|
||||
modal.style.display = "none";
|
||||
Modal.active = 0;
|
||||
if (close_callback != undefined) close_callback()
|
||||
e.preventDefault();
|
||||
});
|
||||
// When the user clicks anywhere outside of the modal, close it
|
||||
window.addEventListener("click", function(event) {
|
||||
if (event.target == modal) {
|
||||
modal.style.display = "none";
|
||||
Modal.active = 0;
|
||||
if (close_callback != undefined) close_callback()
|
||||
}
|
||||
});
|
||||
},
|
||||
CloseActive: function() {
|
||||
if (this.active != 0) {
|
||||
this.active.style.display= "none";
|
||||
this.active = 0;
|
||||
}
|
||||
},
|
||||
GetActive: function() {
|
||||
return this.active;
|
||||
},
|
||||
Open: function(q) {
|
||||
var modal = document.querySelector(q);
|
||||
if (modal != undefined) {
|
||||
modal.style.display= "none";
|
||||
this.active = modal;
|
||||
}
|
||||
}
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
var Query = {
|
||||
Failed:0,
|
||||
MaxConsecutingFailing:-1,
|
||||
MaxFail: 10,
|
||||
Get: function(url, renderer, callback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url, true);
|
||||
|
@ -9,15 +9,34 @@ var Query = {
|
|||
if (this.status == 200) {
|
||||
Query.Failed = 0;
|
||||
renderer(this.response);
|
||||
callback(this.response);
|
||||
if (callback != undefined) callback(this.response);
|
||||
} else {
|
||||
console.log("Error when refresh")
|
||||
Query.Failed++;
|
||||
console.log("Attempt to refresh "+Query.Failed+"...");
|
||||
if ((Query.MaxConsecutingFailing == -1) || (Query.Failed < Query.MaxConsecutingFailing)) Query.Get(url, renderer, callback);
|
||||
if ((Query.MaxFail == -1) || (Query.Failed < Query.MaxFail)) Query.Get(url, renderer, callback);
|
||||
else console.error("Too many attempts, stopping...")
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
},
|
||||
Post: function(url, postArgs, callback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', url, true);
|
||||
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
xhr.responseType = 'json';
|
||||
xhr.onload = function(e) {
|
||||
if (this.status == 200) {
|
||||
Query.Failed = 0;
|
||||
if (callback != undefined) callback(this.response);
|
||||
} else {
|
||||
console.log("Error when refresh")
|
||||
Query.Failed++;
|
||||
console.log("Attempt to refresh "+Query.Failed+"...");
|
||||
if ((Query.MaxFail == -1) || (Query.Failed < Query.MaxFail)) Query.Post(url, postArgs, callback);
|
||||
else console.error("Too many attempts, stopping...")
|
||||
}
|
||||
};
|
||||
xhr.send(postArgs);
|
||||
}
|
||||
}
|
||||
};
|
364
public/js/torrentsMod.js
Fichier normal
364
public/js/torrentsMod.js
Fichier normal
|
@ -0,0 +1,364 @@
|
|||
var TorrentsMod = {
|
||||
// Variables that can be modified to change the dom interactions
|
||||
show_hide_button: "show_actions",
|
||||
btn_class_action: "cb_action",
|
||||
btn_class_submit: "cb_submit",
|
||||
progress_bar_id: "progress_modtool",
|
||||
status_input_name: "status_id",
|
||||
owner_input_name: "owner_id",
|
||||
category_input_name: "category_id",
|
||||
delete_btn: "delete",
|
||||
lock_delete_btn: "lock_delete",
|
||||
edit_btn: "edit",
|
||||
refreshTimeout: 3000,
|
||||
// Internal variables used for processing the request
|
||||
selected: [],
|
||||
queued: [],
|
||||
unique_id:1,
|
||||
error_count:0,
|
||||
progress_count: 0,
|
||||
progress_max: 0,
|
||||
pause: false,
|
||||
|
||||
// Init method
|
||||
Create: function() {
|
||||
var sh_btn = document.getElementById(TorrentsMod.show_hide_button);
|
||||
var btn_actions = document.getElementsByClassName(this.btn_class_action)
|
||||
var btn_submit = document.getElementsByClassName(this.btn_class_submit)
|
||||
btn_submit[0].disabled = true;
|
||||
for (var i=0; i < btn_actions.length; i++) {
|
||||
btn_actions[i].disabled = true;
|
||||
switch (btn_actions[i].id) {
|
||||
case this.delete_btn:
|
||||
btn_actions[i].addEventListener("click", this.Delete)
|
||||
break;
|
||||
case this.lock_delete_btn:
|
||||
btn_actions[i].addEventListener("click", this.LockDelete)
|
||||
break;
|
||||
case this.edit_btn:
|
||||
btn_actions[i].addEventListener("click", this.Edit)
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (var i=0; i < this.checkboxes.length; i++) {
|
||||
checkbox = this.checkboxes[i];
|
||||
checkbox.addEventListener("change", this.checkboxEventHandler)
|
||||
}
|
||||
sh_btn.addEventListener("click", function(e) {
|
||||
var display = "inline"
|
||||
var divActions = this.nextElementSibling;
|
||||
console.log(divActions)
|
||||
if (divActions.style.display == "inline") {
|
||||
display = "none";
|
||||
}
|
||||
divActions.style.display = display;
|
||||
var td_cbs = document.getElementsByClassName("tr-cb")
|
||||
for (var i=0; i < td_cbs.length; i++) {
|
||||
td_cb = td_cbs[i];
|
||||
td_cb.style.display = (display == "inline") ? "table-cell" : "none";
|
||||
}
|
||||
var toggleText = this.dataset.toggleText;
|
||||
this.dataset.toggleText = this.innerText;
|
||||
this.innerText = toggleText;
|
||||
});
|
||||
},
|
||||
// generate a unique id for a query
|
||||
getId: function(){
|
||||
return this.unique_id++;
|
||||
},
|
||||
|
||||
// UI Methods
|
||||
selectAll: function(bool) {
|
||||
var l = TorrentsMod.checkboxes.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
TorrentsMod.checkboxes[i].checked = bool;
|
||||
TorrentsMod.checkboxEventHandlerFunc(TorrentsMod.checkboxes[i]);
|
||||
}
|
||||
},
|
||||
disableBtnActions: function() {
|
||||
var btn_actions = document.getElementsByClassName(this.btn_class_action)
|
||||
for (var i=0; i < btn_actions.length; i++) {
|
||||
btn_actions[i].disabled = true;
|
||||
}
|
||||
},
|
||||
enableBtnActions: function() {
|
||||
var btn_actions = document.getElementsByClassName(this.btn_class_action)
|
||||
for (var i=0; i < btn_actions.length; i++) {
|
||||
btn_actions[i].disabled = false;
|
||||
}
|
||||
},
|
||||
enableBtnSubmit: function() {
|
||||
var btn_submit = document.getElementsByClassName(this.btn_class_submit)
|
||||
btn_submit[0].disabled = false;
|
||||
},
|
||||
enableApplyChangesBtn: function() {
|
||||
var btn_apply_changes = document.getElementById("confirm_changes");
|
||||
btn_apply_changes.disabled=false;
|
||||
},
|
||||
disableBtnSubmit: function() {
|
||||
var btn_submit = document.getElementsByClassName(this.btn_class_submit)
|
||||
btn_submit[0].disabled = true;
|
||||
},
|
||||
disableApplyChangesBtn: function() {
|
||||
var btn_apply_changes = document.getElementById("confirm_changes");
|
||||
btn_apply_changes.disabled=true;
|
||||
},
|
||||
removeDivFromList: function(i) {
|
||||
var queueAction = this.queued[i];
|
||||
var parentDiv = document.getElementById(queueAction.unique_id).parentNode;
|
||||
parentDiv.removeChild(document.getElementById(queueAction.unique_id));
|
||||
},
|
||||
removeFromParent: function(el) {
|
||||
var parentDiv = el.parentNode;
|
||||
parentDiv.removeChild(el);
|
||||
},
|
||||
generatingModal: function() {
|
||||
listLength = this.queued.length;
|
||||
var div = {"edit": "", "delete": ""};
|
||||
for (var i=0; i < listLength; i++) {
|
||||
var listHTML = "";
|
||||
for(key in this.queued[i].selection) {
|
||||
var selection = this.queued[i].selection[key];
|
||||
selection.key = i;
|
||||
listHTML += Templates.Render("torrents."+this.queued[i].action+".item", selection);
|
||||
}
|
||||
this.queued[i].list = listHTML;
|
||||
this.queued[i].key = i;
|
||||
div[this.queued[i].action] += Templates.Render("torrents."+this.queued[i].action+".block", this.queued[i]);
|
||||
}
|
||||
this.progress_count = 0;
|
||||
this.progress_max = listLength;
|
||||
document.querySelector(".modal .edit_changes").innerHTML = div["edit"];
|
||||
document.querySelector(".modal .delete_changes").innerHTML = div["delete"];
|
||||
},
|
||||
toggleList: function(el) {
|
||||
el.parentNode.nextSibling.style.display = (el.parentNode.nextSibling.style.display != "block") ? "block" : "none"
|
||||
},
|
||||
addToLog: function(type, msg) {
|
||||
var logDiv = document.querySelector(".modal .logs_mess");
|
||||
if (logDiv.style.display == "none") logDiv.style.display = "block"
|
||||
logDiv.innerHTML += Templates.Render("torrents.logs."+type, msg);
|
||||
},
|
||||
updateProgressBar: function() {
|
||||
document.querySelector("#"+this.progress_bar_id).style.display = "block";
|
||||
var progress_green = document.querySelector("#"+this.progress_bar_id+" .progress-green");
|
||||
var perc = this.progress_count/this.progress_max*100;
|
||||
progress_green.style.width=perc+"%";
|
||||
progress_green.innerText = this.progress_count+"/"+this.progress_max;
|
||||
},
|
||||
resetModal: function() {
|
||||
var logDiv = document.querySelector(".modal .logs_mess");
|
||||
logDiv.style.display = "none";
|
||||
document.querySelector("#"+this.progress_bar_id).style.display = "none";
|
||||
logDiv.innerHTML = "";
|
||||
document.querySelector(".modal .edit_changes").innerHTML = "";
|
||||
document.querySelector(".modal .delete_changes").innerHTML = "";
|
||||
this.enableApplyChangesBtn();
|
||||
},
|
||||
statusToClassName: function(status) {
|
||||
var className = ["", "normal", "remake", "trusted", "aplus", ""]
|
||||
return className[status];
|
||||
},
|
||||
|
||||
// Selection Management Methods
|
||||
addToSelection: function (torrent) {
|
||||
this.selected[torrent.id] = torrent;
|
||||
},
|
||||
removeFromSelection: function(torrent) {
|
||||
delete this.selected[torrent.id];
|
||||
for (t in this.selected) {
|
||||
return
|
||||
}
|
||||
this.selected = [];
|
||||
},
|
||||
|
||||
// Query Queue Management Methods
|
||||
AddToQueue: function(QueueAction) {
|
||||
QueueAction.unique_id = this.getId(); // used for DOM interaction
|
||||
this.queued.push(QueueAction);
|
||||
this.enableBtnSubmit()
|
||||
},
|
||||
RemoveFromQueueAfterItems: function(i) {
|
||||
for (t in this.queued[i].selection) {
|
||||
this.RemoveItemFromQueue(i, t);
|
||||
}
|
||||
},
|
||||
RemoveFromQueue: function(i) {
|
||||
this.progress_max = (this.progress_max - 1 >= 0) ? this.progress_max-1 : 0;
|
||||
this.RemoveFromQueueAction(i)
|
||||
return false;
|
||||
},
|
||||
RemoveFromQueueAction: function(i) {
|
||||
this.removeFromParent(document.getElementById("list_"+this.queued[i].unique_id));
|
||||
this.queued.splice(i, 1);
|
||||
if (this.queued.length == 0) {
|
||||
this.disableBtnSubmit();
|
||||
if (this.progress_max>0) {
|
||||
this.disableApplyChangesBtn();
|
||||
} else {
|
||||
Modal.CloseActive();
|
||||
}
|
||||
}
|
||||
},
|
||||
formatSelectionToQuery: function(selection) {
|
||||
var format = "";
|
||||
for (s in selection) {
|
||||
format += "&torrent_id="+selection[s].id
|
||||
}
|
||||
return (format != "") ? format.substr(1) : ""
|
||||
},
|
||||
RemoveItemFromQueue: function(i, id) {
|
||||
this.removeFromParent(document.getElementById("list_item_"+id));
|
||||
delete this.queued[i].selection[id];
|
||||
document.getElementById("torrent_cb_"+id).checked=false;
|
||||
document.getElementById("torrent_"+id).style.display="";
|
||||
var test = 0;
|
||||
for (t in this.queued[i].selection) {
|
||||
test++
|
||||
break;
|
||||
}
|
||||
if (test == 0) this.RemoveFromQueue(i);
|
||||
return false;
|
||||
},
|
||||
newQueryAttempt: function(queryUrl, queryPost, callback) {
|
||||
Query.Post(queryUrl, queryPost, function (response) {
|
||||
if ((response.length == 0)||(!response.ok)) { // Query has failed
|
||||
var errorMsg = response.errors.join("<br>");
|
||||
TorrentsMod.addToLog("error", errorMsg);
|
||||
TorrentsMod.error_count++;
|
||||
if (TorrentsMod.error_count < 2) {
|
||||
TorrentsMod.addToLog("success", "Trying a new attempt...");
|
||||
TorrentsMod.newQueryAttempt(queryUrl, queryPost, callback)
|
||||
} else {
|
||||
TorrentsMod.addToLog("error", "The query ("+queryUrl+"?"+queryPost+") seems broken!");
|
||||
if (callback != undefined) {
|
||||
TorrentsMod.addToLog("error", "Passing to the next query...");
|
||||
callback(response) // So we can query only one item
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var succesMsg = (response.infos != null) ? response.infos.join("<br>") : "Query executed with success!";
|
||||
TorrentsMod.addToLog("success", succesMsg)
|
||||
if (callback != undefined) callback(response) // So we can query only one item
|
||||
}
|
||||
});
|
||||
},
|
||||
QueryQueue: function(i, callback) {
|
||||
if (this.queued.length > 0) {
|
||||
var QueueAction = this.queued[i]; // we clone it so we can delete it safely
|
||||
this.RemoveFromQueueAction(i);
|
||||
var queryPost = "";
|
||||
var queryUrl = "/mod/api/torrents";
|
||||
QueueAction.queryPost = TorrentsMod.formatSelectionToQuery(QueueAction.selection)
|
||||
if (QueueAction.action == "delete") {
|
||||
queryPost="action="+QueueAction.action;
|
||||
queryPost+="&withreport="+QueueAction.withReport;
|
||||
queryPost += "&status="+((QueueAction.status != undefined) ? QueueAction.status : "");
|
||||
queryPost += "&"+QueueAction.queryPost; // we add torrent id
|
||||
} else if (QueueAction.action == "edit") {
|
||||
queryPost="action=multiple";
|
||||
queryPost += "&status="+QueueAction.status;
|
||||
queryPost += "&owner="+QueueAction.owner;
|
||||
queryPost += "&category="+QueueAction.category;
|
||||
queryPost += "&"+QueueAction.queryPost; // we add torrent id
|
||||
}
|
||||
TorrentsMod.newQueryAttempt(queryUrl, queryPost, callback)
|
||||
} else {
|
||||
TorrentsMod.addToLog("success", "All operations are done!")
|
||||
if (TorrentsMod.refreshTimeout > 0) {
|
||||
TorrentsMod.addToLog("success", "Refreshing the page in 3 seconds...")
|
||||
setTimeout(function(){
|
||||
window.location.reload()
|
||||
}, TorrentsMod.refreshTimeout);
|
||||
}
|
||||
}
|
||||
},
|
||||
QueryLoop: function() {
|
||||
if (TorrentsMod.progress_count <= TorrentsMod.progress_max) {
|
||||
TorrentsMod.updateProgressBar()
|
||||
TorrentsMod.progress_count++;
|
||||
if (TorrentsMod.progress_count > TorrentsMod.progress_max) TorrentsMod.progress_count = TorrentsMod.progress_max;
|
||||
TorrentsMod.QueryQueue(0, TorrentsMod.QueryLoop);
|
||||
}
|
||||
},
|
||||
|
||||
// Event Handlers
|
||||
checkboxEventHandler: function(e) {
|
||||
var el = e.target;
|
||||
TorrentsMod.checkboxEventHandlerFunc(el);
|
||||
},
|
||||
checkboxEventHandlerFunc: function(el) {
|
||||
var name = el.dataset.name;
|
||||
var id = el.value;
|
||||
if (el.checked) TorrentsMod.addToSelection({name:name, id:id});
|
||||
else TorrentsMod.removeFromSelection({name:name, id:id});
|
||||
if (TorrentsMod.selected.length > 0) TorrentsMod.enableBtnActions();
|
||||
else TorrentsMod.disableBtnActions();
|
||||
},
|
||||
|
||||
// Action Methods
|
||||
DeleteHandler: function(locked) {
|
||||
var withReport = confirm("Do you want to delete the reports along the selected torrents?")
|
||||
var selection = TorrentsMod.selected;
|
||||
if (locked)
|
||||
TorrentsMod.AddToQueue({ action: "delete",
|
||||
withReport: withReport,
|
||||
selection: selection,
|
||||
queryPost: "",
|
||||
infos: "with lock"+ ((withReport) ? " and reports" : ""),
|
||||
status: "5" });
|
||||
else TorrentsMod.AddToQueue({
|
||||
action: "delete",
|
||||
withReport: withReport,
|
||||
selection: selection,
|
||||
infos: (withReport) ? "with reports" : "",
|
||||
queryPost: ""});
|
||||
for (i in selection) document.getElementById("torrent_"+i).style.display="none";
|
||||
TorrentsMod.selected = []
|
||||
TorrentsMod.disableBtnActions();
|
||||
},
|
||||
Delete: function(e) {
|
||||
TorrentsMod.DeleteHandler(false);
|
||||
e.preventDefault();
|
||||
},
|
||||
LockDelete: function(e) {
|
||||
TorrentsMod.DeleteHandler(true);
|
||||
e.preventDefault();
|
||||
},
|
||||
Edit: function(e) {
|
||||
var selection = TorrentsMod.selected;
|
||||
var status = document.querySelector(".modtools *[name='"+TorrentsMod.status_input_name+"']").value;
|
||||
var owner_id = document.querySelector(".modtools *[name='"+TorrentsMod.owner_input_name+"']").value;
|
||||
var category = document.querySelector(".modtools *[name='"+TorrentsMod.category_input_name+"']").value;
|
||||
var infos = "";
|
||||
infos += (status != "") ? "status: "+status : "";
|
||||
infos += (owner_id != "") ? " owner_id: "+owner_id : "";
|
||||
infos += (category != "") ? " category: "+category : "";
|
||||
TorrentsMod.AddToQueue({
|
||||
action: "edit",
|
||||
selection: selection,
|
||||
queryPost: "", // We don't format now, we wait until the query is sent
|
||||
infos: (infos != "" ) ? "with "+infos : "No changes",
|
||||
status: status,
|
||||
category: category,
|
||||
owner: owner_id });
|
||||
if (status != "") {
|
||||
for (i in selection) document.getElementById("torrent_"+i).className="torrent-info "+TorrentsMod.statusToClassName(status);
|
||||
}
|
||||
TorrentsMod.selected = []
|
||||
TorrentsMod.disableBtnActions();
|
||||
e.preventDefault();
|
||||
},
|
||||
ApplyChanges: function() {
|
||||
this.pause = false;
|
||||
this.QueryLoop();
|
||||
}
|
||||
};
|
||||
|
||||
// Load torrentMods when DOM is ready
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
TorrentsMod.checkboxes = document.querySelectorAll("input[name='torrent_id']");
|
||||
TorrentsMod.Create();
|
||||
});
|
|
@ -609,6 +609,11 @@ func torrentManyAction(r *http.Request) {
|
|||
/* Changes are done, we save */
|
||||
db.ORM.Unscoped().Model(&torrent).UpdateColumn(&torrent)
|
||||
} else if action == "delete" {
|
||||
if status == model.TorrentStatusBlocked { // Then we should lock torrents before deleting them
|
||||
torrent.Status = status
|
||||
messages.AddInfoTf("infos", "torrent_moved", torrent.Name)
|
||||
db.ORM.Unscoped().Model(&torrent).UpdateColumn(&torrent) // We must save it here and soft delete it after
|
||||
}
|
||||
_, err = torrentService.DeleteTorrent(torrentID)
|
||||
if err != nil {
|
||||
messages.ImportFromError("errors", err)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{{define "profile_edit_content"}}
|
||||
{{with .UserProfile}}
|
||||
{{ range (index $.FormInfos "infos")}}
|
||||
<div class="alert alert-info"><a class="panel-close close" data-dismiss="alert">×</a><i class="glyphicon glyphicon-info-sign"></i> {{ . }}</div>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
{{ range (index $.FormErrors "errors")}}
|
||||
<div class="alert alert-danger"><a class="panel-close close" data-dismiss="alert">×</a><i class="glyphicon glyphicon-exclamation-sign"></i> {{ . }}</div>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
<h3>{{ call $.T "personal_info"}}</h3>
|
||||
<div class="user-edit">
|
||||
|
@ -16,7 +16,7 @@
|
|||
<label class="input-label">{{ call $.T "email_address" }}:</label> <br>
|
||||
<input class="form-input up-input" type="text" name="email" id="email" value="{{.Email}}"> <br>
|
||||
{{ range (index $.FormErrors "email")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
<label class="input-label">{{ call $.T "language"}}:</label> <br>
|
||||
<select id="language" name="language" class="form-input up-input">
|
||||
|
@ -26,24 +26,24 @@
|
|||
{{ end }}
|
||||
</select> <br>
|
||||
{{ range (index $.FormErrors "language")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
{{ if not (HasAdmin $.User)}}
|
||||
<label class="input-label">{{ call $.T "current_password"}}:</label> <br>
|
||||
<input class="form-input up-input up-input" name="current_password" id="current_password" type="password"> <br>
|
||||
{{ range (index $.FormErrors "current_password")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
<label class="input-label">{{ call $.T "password"}}:</label> <br>
|
||||
<input class="form-input up-input up-input" name="password" id="password" type="password"> <br>
|
||||
{{ range (index $.FormErrors "password")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
<label class="input-label">{{ call $.T "confirm_password"}}:</label> <br>
|
||||
<input class="form-input up-input up-input" name="password_confirmation" id="password_confirmation" type="password"> <br>
|
||||
{{ range (index $.FormErrors "password_confirmation")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
<h3>{{ call $.T "preferences"}}</h3>
|
||||
<label class="input-label" for="theme">{{call $.T "theme"}}</label> <br>
|
||||
|
@ -54,7 +54,7 @@
|
|||
<option value=""{{ if eq $.Theme "" }} selected{{end}}>{{call $.T "theme_none"}}</option>
|
||||
</select><br>
|
||||
{{ range (index $.FormErrors "theme")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
{{ with .Settings }}
|
||||
{{ if DefaultUserSettings "new_torrent"}}
|
||||
|
@ -64,7 +64,7 @@
|
|||
<option value="1" {{ if .Get "new_torrent" }}selected{{end}}>{{ call $.T "yes"}}</option>
|
||||
</select> <br>
|
||||
{{ range (index $.FormErrors "new_torrent")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{ if DefaultUserSettings "new_torrent_email"}}
|
||||
|
@ -74,7 +74,7 @@
|
|||
<option value="1" {{ if .Get "new_torrent_email"}}selected{{end}}>{{ call $.T "yes"}}</option>
|
||||
</select> <br>
|
||||
{{ range (index $.FormErrors "new_torrent_email")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{ if DefaultUserSettings "new_comment"}}
|
||||
|
@ -84,7 +84,7 @@
|
|||
<option value="1" {{ if .Get "new_comment" }}selected{{end}}>{{ call $.T "yes"}}</option>
|
||||
</select> <br>
|
||||
{{ range (index $.FormErrors "new_comment")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{ if DefaultUserSettings "new_comment_email"}}
|
||||
|
@ -94,7 +94,7 @@
|
|||
<option value="1" {{ if .Get "new_comment_email" }}selected{{end}}>{{ call $.T "yes"}}</option>
|
||||
</select> <br>
|
||||
{{ range (index $.FormErrors "new_comment_email")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{ if DefaultUserSettings "new_responses"}}
|
||||
|
@ -104,7 +104,7 @@
|
|||
<option value="1" {{ if .Get "new_responses" }}selected{{end}}>{{ call $.T "yes"}}</option>
|
||||
</select> <br>
|
||||
{{ range (index $.FormErrors "new_responses")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{ if DefaultUserSettings "new_responses_email"}}
|
||||
|
@ -114,7 +114,7 @@
|
|||
<option value="1" {{ if .Get "new_responses_email" }}selected{{end}}>{{ call $.T "yes"}}</option>
|
||||
</select> <br>
|
||||
{{ range (index $.FormErrors "new_responses_email")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{ if DefaultUserSettings "new_follower"}}
|
||||
|
@ -124,7 +124,7 @@
|
|||
<option value="1" {{ if .Get "new_follower" }}selected{{end}}>{{ call $.T "yes"}}</option>
|
||||
</select> <br>
|
||||
{{ range (index $.FormErrors "new_follower")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{ if DefaultUserSettings "new_follower_email"}}
|
||||
|
@ -134,7 +134,7 @@
|
|||
<option value="1" {{ if .Get "new_follower_email"}}selected{{end}}>{{ call $.T "yes"}}</option>
|
||||
</select> <br>
|
||||
{{ range (index $.FormErrors "new_follower_email")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{ if DefaultUserSettings "followed"}}
|
||||
|
@ -144,7 +144,7 @@
|
|||
<option value="1" {{ if .Get "followed" }}selected{{end}}>{{ call $.T "yes"}}</option>
|
||||
</select><br>
|
||||
{{ range (index $.FormErrors "followed")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{ if DefaultUserSettings "followed_email"}}
|
||||
|
@ -154,7 +154,7 @@
|
|||
<option value="1" {{ if .Get "followed_email" }}selected{{end}}>{{ call $.T "yes"}}</option>
|
||||
</select> <br>
|
||||
{{ range (index $.FormErrors "followed_email")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
@ -163,7 +163,7 @@
|
|||
<label class="input-label">{{ call $.T "username"}}:</label> <br>
|
||||
<input class="form-input up-input" name="username" id="username" type="text" value="{{.Username}}">
|
||||
{{ range (index $.FormErrors "username")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
<label class="input-label">{{ call $.T "role" }}:</label>
|
||||
<select id="status" name="status" class="form-input up-input">
|
||||
|
@ -175,7 +175,7 @@
|
|||
{{end}}
|
||||
</select>
|
||||
{{ range (index $.FormErrors "status")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
<label class="input-label"></label>
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
<label for="Status">{{call $.T "torrent_status"}}</label>
|
||||
<select name="status" class="form-control input-sm">
|
||||
<option value="5" {{if eq .Status 5}}selected{{end}}>{{ call $.T "torrent_status_blocked" }}</option>
|
||||
<option value="0" {{if eq .Status 0}}selected{{end}}>{{call $.T "torrent_status_hidden"}}</option>
|
||||
<option value="1" {{if eq .Status 1}}selected{{end}}>{{call $.T "torrent_status_normal"}}</option>
|
||||
<option value="2" {{if eq .Status 2}}selected{{end}}>{{call $.T "torrent_status_remake"}}</option>
|
||||
<option value="3" {{if eq .Status 3}}selected{{end}}>{{call $.T "trusted"}}</option>
|
||||
|
|
|
@ -17,6 +17,9 @@ Your browser does not support the audio element.
|
|||
<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>
|
||||
|
@ -39,10 +42,15 @@ Your browser does not support the audio element.
|
|||
</thead>
|
||||
<tbody id="torrentListResults">
|
||||
{{ range .Models}}
|
||||
<tr class="torrent-info
|
||||
<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}}">
|
||||
{{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 }}
|
||||
|
@ -88,11 +96,113 @@ Your browser does not support the audio element.
|
|||
</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) {
|
||||
|
@ -119,7 +229,7 @@ Your browser does not support the audio element.
|
|||
"<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;
|
||||
Torrents.LastID = {{ lastID .URL .Models }};
|
||||
if (Torrents.LastID > 0) Torrents.CanRefresh = true;
|
||||
</script>
|
||||
{{end}}
|
|
@ -25,9 +25,12 @@
|
|||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
|
||||
<!-- Base theme -->
|
||||
<link rel="stylesheet" id="style" href="{{.URL.Parse "/css/main.css"}}?v={{ .Config.Version }}">
|
||||
<!-- User selected theme, if any -->
|
||||
{{if .Theme}}<link rel="stylesheet" id="theme" href="/css/{{$.Theme}}.css?v={{ .Config.Version }}">{{end}}
|
||||
|
||||
<!-- User selected theme, if any, defaults to /g/ -->
|
||||
{{if eq $.Theme ""}}
|
||||
<link rel="stylesheet" id="theme" href="/css/g.css?v={{ .Config.Version }}">
|
||||
{{else}}
|
||||
<link rel="stylesheet" id="theme" href="/css/{{$.Theme}}.css?v={{ .Config.Version }}">
|
||||
{{end}}
|
||||
<!-- Search Box for Google -->
|
||||
<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebSite","url":"https://nyaa.pantsu.cat/","potentialAction":{"@type":"SearchAction","target":"https://nyaa.pantsu.cat/search?q={search_term_string}","query-input":"required name=search_term_string"}}</script>
|
||||
{{ block "additional_header" .}}{{end}}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{{define "title"}}{{call $.T "change_language"}}{{end}}
|
||||
{{define "content"}}
|
||||
<div class="blockBody">
|
||||
<hr>
|
||||
<div style="text-align: left;" class="box">
|
||||
<form role="form" method="POST">
|
||||
{{ block "csrf_field" $ }}{{end}}
|
||||
<div class="form-group">
|
||||
|
@ -14,10 +13,9 @@
|
|||
</select>
|
||||
<h3>{{call $.T "theme"}}</h3>
|
||||
<select id="theme-selector" name="theme" class="form-input" onchange="switchThemes()">
|
||||
<option value="">{{call $.T "theme_select"}}</option>
|
||||
<option value="g"{{ if eq $.Theme "g" }} selected{{end}}>/g/</option>
|
||||
<option value="g"{{ if or (eq $.Theme "g") (eq $.Theme "") }} selected{{end}}>/g/</option>
|
||||
<option value="tomorrow"{{ if eq $.Theme "tomorrow" }} selected{{end}}>Tomorrow</option>
|
||||
<option value=""{{ if eq $.Theme "" }} selected{{end}}>{{call $.T "theme_none"}}</option>
|
||||
<option value="classic"{{ if eq $.Theme "classic" }} selected{{end}}>Classic</option>
|
||||
</select>
|
||||
</br>
|
||||
<h3>{{call $.T "mascot"}}</h3>
|
||||
|
@ -31,8 +29,7 @@
|
|||
<button type="submit" class="form-input btn">{{call $.T "save_changes"}}</button>
|
||||
</div>
|
||||
</form>
|
||||
<div style="padding-bottom: 1em"></div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<form enctype="multipart/form-data" role="upload" method="POST">
|
||||
{{ block "csrf_field" $ }}{{end}}
|
||||
{{ range (index $.FormErrors "errors")}}
|
||||
<div class="alert alert-danger"><a class="panel-close close" data-dismiss="alert">×</a><i class="glyphicon glyphicon-exclamation-sign"></i> {{ . }}</div>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
|
||||
<h3>{{call $.T "name"}}</h3>
|
||||
|
|
|
@ -8,15 +8,15 @@
|
|||
{{ block "csrf_field" $ }}{{end}}
|
||||
<h2>{{call $.T "sign_in_box_title"}}</h2>
|
||||
{{ range (index $.FormErrors "errors")}}
|
||||
<div class="alert alert-danger">{{ . }}</div>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
<input type="text" name="username" id="username" class="form-input up-input" autofocus placeholder="{{ call $.T "email_address_or_username"}}"><br>
|
||||
{{ range (index $.FormErrors "username")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
<input type="password" name="password" id="password" class="form-input up-input" placeholder="{{ call $.T "password"}}"><br>
|
||||
{{ range (index $.FormErrors "password")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
<!-- <span class="button-checkbox">
|
||||
<button type="button" class="btn hidden" data-color="info">{{ call $.T "remember_me"}}</button>
|
||||
|
|
|
@ -8,28 +8,28 @@
|
|||
{{ block "csrf_field" $ }}{{end}}
|
||||
<h2>{{call $.T "signup_box_title" }}</h2>
|
||||
{{ range (index $.FormErrors "errors")}}
|
||||
<div class="alert alert-danger">{{ . }}</div>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
<input type="text" name="username" id="display_name" class="form-input up-input" placeholder="{{call $.T "username" }}" value="{{ .Username }}" autofocus> <br>
|
||||
{{ range (index $.FormErrors "username")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
<input type="email" name="email" id="email" class="form-input up-input" placeholder="{{call $.T "email_address" }}" value="{{ .Email }}"> <br>
|
||||
{{ range (index $.FormErrors "email")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
<input type="password" name="password" id="password" class="form-input up-input" placeholder="{{call $.T "password" }}" value="{{ .Password }}"> <br>
|
||||
{{ range (index $.FormErrors "password")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
<input type="password" name="password_confirmation" id="password_confirmation" class="form-input up-input" placeholder="{{call $.T "confirm_password" }}"> <br>
|
||||
{{ range (index $.FormErrors "password_confirmation")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
<span class="button-checkbox">
|
||||
<input type="checkbox" name="t_and_c" id="t_and_c" value="1">
|
||||
{{ range (index $.FormErrors "t_and_c")}}
|
||||
<p class="text-error">{{ . }}</p>
|
||||
<p class="error-text">{{ . }}</p>
|
||||
{{end}}
|
||||
</span>
|
||||
<p>By checking this box, you agree to the <a onclick="terms()">terms and conditions</a></p>
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
<p class="torrent-hr">{{call $.T "comments"}}</p>
|
||||
{{range $index, $element := .Comments}}
|
||||
<div class="torrent-info-box comment-box">
|
||||
<span class="comment-index"><a href="#comment_{{inc $index}}">#{{inc $index}}</a><small style="padding-left: 4px;" class="date-short">{{.Date.Format "2006-01-02T15:04:05Z07:00"}}</small></span>
|
||||
<span class="comment-index"><a href="#comment_{{inc $index}}">#{{inc $index}}</a><small style="padding-left: 4px;" class="date-short">{{formatDateRFC .Date}}</small></span>
|
||||
<p>{{.Username}}</p>
|
||||
<p>{{.Content}}</p>
|
||||
</div>
|
||||
|
|
|
@ -655,6 +655,10 @@
|
|||
"id": "torrent_status_remake",
|
||||
"translation": "Remake"
|
||||
},
|
||||
{
|
||||
"id": "torrent_status_blocked",
|
||||
"translation": "Locked"
|
||||
},
|
||||
{
|
||||
"id": "profile_edit_page",
|
||||
"translation": "Edit %s's profile"
|
||||
|
@ -935,6 +939,10 @@
|
|||
"id": "edit",
|
||||
"translation": "Edit"
|
||||
},
|
||||
{
|
||||
"id": "lock_delete",
|
||||
"translation": "Lock & Delete"
|
||||
},
|
||||
{
|
||||
"id": "delete_definitely_torrent_warning",
|
||||
"translation": "You will not be able to recover the file, neither stop someone to reupload it!"
|
||||
|
@ -997,7 +1005,7 @@
|
|||
},
|
||||
{
|
||||
"id": "cookies",
|
||||
"translation": "By cliking save you consent to our use of cookies"
|
||||
"translation": "By clicking save, you consent to our use of cookies"
|
||||
},
|
||||
{
|
||||
"id": "show",
|
||||
|
@ -1006,5 +1014,29 @@
|
|||
{
|
||||
"id": "hide",
|
||||
"translation": "Hide"
|
||||
},
|
||||
{
|
||||
"id":"show_mod_tools",
|
||||
"translation": "Show Mod Tools"
|
||||
},
|
||||
{
|
||||
"id":"hide_mod_tools",
|
||||
"translation": "Hide Mod Tools"
|
||||
},
|
||||
{
|
||||
"id": "following_changes_applied",
|
||||
"translation": "Following changes will be applied"
|
||||
},
|
||||
{
|
||||
"id": "changes_in_following_order",
|
||||
"translation": "Changes will be made in the following order:"
|
||||
},
|
||||
{
|
||||
"id": "edit_changes",
|
||||
"translation": "Edit Changes"
|
||||
},
|
||||
{
|
||||
"id": "delete_changes",
|
||||
"translation": "Delete Changes"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
},
|
||||
{
|
||||
"id": "theme_none",
|
||||
"translation": "Aucun"
|
||||
"translation": "Classique"
|
||||
},
|
||||
{
|
||||
"id": "mascot",
|
||||
|
@ -867,6 +867,14 @@
|
|||
"id": "toggle_navigation",
|
||||
"translation": "Activer la navigation"
|
||||
},
|
||||
{
|
||||
"id":"show_mod_tools",
|
||||
"translation": "Afficher les outils de modération"
|
||||
},
|
||||
{
|
||||
"id":"hide_mod_tools",
|
||||
"translation": "Maquer les outils de modération"
|
||||
},
|
||||
{
|
||||
"id": "torrent_status",
|
||||
"translation": "Statut du torrent"
|
||||
|
@ -887,6 +895,22 @@
|
|||
"id": "torrent_status_remake",
|
||||
"translation": "Remake"
|
||||
},
|
||||
{
|
||||
"id": "following_changes_applied",
|
||||
"translation": "Les modifications suivantes seront appliquées :"
|
||||
},
|
||||
{
|
||||
"id": "changes_in_following_order",
|
||||
"translation": "Les modifications seront effectuées dans l'ordre suivant :"
|
||||
},
|
||||
{
|
||||
"id": "edit_changes",
|
||||
"translation": "Éditer les modifications"
|
||||
},
|
||||
{
|
||||
"id": "delete_changes",
|
||||
"translation": "Supprimer les modifications"
|
||||
},
|
||||
{
|
||||
"id": "are_you_sure",
|
||||
"translation": "Êtes-vous sûr ?"
|
||||
|
@ -927,6 +951,10 @@
|
|||
"id": "edit",
|
||||
"translation": "Éditer"
|
||||
},
|
||||
{
|
||||
"id": "lock_delete",
|
||||
"translation": "Bloquer et Supprimer"
|
||||
},
|
||||
{
|
||||
"id": "torrent_unblock",
|
||||
"translation": "Débloquer"
|
||||
|
|
Référencer dans un nouveau ticket