* i2psnark:

- Only show lower section on first page
   - Hide peer count if not connected
   - Dir page CSS tweaks
This commit is contained in:
zzz
2013-04-28 16:43:40 +00:00
parent f4431b8d1e
commit 609bbac8d5
4 changed files with 728 additions and 710 deletions

View File

@@ -319,13 +319,15 @@ public class I2PSnarkServlet extends BasicServlet {
writeConfigForm(out, req); writeConfigForm(out, req);
writeTrackerForm(out, req); writeTrackerForm(out, req);
} else { } else {
writeTorrents(out, req); boolean pageOne = writeTorrents(out, req);
// end of mainsection div // end of mainsection div
if (pageOne) {
out.write("</div><div id=\"lowersection\">\n"); out.write("</div><div id=\"lowersection\">\n");
writeAddForm(out, req); writeAddForm(out, req);
writeSeedForm(out, req, sortedTrackers); writeSeedForm(out, req, sortedTrackers);
writeConfigLink(out); writeConfigLink(out);
// end of lowersection div // end of lowersection div
}
out.write("</div>\n"); out.write("</div>\n");
} }
out.write(FOOTER); 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 */ /** dl, ul, down rate, up rate, peers, size */
final long stats[] = {0,0,0,0,0,0}; final long stats[] = {0,0,0,0,0,0};
String peerParam = req.getParameter("p"); String peerParam = req.getParameter("p");
@@ -585,8 +590,11 @@ public class I2PSnarkServlet extends BasicServlet {
out.write(":&nbsp;"); out.write(":&nbsp;");
out.write(ngettext("1 torrent", "{0} torrents", total)); out.write(ngettext("1 torrent", "{0} torrents", total));
out.write(", "); out.write(", ");
out.write(DataHelper.formatSize2(stats[5]) + "B, "); 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])); out.write(ngettext("1 connected peer", "{0} connected peers", (int) stats[4]));
}
DHT dht = _manager.util().getDHT(); DHT dht = _manager.util().getDHT();
if (dht != null) { if (dht != null) {
int dhts = dht.size(); int dhts = dht.size();
@@ -598,7 +606,7 @@ public class I2PSnarkServlet extends BasicServlet {
out.write(dht.renderStatusHTML()); out.write(dht.renderStatusHTML());
} }
out.write("</th>\n"); out.write("</th>\n");
if (_manager.util().connected()) { if (_manager.util().connected() && total > 0) {
out.write(" <th align=\"right\">" + formatSize(stats[0]) + "</th>\n" + out.write(" <th align=\"right\">" + formatSize(stats[0]) + "</th>\n" +
" <th align=\"right\">" + formatSize(stats[1]) + "</th>\n" + " <th align=\"right\">" + formatSize(stats[1]) + "</th>\n" +
" <th align=\"right\">" + formatSize(stats[2]) + "ps</th>\n" + " <th align=\"right\">" + formatSize(stats[2]) + "ps</th>\n" +
@@ -613,6 +621,7 @@ public class I2PSnarkServlet extends BasicServlet {
out.write("</table>"); out.write("</table>");
if (isForm) if (isForm)
out.write("</form>\n"); out.write("</form>\n");
return start == 0;
} }
/** /**

View File

@@ -437,12 +437,19 @@ table.snarkTorrentInfo, table.snarkDirInfo {
margin: 0 !important; margin: 0 !important;
} }
.snarkDirInfo thead img {
margin: 0 -1px 0 0 !important;
padding: 0 3px !important;
}
.snarkTorrentInfo td { .snarkTorrentInfo td {
text-align: left !important; text-align: left !important;
padding: 2px 0 1px 1px !important;
} }
.snarkTorrentInfo img { .snarkTorrentInfo img {
max-height: 16px; max-height: 16px;
margin: 1px 2px 2px 10px !important;
} }
.snarkDirInfo td { .snarkDirInfo td {

View File

@@ -292,7 +292,7 @@ td:first-child {
.snarkTorrentEven { .snarkTorrentEven {
font-size: 7.5pt; font-size: 7.5pt;
background: #202; background: #270027;
} }
.snarkTorrentNoneLoaded { .snarkTorrentNoneLoaded {
@@ -389,12 +389,12 @@ td:first-child {
.snarkTorrentInfo img { .snarkTorrentInfo img {
max-height: 16px !important; max-height: 16px !important;
margin: 1px 0 1px 2px !important; margin: 1px 2px 2px 10px !important;
} }
.snarkTorrentInfo td { .snarkTorrentInfo td {
text-align: left !important; text-align: left !important;
padding: 0 1px !important; padding: 2px 0 1px 1px !important;
} }
table.SnarkTorrentInfo { table.SnarkTorrentInfo {
@@ -408,6 +408,7 @@ table.SnarkDirInfo {
.snarkDirInfo thead img { .snarkDirInfo thead img {
margin: 0 -1px 0 0 !important; margin: 0 -1px 0 0 !important;
padding: 0 3px !important;
} }
.SnarkDirInfo td, .SnarkDirInfo th { .SnarkDirInfo td, .SnarkDirInfo th {

View File

@@ -401,12 +401,12 @@ td:first-child {
.snarkTorrentInfo img { .snarkTorrentInfo img {
max-height: 16px !important; max-height: 16px !important;
margin: 1px 0 1px 2px !important; margin: 1px 2px 2px 10px !important;
} }
.snarkTorrentInfo td { .snarkTorrentInfo td {
text-align: left !important; text-align: left !important;
padding: 0 1px !important; padding: 2px 0 1px 1px !important;
} }
table.SnarkTorrentInfo { table.SnarkTorrentInfo {
@@ -421,6 +421,7 @@ table.SnarkDirInfo {
.snarkDirInfo thead img { .snarkDirInfo thead img {
margin: 0 -1px 0 0 !important; margin: 0 -1px 0 0 !important;
padding: 0 3px !important;
} }
.SnarkDirInfo td { .SnarkDirInfo td {