forked from I2P_Developers/i2p.i2p
* i2psnark:
- Only show lower section on first page - Hide peer count if not connected - Dir page CSS tweaks
This commit is contained in:
@ -319,13 +319,15 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
writeConfigForm(out, req);
|
||||
writeTrackerForm(out, req);
|
||||
} else {
|
||||
writeTorrents(out, req);
|
||||
boolean pageOne = writeTorrents(out, req);
|
||||
// end of mainsection div
|
||||
out.write("</div><div id=\"lowersection\">\n");
|
||||
writeAddForm(out, req);
|
||||
writeSeedForm(out, req, sortedTrackers);
|
||||
writeConfigLink(out);
|
||||
// end of lowersection div
|
||||
if (pageOne) {
|
||||
out.write("</div><div id=\"lowersection\">\n");
|
||||
writeAddForm(out, req);
|
||||
writeSeedForm(out, req, sortedTrackers);
|
||||
writeConfigLink(out);
|
||||
// end of lowersection div
|
||||
}
|
||||
out.write("</div>\n");
|
||||
}
|
||||
out.write(FOOTER);
|
||||
@ -354,7 +356,10 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
}
|
||||
}
|
||||
|
||||
private void writeTorrents(PrintWriter out, HttpServletRequest req) throws IOException {
|
||||
/**
|
||||
* @return true if on first page
|
||||
*/
|
||||
private boolean writeTorrents(PrintWriter out, HttpServletRequest req) throws IOException {
|
||||
/** dl, ul, down rate, up rate, peers, size */
|
||||
final long stats[] = {0,0,0,0,0,0};
|
||||
String peerParam = req.getParameter("p");
|
||||
@ -585,8 +590,11 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
out.write(": ");
|
||||
out.write(ngettext("1 torrent", "{0} torrents", total));
|
||||
out.write(", ");
|
||||
out.write(DataHelper.formatSize2(stats[5]) + "B, ");
|
||||
out.write(ngettext("1 connected peer", "{0} connected peers", (int) stats[4]));
|
||||
out.write(DataHelper.formatSize2(stats[5]) + "B");
|
||||
if (_manager.util().connected() && total > 0) {
|
||||
out.write(", ");
|
||||
out.write(ngettext("1 connected peer", "{0} connected peers", (int) stats[4]));
|
||||
}
|
||||
DHT dht = _manager.util().getDHT();
|
||||
if (dht != null) {
|
||||
int dhts = dht.size();
|
||||
@ -598,7 +606,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
out.write(dht.renderStatusHTML());
|
||||
}
|
||||
out.write("</th>\n");
|
||||
if (_manager.util().connected()) {
|
||||
if (_manager.util().connected() && total > 0) {
|
||||
out.write(" <th align=\"right\">" + formatSize(stats[0]) + "</th>\n" +
|
||||
" <th align=\"right\">" + formatSize(stats[1]) + "</th>\n" +
|
||||
" <th align=\"right\">" + formatSize(stats[2]) + "ps</th>\n" +
|
||||
@ -613,6 +621,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
out.write("</table>");
|
||||
if (isForm)
|
||||
out.write("</form>\n");
|
||||
return start == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -437,12 +437,19 @@ table.snarkTorrentInfo, table.snarkDirInfo {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.snarkDirInfo thead img {
|
||||
margin: 0 -1px 0 0 !important;
|
||||
padding: 0 3px !important;
|
||||
}
|
||||
|
||||
.snarkTorrentInfo td {
|
||||
text-align: left !important;
|
||||
padding: 2px 0 1px 1px !important;
|
||||
}
|
||||
|
||||
.snarkTorrentInfo img {
|
||||
max-height: 16px;
|
||||
margin: 1px 2px 2px 10px !important;
|
||||
}
|
||||
|
||||
.snarkDirInfo td {
|
||||
|
@ -292,7 +292,7 @@ td:first-child {
|
||||
|
||||
.snarkTorrentEven {
|
||||
font-size: 7.5pt;
|
||||
background: #202;
|
||||
background: #270027;
|
||||
}
|
||||
|
||||
.snarkTorrentNoneLoaded {
|
||||
@ -389,12 +389,12 @@ td:first-child {
|
||||
|
||||
.snarkTorrentInfo img {
|
||||
max-height: 16px !important;
|
||||
margin: 1px 0 1px 2px !important;
|
||||
margin: 1px 2px 2px 10px !important;
|
||||
}
|
||||
|
||||
.snarkTorrentInfo td {
|
||||
text-align: left !important;
|
||||
padding: 0 1px !important;
|
||||
padding: 2px 0 1px 1px !important;
|
||||
}
|
||||
|
||||
table.SnarkTorrentInfo {
|
||||
@ -408,6 +408,7 @@ table.SnarkDirInfo {
|
||||
|
||||
.snarkDirInfo thead img {
|
||||
margin: 0 -1px 0 0 !important;
|
||||
padding: 0 3px !important;
|
||||
}
|
||||
|
||||
.SnarkDirInfo td, .SnarkDirInfo th {
|
||||
|
@ -401,12 +401,12 @@ td:first-child {
|
||||
|
||||
.snarkTorrentInfo img {
|
||||
max-height: 16px !important;
|
||||
margin: 1px 0 1px 2px !important;
|
||||
margin: 1px 2px 2px 10px !important;
|
||||
}
|
||||
|
||||
.snarkTorrentInfo td {
|
||||
text-align: left !important;
|
||||
padding: 0 1px !important;
|
||||
padding: 2px 0 1px 1px !important;
|
||||
}
|
||||
|
||||
table.SnarkTorrentInfo {
|
||||
@ -421,6 +421,7 @@ table.SnarkDirInfo {
|
||||
|
||||
.snarkDirInfo thead img {
|
||||
margin: 0 -1px 0 0 !important;
|
||||
padding: 0 3px !important;
|
||||
}
|
||||
|
||||
.SnarkDirInfo td {
|
||||
|
Reference in New Issue
Block a user