diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2018-04-08 17:09:55 +0100 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2018-04-08 17:09:55 +0100 |
| commit | c72ea6660d06ac347feafd6cbb8b3dc3c0f95c43 (patch) | |
| tree | 181c687d429aca4dab6efc8c07e3f94a6a4283df /public/javascripts | |
| parent | 0bbe22dd69bbb149e9fed74c87e7fc75e181483e (diff) | |
| download | tplink-energy-monitor-c72ea6660d06ac347feafd6cbb8b3dc3c0f95c43.tar.xz tplink-energy-monitor-c72ea6660d06ac347feafd6cbb8b3dc3c0f95c43.zip | |
Improve layout on mobile devices and tablets
Diffstat (limited to 'public/javascripts')
| -rw-r--r-- | public/javascripts/dash.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/public/javascripts/dash.js b/public/javascripts/dash.js index e3f39a9..821e9c1 100644 --- a/public/javascripts/dash.js +++ b/public/javascripts/dash.js @@ -11,7 +11,7 @@ var dash = { init: function(deviceId) { this.deviceId = deviceId; - $('#' + deviceId).addClass('active'); + $('.' + deviceId).addClass('active'); this.initRealtimeGauge(); this.initRealtimeTrendChart(); @@ -305,7 +305,13 @@ var dash = { $("#power-state").text("OFF").attr("class", "label label-danger"); } - $("#uptime").text(moment.duration(powerState.uptime, "seconds").format("d[d] h[h] m[m]")); + if(powerState.uptime === 0) { + $("#uptime").text("-"); + } + else { + $("#uptime").text(moment.duration(powerState.uptime, "seconds").format("d[d] h[h] m[m]", {largest: 2})); + } + }, }; |