diff --git a/apps/routerconsole/jsp/configstats.jsp b/apps/routerconsole/jsp/configstats.jsp index 7dd5bfc212..3a30b2d668 100644 --- a/apps/routerconsole/jsp/configstats.jsp +++ b/apps/routerconsole/jsp/configstats.jsp @@ -4,62 +4,11 @@ <%@include file="css.jsi" %> -<%@include file="csp-unsafe.jsi" %> <%=intl.title("config stats")%> <%@include file="summaryajax.jsi" %> - - + + <%@include file="summary.jsi" %>

<%=intl._t("I2P Stats Configuration")%>

@@ -73,9 +22,9 @@ function toggleAll(category)
-

<%=intl._t("Configure I2P Stat Collection")%> " href="javascript:void(null);" onclick="toggleAll('*')">[<%=intl._t("toggle all")%>]

+

<%=intl._t("Configure I2P Stat Collection")%> " href="#">[<%=intl._t("toggle all")%>]


<% @@ -98,7 +47,7 @@ Warning - Log with care, stat file grows without limit.
> <%=statshelper.getTranslatedGroupName()%> - " href="javascript:void(null);" onclick="toggleAll('<%=statshelper.getCurrentGroupName()%>')">[<%=intl._t("toggle all")%>] + " href="#">[<%=intl._t("toggle all")%>] <% diff --git a/apps/routerconsole/jsp/js/configstats.js b/apps/routerconsole/jsp/js/configstats.js new file mode 100644 index 0000000000..bbfd27124b --- /dev/null +++ b/apps/routerconsole/jsp/js/configstats.js @@ -0,0 +1,65 @@ +function init() +{ + checkAll = false; + var buttons = document.getElementsByClassName("script"); + for(index = 0; index < buttons.length; index++) + { + var button = buttons[index]; + // toggle-foo + var group = button.id.substring(7); + addClickHandler(button, group); + } +} +function addClickHandler(elem, category) +{ + elem.addEventListener("click", function(){toggleAll(category); event.preventDefault(); return false;}); +} +function toggleAll(category) +{ + var inputs = document.getElementsByTagName("input"); + for(index = 0; index < inputs.length; index++) + { + var classes = inputs[index].className.split(' '); + for (var idx = 0; idx < classes.length; idx++) + { + if(classes[idx] == category) + { + if(inputs[index].checked == 0) + { + inputs[index].checked = 1; + } + else if(inputs[index].checked == 1) + { + inputs[index].checked = 0; + } + } + } + if(category == '*') + { + if (inputs[index].id == 'enableFull') { + // don't toggle this one + continue; + } + if (checkAll == false) + { + inputs[index].checked = 1; + } + else if (checkAll == true) + { + inputs[index].checked = 0; + } + } + } + if(category == '*') + { + if (checkAll == false) + { + checkAll = true; + } + else if (checkAll == true) + { + checkAll = false; + } + } +} +window.addEventListener("load", init);