modules/admin-full: small style fix in switch status
[project/luci.git] / modules / admin-full / luasrc / view / admin_network / switch_status.htm
1 <script type="text/javascript">//<![CDATA[
2 var tb;
3 var ths = document.getElementsByTagName('th');
4 for (var i = 0; i < ths.length; i++)
5 if (ths[i].className = 'cbi-section-table-cell' && !ths[i].innerHTML)
6 {
7 ths[i].innerHTML = '<%:Port status:%>';
8 tb = ths[i].parentNode;
9 break;
10 }
11
12 if (tb)
13 {
14 XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "switch_status", self.switch)%>', null,
15 function(x, st)
16 {
17 if (st && st.length)
18 {
19 for (var i = 0; i < st.length; i++)
20 {
21 var th = tb.childNodes[i+1];
22
23 if (st[i].link)
24 {
25 th.innerHTML = String.format(
26 '<small><img src="<%=resource%>/icons/port_up.png" />' +
27 '<br />%d<%:baseT%><br />%s</small>',
28 st[i].speed, st[i].duplex
29 ? '<%:full-duplex%>' : '<%:half-duplex%>'
30 );
31 }
32 else
33 {
34 th.innerHTML = String.format(
35 '<small><img src="<%=resource%>/icons/port_down.png" />' +
36 '<br /><%:no link%></small>'
37 );
38 }
39 }
40 }
41 }
42 );
43 }
44 //]]></script>