From e686370341e95830125fc1d3b40c9a61a5e8aed4 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 18 Apr 2014 00:32:39 +0200 Subject: Modularize the ping page a bit. --- web/nms.gathering.org/ping.css | 13 +++++++++++++ web/nms.gathering.org/ping.html | 25 ++++++++++--------------- web/nms.gathering.org/ping.js | 22 ++++++++++++++-------- 3 files changed, 37 insertions(+), 23 deletions(-) create mode 100644 web/nms.gathering.org/ping.css (limited to 'web') diff --git a/web/nms.gathering.org/ping.css b/web/nms.gathering.org/ping.css new file mode 100644 index 0000000..1045a4a --- /dev/null +++ b/web/nms.gathering.org/ping.css @@ -0,0 +1,13 @@ +.switchname { + position: absolute; + font-family: sans-serif; + font-size: small; + white-space: nowrap; +} +.rot { + -webkit-transform: rotate(-90deg); + -webkit-transform-origin: 0% 0%; + transform: rotate(-90deg); + transform-origin: 0% 0%; + bottom: -14px; +} diff --git a/web/nms.gathering.org/ping.html b/web/nms.gathering.org/ping.html index 8205077..3aea383 100644 --- a/web/nms.gathering.org/ping.html +++ b/web/nms.gathering.org/ping.html @@ -1,25 +1,20 @@ + + Ping? Pong! + - +

+ diff --git a/web/nms.gathering.org/ping.js b/web/nms.gathering.org/ping.js index ce3d99f..c3d2c63 100644 --- a/web/nms.gathering.org/ping.js +++ b/web/nms.gathering.org/ping.js @@ -22,11 +22,11 @@ function json_request(url, func, repeat_ms) { } function get_switches() { - json_request('/switches-json.pl', draw_switches, 1000); + json_request(switches_url, draw_switches, 1000); } function get_ping() { - json_request('/ping-json.pl', update_ping, 1000); + json_request(ping_url, update_ping, 1000); } function draw_switches(json) { @@ -53,9 +53,11 @@ function draw_switches(json) { parseInt(s['height'])); } - for (var i = 0; i < json['linknets'].length; ++i) { - var linknet = json['linknets'][i]; - create_linknet(linknet['linknet'], linknet['switch1'], linknet['switch2']); + if (draw_linknets) { + for (var i = 0; i < json['linknets'].length; ++i) { + var linknet = json['linknets'][i]; + create_linknet(linknet['linknet'], linknet['switch1'], linknet['switch2']); + } } setTimeout(get_switches, 60000); @@ -137,9 +139,13 @@ function really_update_ping(json) { if (json['switches']) { for (var switchnum in switches) { if (json['switches'][switchnum]) { - switches[switchnum].style.background = - gradient_from_latency(json['switches'][switchnum]['latency'], - json['switches'][switchnum]['latency_secondary']); + if (json['switches'][switchnum]['color']) { + switches[switchnum].style.background = json['switches'][switchnum]['color']; + } else { + switches[switchnum].style.background = + gradient_from_latency(json['switches'][switchnum]['latency'], + json['switches'][switchnum]['latency_secondary']); + } } else { switches[switchnum].style.background = '#0000ff'; } -- cgit v1.2.3