Skip to content

Commit e37149a

Browse files
committedFeb 21, 2021
Improve table column sizing, template, CSS
1 parent a5bc675 commit e37149a

File tree

5 files changed

+38
-33
lines changed

5 files changed

+38
-33
lines changed
 

‎README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,15 @@ First install node.js, e.g.:
1212
# apt-get install nodejs
1313
# # OR:
1414
# pacman -S nodejs
15-
# # OR:
16-
# emerge nodejs
1715

1816
Then install doT.js and its dependencies:
1917

20-
$ cd ~
2118
$ npm install dot commander mkdirp
2219

2320
And finally compile the template:
2421

2522
$ cd static
26-
$ ~/node_modules/dot/bin/dot-packer -s .
23+
$ ../node_modules/dot/bin/dot-packer -s .
2724

2825
You can now serve the webpage by copying the files in static/ to your web root, or by [starting the server list](#setting-up-the-server).
2926

‎static/index.html

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
a:visited {
1414
color: #336BA1;
1515
}
16+
@media only screen and (max-width: 1024px) {
17+
#server_list table .version, #server_list table .flags, #server_list table .uptime {
18+
display: none;
19+
}
20+
}
1621
</style>
1722
<script>
1823
var master = {show_proto_select: true};

‎static/list.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,9 @@ function addressString(server) {
4747
return str + '>' + shortStr + '</span>';
4848
}
4949

50-
function tooltipString(str, maxLen) {
50+
function tooltipString(str) {
5151
str = escapeHTML(str);
52-
var ret = str;
53-
if (ret.length > maxLen) {
54-
ret = '<div class="mts_tooltip" style="width:' + maxLen + 'ch;"';
55-
ret += ' title="' + str + '">' + str + '</div>';
56-
}
57-
return ret;
52+
return '<span title="' + str + '">' + str + '</div>';
5853
}
5954

6055
function hoverList(name, list) {

‎static/servers.jst

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
<thead><tr>
1717
{{? !master.no_address}}<th>Address[:Port]</th>{{?}}
1818
{{? !master.no_clients}}<th>Players / Max{{? !master.no_avgtop}}<br/>Average / Top{{?}}</th>{{?}}
19-
{{? !master.no_version}}<th>Version, Subgame[, Mapgen]</th>{{?}}
19+
{{? !master.no_version}}<th class="version">Version, Subgame[, Mapgen]</th>{{?}}
2020
{{? !master.no_name}}<th>Name</th>{{?}}
2121
{{? !master.no_description}}<th>Description</th>{{?}}
22-
{{? !master.no_flags}}<th>Flags</th>{{?}}
23-
{{? !master.no_uptime}}<th>Uptime, Age</th>{{?}}
22+
{{? !master.no_flags}}<th class="flags">Flags</th>{{?}}
23+
{{? !master.no_uptime}}<th class="uptime">Uptime, Age</th>{{?}}
2424
{{? !master.no_ping}}<th>Ping, Lag</th>{{?}}
2525
</tr></thead>
2626
<tbody>
@@ -49,14 +49,14 @@
4949
{{? !master.no_name}}
5050
<td class="name">
5151
{{? server.url}}
52-
<a href="{{!server.url}}">{{=tooltipString(server.name, 25)}}</a>
52+
<a href="{{!server.url}}">{{=tooltipString(server.name)}}</a>
5353
{{??}}
54-
{{=tooltipString(server.name, 25)}}
54+
{{=tooltipString(server.name)}}
5555
{{?}}
5656
</td>{{?}}
5757
{{? !master.no_description}}
5858
<td class="description">
59-
{{=tooltipString(server.description, 50)}}
59+
{{=tooltipString(server.description)}}
6060
</td>{{?}}
6161
{{? !master.no_flags}}
6262
<td class="flags {{? server.privs}} mts_hover_list_text{{?}}">
@@ -81,5 +81,5 @@
8181
</tbody>
8282
</table>
8383
{{? master.min_clients || master.limit}}
84-
<a class="clickable" onclick="delete master.min_clients; delete master.limit; get();">Show more...</a>
84+
<a href="javascript:delete master.min_clients; delete master.limit; get();">Show more...</a>
8585
{{?}}

‎static/style.css

+23-15
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#server_list td, #server_list th {
1515
border: 1px solid #2A3132;
1616
padding: 5px;
17+
color: inherit;
1718
}
1819

1920
#server_list thead {
@@ -31,39 +32,46 @@
3132
text-align: center;
3233
}
3334

35+
#server_list td.version, #server_list td.name, #server_list td.description {
36+
text-overflow: ellipsis;
37+
overflow: hidden;
38+
white-space: nowrap;
39+
}
40+
41+
/* Note: the column widths here are not exact as auto-layout is left enabled */
42+
43+
#server_list td.address {
44+
max-width: 24ch;
45+
}
46+
#server_list td.version {
47+
max-width: 16ch;
48+
}
49+
#server_list td.name {
50+
max-width: 32ch;
51+
}
52+
#server_list td.description {
53+
max-width: 64ch;
54+
}
55+
3456
.mts_hover_list {
3557
display: none;
3658
border: 1px solid #336B87;
3759
border-radius: 10px;
38-
background-color: #FAFAFA;
60+
background-color: #FFF;
3961
position: absolute;
4062
z-index: 100;
4163
padding: 0.5em;
4264
box-shadow: 1px 1px 5px 3px rgba(0, 0, 0, 0.25);
4365
}
4466

4567
.mts_hover_list b {
46-
display: inline-block;
4768
font-size: 1.1em;
48-
padding-bottom: 2px;
4969
}
5070

5171
td:hover .mts_hover_list {
5272
display: block;
5373
}
5474

55-
.clickable {
56-
text-decoration: underline;
57-
cursor: pointer;
58-
}
59-
60-
.mts_tooltip {
61-
text-overflow: ellipsis;
62-
overflow: hidden;
63-
white-space: nowrap;
64-
}
65-
6675
.mts_cwidth {
6776
display: inline-block;
68-
text-align: center;
6977
}

0 commit comments

Comments
 (0)
Please sign in to comment.