i2psnark: Remove onclick on folder page

This commit is contained in:
zzz
2020-05-11 20:12:40 +00:00
parent 6a36b79a95
commit 9aa36562b9
2 changed files with 56 additions and 6 deletions

View File

@ -3686,7 +3686,7 @@ public class I2PSnarkServlet extends BasicServlet {
if ((!complete) && (!item.isDirectory())) { if ((!complete) && (!item.isDirectory())) {
if (!inOrder) { if (!inOrder) {
buf.append("<label class=\"priorityHigh\" title=\"").append(_t("Download file at high priority")).append("\">" + buf.append("<label class=\"priorityHigh\" title=\"").append(_t("Download file at high priority")).append("\">" +
"\n<input type=\"radio\" onclick=\"priorityclicked();\" class=\"prihigh\" value=\"5\" name=\"pri.").append(fileIndex).append("\" "); "\n<input type=\"radio\" class=\"prihigh\" value=\"5\" name=\"pri.").append(fileIndex).append("\" ");
if (priority > 0) if (priority > 0)
buf.append("checked=\"checked\""); buf.append("checked=\"checked\"");
buf.append('>') buf.append('>')
@ -3694,14 +3694,14 @@ public class I2PSnarkServlet extends BasicServlet {
} }
buf.append("<label class=\"priorityNormal\" title=\"").append(_t("Download file at normal priority")).append("\">" + buf.append("<label class=\"priorityNormal\" title=\"").append(_t("Download file at normal priority")).append("\">" +
"\n<input type=\"radio\" onclick=\"priorityclicked();\" class=\"prinorm\" value=\"0\" name=\"pri.").append(fileIndex).append("\" "); "\n<input type=\"radio\" class=\"prinorm\" value=\"0\" name=\"pri.").append(fileIndex).append("\" ");
if (priority == 0 || (inOrder && priority >= 0)) if (priority == 0 || (inOrder && priority >= 0))
buf.append("checked=\"checked\""); buf.append("checked=\"checked\"");
buf.append('>') buf.append('>')
.append(_t("Normal")).append("</label>"); .append(_t("Normal")).append("</label>");
buf.append("<label class=\"prioritySkip\" title=\"").append(_t("Do not download this file")).append("\">" + buf.append("<label class=\"prioritySkip\" title=\"").append(_t("Do not download this file")).append("\">" +
"\n<input type=\"radio\" onclick=\"priorityclicked();\" class=\"priskip\" value=\"-9\" name=\"pri.").append(fileIndex).append("\" "); "\n<input type=\"radio\" class=\"priskip\" value=\"-9\" name=\"pri.").append(fileIndex).append("\" ");
if (priority < 0) if (priority < 0)
buf.append("checked=\"checked\""); buf.append("checked=\"checked\"");
buf.append('>') buf.append('>')
@ -3716,12 +3716,12 @@ public class I2PSnarkServlet extends BasicServlet {
buf.append("<thead><tr id=\"setPriority\"><th class=\"headerpriority\" colspan=\"5\">" + buf.append("<thead><tr id=\"setPriority\"><th class=\"headerpriority\" colspan=\"5\">" +
"<span class=\"script\">"); "<span class=\"script\">");
if (!inOrder) { if (!inOrder) {
buf.append("<a class=\"control\" id=\"setallhigh\" href=\"javascript:void(null);\" onclick=\"setallhigh();\">") buf.append("<a class=\"control\" id=\"setallhigh\" href=\"#\">")
.append(toImg("clock_red")).append(_t("Set all high")).append("</a>\n"); .append(toImg("clock_red")).append(_t("Set all high")).append("</a>\n");
} }
buf.append("<a class=\"control\" id=\"setallnorm\" href=\"javascript:void(null);\" onclick=\"setallnorm();\">") buf.append("<a class=\"control\" id=\"setallnorm\" href=\"#\">")
.append(toImg("clock")).append(_t("Set all normal")).append("</a>\n" + .append(toImg("clock")).append(_t("Set all normal")).append("</a>\n" +
"<a class=\"control\" id=\"setallskip\" href=\"javascript:void(null);\" onclick=\"setallskip();\">") "<a class=\"control\" id=\"setallskip\" href=\"#\">")
.append(toImg("cancel")).append(_t("Skip all")).append("</a></span>\n" + .append(toImg("cancel")).append(_t("Skip all")).append("</a></span>\n" +
"<input type=\"submit\" class=\"accept\" value=\"").append(_t("Save priorities")) "<input type=\"submit\" class=\"accept\" value=\"").append(_t("Save priorities"))
.append("\" name=\"savepri\" >\n" + .append("\" name=\"savepri\" >\n" +

View File

@ -1,6 +1,49 @@
const setupbuttons=()=>{ const setupbuttons=()=>{
let sp = document.forms[0].savepri; let sp = document.forms[0].savepri;
if ( sp ) updatesetallbuttons(), sp.disabled = true, sp.className = 'disabled'; if ( sp ) updatesetallbuttons(), sp.disabled = true, sp.className = 'disabled';
var buttons = document.getElementsByClassName("prihigh");
for(index = 0; index < buttons.length; index++)
{
var button = buttons[index];
if (!button.disabled)
addClickHandler(button);
}
buttons = document.getElementsByClassName("prinorm");
for(index = 0; index < buttons.length; index++)
{
var button = buttons[index];
if (!button.disabled)
addClickHandler(button);
}
buttons = document.getElementsByClassName("priskip");
for(index = 0; index < buttons.length; index++)
{
var button = buttons[index];
if (!button.disabled)
addClickHandler(button);
}
var button = document.getElementById('setallhigh');
if (!button.disabled) {
button.addEventListener("click", function() {
setallhigh();
event.preventDefault();
});
}
button = document.getElementById('setallnorm');
if (!button.disabled) {
button.addEventListener("click", function() {
setallnorm();
event.preventDefault();
});
}
button = document.getElementById('setallskip');
if (!button.disabled) {
button.addEventListener("click", function() {
setallskip();
event.preventDefault();
});
}
} }
const priorityclicked=()=>{ const priorityclicked=()=>{
@ -62,6 +105,13 @@ const setallskip=()=>{
form.savepri.className = 'accept'; form.savepri.className = 'accept';
} }
function addClickHandler(elem)
{
elem.addEventListener("click", function() {
priorityclicked();
});
}
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
setupbuttons(); setupbuttons();
}, true); }, true);