forked from I2P_Developers/i2p.i2p
I2PSnark fallbacks when JS is unavailable:
- Use meta-refresh - Hide JavaScript-dependent buttons
This commit is contained in:
@ -291,7 +291,8 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
String jsPfx = _context.isRouterContext() ? "" : ".resources";
|
String jsPfx = _context.isRouterContext() ? "" : ".resources";
|
||||||
String downMsg = _context.isRouterContext() ? _t("Router is down") : _t("I2PSnark has stopped");
|
String downMsg = _context.isRouterContext() ? _t("Router is down") : _t("I2PSnark has stopped");
|
||||||
//out.write("<meta http-equiv=\"refresh\" content=\"" + delay + ";/i2psnark/" + peerString + "\">\n");
|
// fallback to metarefresh when javascript is disabled
|
||||||
|
out.write("<noscript><meta http-equiv=\"refresh\" content=\"" + delay + ";/i2psnark/" + peerString + "\"></noscript>\n");
|
||||||
out.write("<script src=\"" + jsPfx + "/js/ajax.js\" type=\"text/javascript\"></script>\n" +
|
out.write("<script src=\"" + jsPfx + "/js/ajax.js\" type=\"text/javascript\"></script>\n" +
|
||||||
"<script type=\"text/javascript\">\n" +
|
"<script type=\"text/javascript\">\n" +
|
||||||
"var failMessage = \"<div class=\\\"routerdown\\\"><b>" + downMsg + "<\\/b><\\/div>\";\n" +
|
"var failMessage = \"<div class=\\\"routerdown\\\"><b>" + downMsg + "<\\/b><\\/div>\";\n" +
|
||||||
@ -2752,6 +2753,8 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
title = _t("Torrent") + ": " + DataHelper.escapeHTML(title);
|
title = _t("Torrent") + ": " + DataHelper.escapeHTML(title);
|
||||||
buf.append(title);
|
buf.append(title);
|
||||||
buf.append("</TITLE>\n").append(HEADER_A).append(_themePath).append(HEADER_B)
|
buf.append("</TITLE>\n").append(HEADER_A).append(_themePath).append(HEADER_B)
|
||||||
|
// hide javascript-dependent buttons when js is unavailable
|
||||||
|
.append("<noscript><style>.script {display: none;}</style></noscript>")
|
||||||
.append("<link rel=\"shortcut icon\" href=\"" + _themePath + "favicon.ico\">\n");
|
.append("<link rel=\"shortcut icon\" href=\"" + _themePath + "favicon.ico\">\n");
|
||||||
if (showPriority)
|
if (showPriority)
|
||||||
buf.append("<script src=\"").append(_contextPath).append(WARBASE + "js/folder.js\" type=\"text/javascript\"></script>\n");
|
buf.append("<script src=\"").append(_contextPath).append(WARBASE + "js/folder.js\" type=\"text/javascript\"></script>\n");
|
||||||
|
Reference in New Issue
Block a user