i2ptunnel, SusiDNS: Replace onblur with CSP-safe js

This commit is contained in:
zzz
2020-05-20 11:12:49 +00:00
parent 4b7c62aa9c
commit a9d84da3b3
4 changed files with 28 additions and 6 deletions

View File

@ -504,7 +504,7 @@
</td>
</tr><tr>
<td colspan="2">
<div class="displayText" title="<%=intl._t("Read Only: Local Destination (if known)")%>" tabindex="0" onblur="resetScrollLeft(this)"><%=destb64%></div>
<div class="displayText resetScrollLeft" title="<%=intl._t("Read Only: Local Destination (if known)")%>" tabindex="0"><%=destb64%></div>
</td>
</tr><tr>
<td colspan="2">

View File

@ -181,7 +181,7 @@
</th>
</tr><tr>
<td>
<div class="displayText" title="<%=intl._t("Read Only: Local Destination (if known)")%>" tabindex="0" onblur="resetScrollLeft(this)"><%=editBean.getDestinationBase64(curTunnel)%></div>
<div class="displayText resetScrollLeft" title="<%=intl._t("Read Only: Local Destination (if known)")%>" tabindex="0"><%=editBean.getDestinationBase64(curTunnel)%></div>
</td><td>
<%
String value3 = editBean.getPrivateKeyFile(curTunnel);
@ -739,7 +739,7 @@
</th>
</tr><tr>
<td colspan="2">
<div class="displayText" title="<%=intl._t("Read Only: Alternate Local Destination")%>" onblur="resetScrollLeft(this)"><%=ab64%></div>
<div class="displayText resetScrollLeft" title="<%=intl._t("Read Only: Alternate Local Destination")%>"><%=ab64%></div>
</td>
</tr><tr>
<td colspan="2">

View File

@ -1,3 +1,21 @@
function initResetScroll()
{
var buttons = document.getElementsByClassName("resetScrollLeft");
for(index = 0; index < buttons.length; index++)
{
var button = buttons[index];
addBlurHandler(button);
}
}
function addBlurHandler(elem)
{
elem.addEventListener("blur", function() {
resetScrollLeft(elem);
});
}
// resets scroll position of element
// use with onblur to clear scroll position when element loses focus
@ -9,7 +27,11 @@ function resetScrollLeft(element) {
}
// reset scroll to top position
// unused
function resetScrollTop(element) {
element.scrollTop = 0;
}
document.addEventListener("DOMContentLoaded", function() {
initResetScroll();
}, true);

View File

@ -201,7 +201,7 @@ ${book.loadBookMessages}
<td class="names"><span class="addrhlpr"><a href="http://${addr.b32}/" target="_blank" title="<%=intl._t("Base 32 address")%>">b32</a></span></td>
<td class="helper"><a href="http://${addr.name}/?i2paddresshelper=${addr.destination}" target="_blank" title="<%=intl._t("Helper link to share host address with option to add to addressbook")%>">link</a></td>
<td class="names"><span class="addrhlpr"><a href="details?h=${addr.name}&amp;book=${book.book}" title="<%=intl._t("More information on this entry")%>"><%=intl._t("details")%></a></span></td>
<td class="destinations"><div class="destaddress" name="dest_${addr.name}" width="200px" tabindex="0" onblur="resetScrollLeft(this)">${addr.destination}</div></td>
<td class="destinations"><div class="destaddress resetScrollLeft" name="dest_${addr.name}" width="200px" tabindex="0">${addr.destination}</div></td>
<c:if test="${book.validBook}">
<td class="checkbox"><input type="checkbox" name="checked" value="${addr.name}" title="<%=intl._t("Mark for deletion")%>"></td>