Browse Source

Fix websocket data sensing

fastled
Xose Pérez 7 years ago
parent
commit
db2e1084cc
3 changed files with 547 additions and 540 deletions
  1. BIN
      code/espurna/data/index.html.gz
  2. +537
    -536
      code/espurna/static/index.html.gz.h
  3. +10
    -4
      code/html/custom.js

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


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


+ 10
- 4
code/html/custom.js View File

@ -113,6 +113,12 @@ function getData(form) {
$("input,select", form).each(function() { $("input,select", form).each(function() {
var name = $(this).attr("name"); var name = $(this).attr("name");
if (name) { if (name) {
// Do not report these fields
if (name == "filename") return;
if (name == "rfbcode") return;
// Grab the value
if ($(this).attr('type') == 'checkbox') { if ($(this).attr('type') == 'checkbox') {
value = $(this).is(':checked') ? 1 : 0; value = $(this).is(':checked') ? 1 : 0;
} else if ($(this).attr('type') == 'radio') { } else if ($(this).attr('type') == 'radio') {
@ -121,20 +127,20 @@ function getData(form) {
} else { } else {
value = $(this).val(); value = $(this).val();
} }
// Build the object
if (name in data) { if (name in data) {
if (!Array.isArray(data[name])) data[name] = [data[name]];
data[name].push(value); data[name].push(value);
} else if (is_group.indexOf(name) >= 0) { } else if (is_group.indexOf(name) >= 0) {
data[name] = [value]; data[name] = [value];
} else { } else {
data[name] = value; data[name] = value;
} }
} }
}); });
// Delete unwanted fields
delete(data["filename"]);
delete(data["rfbcode"]);
return data; return data;
} }


Loading…
Cancel
Save