forked from I2P_Developers/i2p.i2p
Console: Fix delete confirmation on /configplugins
Replace /configclients and /configplugins onclick with js file Remove unsafe CSP on /configclients
This commit is contained in:
@ -401,9 +401,7 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
}
|
||||
if (showDeleteButton && (!edit) && !ro) {
|
||||
buf.append("<button type=\"submit\" title=\"").append(_t("Delete")).append("\" class=\"control delete\" name=\"action\" value=\"Delete ").append(index)
|
||||
.append("\" onclick=\"if (!confirm('")
|
||||
.append(_t("Are you sure you want to delete {0}?", _t(escapedName)))
|
||||
.append("')) { return false; }\">")
|
||||
.append("\" client=\"").append(_t(escapedName)).append("\">")
|
||||
.append(_t("Delete")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
}
|
||||
buf.append("</td><td align=\"left\">");
|
||||
|
@ -3,7 +3,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%@include file="csp-unsafe.jsi" %>
|
||||
<%=intl.title("config clients")%>
|
||||
<style type='text/css'>
|
||||
button span.hide{
|
||||
@ -12,6 +11,10 @@ button span.hide{
|
||||
input.default { width: 1px; height: 1px; visibility: hidden; }
|
||||
</style>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
<script nonce="<%=cspNonce%>" type="text/javascript">
|
||||
var deleteMessage = "<%=intl._t("Are you sure you want to delete {0}?")%>";
|
||||
</script>
|
||||
<script src="/js/configclients.js?<%=net.i2p.CoreVersion.VERSION%>" type="text/javascript"></script>
|
||||
</head><body>
|
||||
<%@include file="summary.jsi" %>
|
||||
<jsp:useBean class="net.i2p.router.web.helpers.ConfigClientsHelper" id="clientshelper" scope="request" />
|
||||
|
@ -11,6 +11,10 @@ button span.hide{
|
||||
input.default { width: 1px; height: 1px; visibility: hidden; }
|
||||
</style>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
<script nonce="<%=cspNonce%>" type="text/javascript">
|
||||
var deleteMessage = "<%=intl._t("Are you sure you want to delete {0}?")%>";
|
||||
</script>
|
||||
<script src="/js/configclients.js?<%=net.i2p.CoreVersion.VERSION%>" type="text/javascript"></script>
|
||||
</head><body>
|
||||
<%@include file="summary.jsi" %>
|
||||
<jsp:useBean class="net.i2p.router.web.helpers.ConfigClientsHelper" id="clientshelper" scope="request" />
|
||||
|
23
apps/routerconsole/jsp/js/configclients.js
Normal file
23
apps/routerconsole/jsp/js/configclients.js
Normal file
@ -0,0 +1,23 @@
|
||||
function init()
|
||||
{
|
||||
var buttons = document.getElementsByClassName("delete");
|
||||
for(index = 0; index < buttons.length; index++)
|
||||
{
|
||||
var button = buttons[index];
|
||||
addClickHandler(button);
|
||||
}
|
||||
}
|
||||
|
||||
function addClickHandler(elem)
|
||||
{
|
||||
elem.addEventListener("click", function() {
|
||||
if (!confirm(deleteMessage.replace("{0}", elem.getAttribute("client")))) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
init();
|
||||
}, true);
|
@ -62,4 +62,7 @@ function toggleAll(category)
|
||||
}
|
||||
}
|
||||
}
|
||||
window.addEventListener("load", init);
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
init();
|
||||
}, true);
|
||||
|
Reference in New Issue
Block a user