Browse Source

Added zeroPad method in javascript

fastled
Xose Pérez 7 years ago
parent
commit
75b3fa6a28
3 changed files with 861 additions and 856 deletions
  1. BIN
      code/espurna/data/index.html.gz
  2. +856
    -855
      code/espurna/static/index.html.gz.h
  3. +5
    -1
      code/html/custom.js

BIN
code/espurna/data/index.html.gz View File


+ 856
- 855
code/espurna/static/index.html.gz.h
File diff suppressed because it is too large
View File


+ 5
- 1
code/html/custom.js View File

@ -43,6 +43,10 @@ function valueSet(data, name, value) {
data.push({'name': name, 'value': value}); data.push({'name': name, 'value': value});
} }
function zeroPad(number, positions) {
return ("0".repeat(positions) + number).slice(-positions);
}
function doUpdate() { function doUpdate() {
var form = $("#formSave"); var form = $("#formSave");
@ -539,7 +543,7 @@ function processData(data) {
var minutes = uptime % 60; uptime = parseInt(uptime / 60); var minutes = uptime % 60; uptime = parseInt(uptime / 60);
var hours = uptime % 24; uptime = parseInt(uptime / 24); var hours = uptime % 24; uptime = parseInt(uptime / 24);
var days = uptime; var days = uptime;
data[key] = days + 'd ' + ("00" + hours).slice(-2) + 'h ' + ("00" + minutes).slice(-2) + 'm ' + ("00" + seconds).slice(-2) + 's';
data[key] = days + 'd ' + zeroPad(hours, 2) + 'h ' + zeroPad(minutes, 2) + 'm ' + zeroPad(seconds, 2) + 's';
} }
if (key == "useWhite") { if (key == "useWhite") {


Loading…
Cancel
Save