diff --git a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
index 64457d9459..fd1db4c082 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
@@ -378,7 +378,26 @@ public class I2PSnarkServlet extends BasicServlet {
out.write("\n");
}
out.write(TABLE_HEADER);
- out.write("
 \n");
}
- out.write(" | \n");
+ out.write(" | \n");
out.write(" ");
+ out.write("\"> | \n");
+ if (total > 0 && (start > 0 || total > pageSize)) {
+ writePageNav(out, start, pageSize, total, peerParam, noThinsp);
+ }
out.write(" | \n");
if (_manager.util().connected() && !snarks.isEmpty()) {
out.write(" \n | ");
- // Opera and text-mode browsers: no and no input type=image values submitted
- // Using a unique name fixes Opera, except for the buttons with js confirms, see below
- String ua = req.getHeader("User-Agent");
- boolean isDegraded = ua != null && (ua.startsWith("Lynx") || ua.startsWith("w3m") ||
- ua.startsWith("ELinks") || ua.startsWith("Links") ||
- ua.startsWith("Dillo"));
-
- boolean noThinsp = isDegraded || (ua != null && ua.startsWith("Opera"));
if (_manager.isStopping()) {
out.write(" ");
} else if (_manager.util().connected()) {
@@ -500,18 +514,11 @@ public class I2PSnarkServlet extends BasicServlet {
} else {
out.write(" ");
}
- out.write(" | \n");
+ out.write("\n");
+ out.write("\n");
String uri = _contextPath + '/';
boolean showDebug = "2".equals(peerParam);
- int start = 0;
- int total = snarks.size();
- if (stParam != null) {
- try {
- start = Math.max(0, Math.min(total - 1, Integer.parseInt(stParam)));
- } catch (NumberFormatException nfe) {}
- }
- int pageSize = Math.max(_manager.getPageSize(), 5);
String stParamStr = stParam == null ? "" : "&st=" + stParam;
for (int i = 0; i < total; i++) {
Snark snark = (Snark)snarks.get(i);
@@ -529,62 +536,6 @@ public class I2PSnarkServlet extends BasicServlet {
} else /** if (snarks.size() > 1) */ {
out.write("\n" +
" ");
- // Page nav
- if (start > 0) {
- // First
- out.write(" " +
- " " +
- " ");
- int prev = Math.max(0, start - pageSize);
- if (prev > 0) {
- // Back
- out.write(" " +
- " " +
- " ");
- }
- }
- // Page count
- int pages = 1 + ((total - 1) / pageSize);
- if (pages == 1 && start > 0)
- pages = 2;
- if (pages > 1) {
- int page;
- if (start + pageSize >= total)
- page = pages;
- else
- page = 1 + (start / pageSize);
- out.write(" " + _("Page {0}", page) + thinsp(noThinsp) + pages + " ");
- }
- if (start + pageSize < total) {
- int next = start + pageSize;
- if (next + pageSize < total) {
- // Next
- out.write(" " +
- " " +
- " ");
- }
- // Last
- int last = ((total - 1) / pageSize) * pageSize;
- out.write(" " +
- " " +
- " ");
- }
out.write(" ");
out.write(_("Totals"));
out.write(": ");
@@ -624,6 +575,87 @@ public class I2PSnarkServlet extends BasicServlet {
return start == 0;
}
+ /**
+ * @since 0.9.6
+ */
+ private void writePageNav(PrintWriter out, int start, int pageSize, int total,
+ String peerParam, boolean noThinsp) {
+ // Page nav
+ if (start > 0) {
+ // First
+ out.write("" +
+ " " +
+ " ");
+ int prev = Math.max(0, start - pageSize);
+ //if (prev > 0) {
+ if (true) {
+ // Back
+ out.write(" " +
+ " " +
+ " ");
+ }
+ } else {
+ out.write(
+ " " +
+ " " +
+ " " +
+ " ");
+ }
+ // Page count
+ int pages = 1 + ((total - 1) / pageSize);
+ if (pages == 1 && start > 0)
+ pages = 2;
+ if (pages > 1) {
+ int page;
+ if (start + pageSize >= total)
+ page = pages;
+ else
+ page = 1 + (start / pageSize);
+ //out.write(" " + _("Page {0}", page) + thinsp(noThinsp) + pages + " ");
+ out.write(" " + page + thinsp(noThinsp) + pages + " ");
+ }
+ if (start + pageSize < total) {
+ int next = start + pageSize;
+ //if (next + pageSize < total) {
+ if (true) {
+ // Next
+ out.write(" " +
+ " " +
+ " ");
+ }
+ // Last
+ int last = ((total - 1) / pageSize) * pageSize;
+ out.write(" " +
+ " " +
+ " ");
+ } else {
+ out.write(" " +
+ " " +
+ " " +
+ " ");
+ }
+ }
+
/**
* Do what they ask, adding messages to _manager.addMessage as necessary
*/
@@ -2139,8 +2171,7 @@ public class I2PSnarkServlet extends BasicServlet {
private static final String TABLE_HEADER = "\n" +
- "\n" +
- "";
+ "\n";
private static final String FOOTER = " |
---|
|