forked from I2P_Developers/i2p.i2p
i2psnark: Search fixes
Fix JS search when refresh disabled Fix search cancel when JS disabled
This commit is contained in:
@@ -326,7 +326,8 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
out.write("<script src=\".resources/js/configui.js?" + CoreVersion.VERSION + "\" type=\"text/javascript\"></script>\n");
|
||||
} else {
|
||||
delay = _manager.getRefreshDelaySeconds();
|
||||
if (delay > 0) {
|
||||
// init for search even if refresh disabled
|
||||
//if (delay > 0) {
|
||||
String jsPfx = _context.isRouterContext() ? "" : ".resources";
|
||||
String downMsg = _context.isRouterContext() ? _t("Router is down") : _t("I2PSnark has stopped");
|
||||
// fallback to metarefresh when javascript is disabled
|
||||
@@ -337,7 +338,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
"var ajaxDelay = " + (delay * 1000) + ";\n" +
|
||||
"</script>\n" +
|
||||
"<script src=\".resources/js/initajax.js?" + CoreVersion.VERSION + "\" type=\"text/javascript\"></script>\n");
|
||||
}
|
||||
//}
|
||||
out.write("<script nonce=\"" + cspNonce + "\" type=\"text/javascript\">\n" +
|
||||
"var deleteMessage1 = \"" + _t("Are you sure you want to delete the file \\''{0}\\'' (downloaded data will not be deleted) ?") + "\";\n" +
|
||||
"var deleteMessage2 = \"" + _t("Are you sure you want to delete the torrent \\''{0}\\'' and all downloaded data?") + "\";\n" +
|
||||
@@ -394,7 +395,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
if (search != null)
|
||||
out.write(" value=\"" + DataHelper.escapeHTML(search) + '"');
|
||||
out.write(">" +
|
||||
"<input type=\"reset\" class=\"cancel\" id=\"searchcancel\" value=\"\">" +
|
||||
"<a class=\"cancel\" id=\"searchcancel\" href=\"" + _contextPath + "/\"></a>" +
|
||||
"</form>\n");
|
||||
}
|
||||
}
|
||||
|
@@ -55,7 +55,9 @@ function requestAjax2(refreshtime) {
|
||||
}
|
||||
|
||||
function initAjax() {
|
||||
setTimeout(requestAjax1, ajaxDelay);
|
||||
if (ajaxDelay > 0) {
|
||||
setTimeout(requestAjax1, ajaxDelay);
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
|
@@ -12,7 +12,7 @@ function initSearch()
|
||||
if (sch != null) {
|
||||
var box = document.getElementById("searchbox");
|
||||
var cxl = document.getElementById("searchcancel");
|
||||
sch.addEventListener("reset", function(event) {
|
||||
cxl.addEventListener("click", function(event) {
|
||||
if (box.value !== "") {
|
||||
box.value = "";
|
||||
requestAjax2(-1);
|
||||
@@ -35,6 +35,8 @@ function initSearch()
|
||||
} else {
|
||||
cxl.classList.add("disabled");
|
||||
}
|
||||
// so we don't get the link popup
|
||||
cxl.removeAttribute("href");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -245,9 +245,13 @@ _:-ms-lang(x), .snarknavbar {
|
||||
#searchcancel {
|
||||
background: url(images/delete.png) 0px center no-repeat;
|
||||
margin: 2px 4px 2px -20px;
|
||||
padding: 0px 6px;
|
||||
color: transparent;
|
||||
border: none;
|
||||
width: 12px;
|
||||
}
|
||||
|
||||
#searchcancel.disabled {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* end topnav */
|
||||
|
@@ -250,9 +250,13 @@ button::-moz-focus-inner, input::-moz-focus-inner {
|
||||
#searchcancel {
|
||||
background: url(images/delete.png) 0px center no-repeat;
|
||||
margin: 2px 4px 2px 4px;
|
||||
padding: 0px 6px;
|
||||
color: transparent;
|
||||
border: none;
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
#searchcancel.disabled {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* end top nav */
|
||||
|
@@ -249,12 +249,17 @@ _:-ms-lang(x), .snarkNav:last-child[href="/i2psnark/"] {
|
||||
}
|
||||
|
||||
#searchcancel {
|
||||
background: url(images/cancel.png);
|
||||
background: url(images/cancel.png) no-repeat;
|
||||
margin: 2px 4px 2px -28px;
|
||||
padding: 0px 12px;
|
||||
color: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#searchcancel.disabled {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* end topnav */
|
||||
|
||||
/* screenlogger */
|
||||
|
@@ -294,10 +294,15 @@ _:-ms-lang(x), .snarkNav:link, .snarkNav:visited {
|
||||
#searchcancel {
|
||||
background: url(images/delete.png) 7px center no-repeat;
|
||||
margin: 2px 4px 2px -30px;
|
||||
padding: 0px 14px;
|
||||
color: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#searchcancel.disabled {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* end topnav */
|
||||
|
||||
/* screenlog */
|
||||
|
Reference in New Issue
Block a user