Add JavaScript snippet to reset dest address scroll position onblur

Fixes Chrome/Blink disappearing text bugs in i2ptunnel and susidns.
This commit is contained in:
str4d
2017-07-27 01:23:06 +00:00
parent 2bfe27d217
commit 674f523cba
5 changed files with 35 additions and 5 deletions

View File

@ -14,6 +14,11 @@
}
}
%>
<%
response.setHeader("Content-Security-Policy", "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'");
%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><%=intl._t("Hidden Services Manager")%> - <%=intl._t("Edit Client Tunnel")%></title>
@ -29,6 +34,7 @@
<style type='text/css'>
input.default { width: 1px; height: 1px; visibility: hidden; }
</style>
<script src="/js/resetScroll.js" type="text/javascript"></script>
</head>
<body id="tunnelEditPage">
@ -538,7 +544,7 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
<tr>
<td colspan="2">
<div class="displayText" title="<%=intl._t("Read Only: Local Destination (if known)")%>" tabindex="0"><%=destb64%></div>
<div class="displayText" title="<%=intl._t("Read Only: Local Destination (if known)")%>" tabindex="0" onblur="resetScrollLeft(this)"><%=destb64%></div>
</td>
</tr>

View File

@ -14,6 +14,11 @@
}
}
%>
<%
response.setHeader("Content-Security-Policy", "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'");
%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><%=intl._t("Hidden Services Manager")%> - <%=intl._t("Edit Hidden Service")%></title>
@ -29,6 +34,7 @@
<style type='text/css'>
input.default { width: 1px; height: 1px; visibility: hidden; }
</style>
<script src="/js/resetScroll.js" type="text/javascript"></script>
</head>
<body id="tunnelEditPage">
@ -230,7 +236,7 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
<tr>
<td>
<div class="displayText" title="<%=intl._t("Read Only: Local Destination (if known)")%>" tabindex="0"><%=editBean.getDestinationBase64(curTunnel)%></div>
<div class="displayText" title="<%=intl._t("Read Only: Local Destination (if known)")%>" tabindex="0" onblur="resetScrollLeft(this)"><%=editBean.getDestinationBase64(curTunnel)%></div>
</td>
<td>
<% String value3 = editBean.getPrivateKeyFile(curTunnel);
@ -814,7 +820,7 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
<tr>
<td colspan="2">
<div class="displayText" title="<%=intl._t("Read Only: Alternate Local Destination")%>"><%=ab64%></div>
<div class="displayText" title="<%=intl._t("Read Only: Alternate Local Destination")%>" onblur="resetScrollLeft(this)"><%=ab64%></div>
</td>
</tr>

View File

@ -0,0 +1,15 @@
// resets scroll position of element
// use with onblur to clear scroll position when element loses focus
// reset scroll to left position
function resetScrollLeft(element) {
element.scrollLeft = 0;
}
// reset scroll to top position
function resetScrollTop(element) {
element.scrollTop = 0;
}

View File

@ -28,7 +28,7 @@
request.setCharacterEncoding("UTF-8");
response.setHeader("X-Frame-Options", "SAMEORIGIN");
response.setHeader("Content-Security-Policy", "default-src 'self'");
response.setHeader("Content-Security-Policy", "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'");
response.setHeader("X-XSS-Protection", "1; mode=block");
response.setHeader("X-Content-Type-Options", "nosniff");
response.setHeader("Referrer-Policy", "no-referrer");
@ -51,6 +51,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>${book.book} <%=intl._t("address book")%> - susidns</title>
<link rel="stylesheet" type="text/css" href="<%=book.getTheme()%>susidns.css?<%=net.i2p.CoreVersion.VERSION%>">
<script src="/js/resetScroll.js" type="text/javascript"></script>
</head>
<body>
<div class="page">
@ -184,7 +185,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">${addr.destination}</div></td>
<td class="destinations"><div class="destaddress" name="dest_${addr.name}" width="200px" tabindex="0" onblur="resetScrollLeft(this)">${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>

View File

@ -1,5 +1,7 @@
2017-07-26 str4d
* Console:
- Add JavaScript snippet to reset dest address scroll position onblur (fixes
Chrome/Blink disappearing text bugs in i2ptunnel and susidns)
- /debug:
- Add container divs and styling markup
- Add top navigation menu