1
0
mirror of https://github.com/s00500/ESPUI.git synced 2024-11-25 14:10:54 +00:00

codeformating

This commit is contained in:
Lukas Bachschwell 2017-11-14 12:14:59 +01:00
parent 86132fe38d
commit 7e948c34fc
4 changed files with 285 additions and 228 deletions

View File

@ -320,7 +320,6 @@
button { button {
display: inline-block; display: inline-block;
padding: 10px; padding: 10px;
border-radius: 3px; border-radius: 3px;
color: #fff; color: #fff;

View File

@ -99,8 +99,18 @@ function start() {
break; break;
case UI_BUTTON: case UI_BUTTON:
$('#row').append("<div class='one columns card tcenter " + colorClass(data.color) + "'><h5>" + data.label + "</h5><hr/><button onmousedown='buttonclick(" + data.id + ", true)' onmouseup='buttonclick(" + data.id + ", false)' id='" + data.id + "'>" + data.value + "</button></div>"); $('#row').append("<div class='one columns card tcenter " + colorClass(data.color) + "'><h5>" + data.label + "</h5><hr/><button onmousedown='buttonclick(" + data.id + ", true)' onmouseup='buttonclick(" + data.id + ", false)' id='" + data.id + "'>" + data.value + "</button></div>");
$('#'+data.id).on({ 'touchstart' : function(e){e.preventDefault(); buttonclick(data.id, true) } }); $('#' + data.id).on({
$('#'+data.id).on({ 'touchend' : function(e){e.preventDefault(); buttonclick(data.id, false) } }); 'touchstart': function(e) {
e.preventDefault();
buttonclick(data.id, true)
}
});
$('#' + data.id).on({
'touchend': function(e) {
e.preventDefault();
buttonclick(data.id, false)
}
});
break; break;
case UI_SWITCHER: case UI_SWITCHER:
var label = "<label id='sl" + data.id + "' class='switch checked'>"; var label = "<label id='sl" + data.id + "' class='switch checked'>";
@ -133,16 +143,66 @@ function start() {
"</nav>" + "</nav>" +
"</div>"); "</div>");
$('#pf'+data.id).on({ 'touchstart' : function(e){e.preventDefault(); padclick(FOR, data.id, true) } }); $('#pf' + data.id).on({
$('#pf'+data.id).on({ 'touchend' : function(e){e.preventDefault(); padclick(FOR, data.id, false) } }); 'touchstart': function(e) {
$('#pl'+data.id).on({ 'touchstart' : function(e){e.preventDefault(); padclick(LEFT, data.id, true) } }); e.preventDefault();
$('#pl'+data.id).on({ 'touchend' : function(e){e.preventDefault(); padclick(LEFT, data.id, false) } }); padclick(FOR, data.id, true)
$('#pr'+data.id).on({ 'touchstart' : function(e){e.preventDefault(); padclick(RIGHT, data.id, true) } }); }
$('#pr'+data.id).on({ 'touchend' : function(e){e.preventDefault(); padclick(RIGHT, data.id, false) } }); });
$('#pb'+data.id).on({ 'touchstart' : function(e){e.preventDefault(); padclick(BACK, data.id, true) } }); $('#pf' + data.id).on({
$('#pb'+data.id).on({ 'touchend' : function(e){e.preventDefault(); padclick(BACK,data.id, false) } }); 'touchend': function(e) {
$('#pc'+data.id).on({ 'touchstart' : function(e){e.preventDefault(); padclick(CENTER, data.id, true) } }); e.preventDefault();
$('#pc'+data.id).on({ 'touchend' : function(e){e.preventDefault(); padclick(CENTER,data.id, false) } }); padclick(FOR, data.id, false)
}
});
$('#pl' + data.id).on({
'touchstart': function(e) {
e.preventDefault();
padclick(LEFT, data.id, true)
}
});
$('#pl' + data.id).on({
'touchend': function(e) {
e.preventDefault();
padclick(LEFT, data.id, false)
}
});
$('#pr' + data.id).on({
'touchstart': function(e) {
e.preventDefault();
padclick(RIGHT, data.id, true)
}
});
$('#pr' + data.id).on({
'touchend': function(e) {
e.preventDefault();
padclick(RIGHT, data.id, false)
}
});
$('#pb' + data.id).on({
'touchstart': function(e) {
e.preventDefault();
padclick(BACK, data.id, true)
}
});
$('#pb' + data.id).on({
'touchend': function(e) {
e.preventDefault();
padclick(BACK, data.id, false)
}
});
$('#pc' + data.id).on({
'touchstart': function(e) {
e.preventDefault();
padclick(CENTER, data.id, true)
}
});
$('#pc' + data.id).on({
'touchend': function(e) {
e.preventDefault();
padclick(CENTER, data.id, false)
}
});
break; break;
case UPDATE_LABEL: case UPDATE_LABEL:

View File

@ -1,5 +1,5 @@
#include <WiFi.h>
#include <ESPUI.h> #include <ESPUI.h>
#include <WiFi.h>
const char *ssid = "ESP32"; const char *ssid = "ESP32";
const char *password = ""; const char *password = "";
@ -42,7 +42,6 @@ void setup(void) {
ESPUI.switcher("Switch two", true, &otherSwitchExample, COLOR_NONE); ESPUI.switcher("Switch two", true, &otherSwitchExample, COLOR_NONE);
ESPUI.begin("ESP32 Control"); ESPUI.begin("ESP32 Control");
} }
void loop(void) { void loop(void) {
@ -63,7 +62,6 @@ void buttonCallback(Control sender, int type) {
Serial.println("Button UP"); Serial.println("Button UP");
break; break;
} }
} }
void buttonExample(Control sender, int type) { void buttonExample(Control sender, int type) {

View File

@ -93,8 +93,8 @@ void ESPUIClass::label(const char *label, int color, String value) {
cIndex++; cIndex++;
} }
void ESPUIClass::button(const char *label, void (*callBack)(Control, int), int color, void ESPUIClass::button(const char *label, void (*callBack)(Control, int),
String value) { int color, String value) {
if (labelExists(label)) { if (labelExists(label)) {
if (debug) if (debug)
Serial.println("UI ERROR: Element " + String(label) + Serial.println("UI ERROR: Element " + String(label) +