i2psnark: Remove onclick on delete buttons

Version the js
This commit is contained in:
zzz
2020-05-11 20:47:42 +00:00
parent 9aa36562b9
commit d157daea10
2 changed files with 55 additions and 21 deletions

View File

@ -0,0 +1,39 @@
function init()
{
var buttons = document.getElementsByClassName("delete1");
for(index = 0; index < buttons.length; index++)
{
var button = buttons[index];
addClickHandler1(button);
}
buttons = document.getElementsByClassName("delete2");
for(index = 0; index < buttons.length; index++)
{
var button = buttons[index];
addClickHandler2(button);
}
}
function addClickHandler1(elem)
{
elem.addEventListener("click", function() {
if (!confirm(deleteMessage1.replace("{0}", elem.getAttribute("client")))) {
event.preventDefault();
return false;
}
});
}
function addClickHandler2(elem)
{
elem.addEventListener("click", function() {
if (!confirm(deleteMessage2.replace("{0}", elem.getAttribute("client")))) {
event.preventDefault();
return false;
}
});
}
document.addEventListener("DOMContentLoaded", function() {
init();
}, true);