mirror of
https://github.com/s00500/ESPUI.git
synced 2024-11-25 03:50:54 +00:00
codeformating
This commit is contained in:
parent
86132fe38d
commit
7e948c34fc
@ -320,7 +320,6 @@
|
||||
|
||||
button {
|
||||
display: inline-block;
|
||||
|
||||
padding: 10px;
|
||||
border-radius: 3px;
|
||||
color: #fff;
|
||||
|
84
examples/gui/data/js/controls.js
vendored
84
examples/gui/data/js/controls.js
vendored
@ -99,8 +99,18 @@ function start() {
|
||||
break;
|
||||
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>");
|
||||
$('#'+data.id).on({ 'touchstart' : function(e){e.preventDefault(); buttonclick(data.id, true) } });
|
||||
$('#'+data.id).on({ 'touchend' : function(e){e.preventDefault(); buttonclick(data.id, false) } });
|
||||
$('#' + data.id).on({
|
||||
'touchstart': function(e) {
|
||||
e.preventDefault();
|
||||
buttonclick(data.id, true)
|
||||
}
|
||||
});
|
||||
$('#' + data.id).on({
|
||||
'touchend': function(e) {
|
||||
e.preventDefault();
|
||||
buttonclick(data.id, false)
|
||||
}
|
||||
});
|
||||
break;
|
||||
case UI_SWITCHER:
|
||||
var label = "<label id='sl" + data.id + "' class='switch checked'>";
|
||||
@ -133,16 +143,66 @@ function start() {
|
||||
"</nav>" +
|
||||
"</div>");
|
||||
|
||||
$('#pf'+data.id).on({ 'touchstart' : function(e){e.preventDefault(); padclick(FOR, data.id, true) } });
|
||||
$('#pf'+data.id).on({ 'touchend' : function(e){e.preventDefault(); 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) } });
|
||||
$('#pf' + data.id).on({
|
||||
'touchstart': function(e) {
|
||||
e.preventDefault();
|
||||
padclick(FOR, data.id, true)
|
||||
}
|
||||
});
|
||||
$('#pf' + data.id).on({
|
||||
'touchend': function(e) {
|
||||
e.preventDefault();
|
||||
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;
|
||||
case UPDATE_LABEL:
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <WiFi.h>
|
||||
#include <ESPUI.h>
|
||||
#include <WiFi.h>
|
||||
|
||||
const char *ssid = "ESP32";
|
||||
const char *password = "";
|
||||
@ -42,7 +42,6 @@ void setup(void) {
|
||||
ESPUI.switcher("Switch two", true, &otherSwitchExample, COLOR_NONE);
|
||||
|
||||
ESPUI.begin("ESP32 Control");
|
||||
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
@ -63,7 +62,6 @@ void buttonCallback(Control sender, int type) {
|
||||
Serial.println("Button UP");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void buttonExample(Control sender, int type) {
|
||||
|
@ -93,8 +93,8 @@ void ESPUIClass::label(const char *label, int color, String value) {
|
||||
cIndex++;
|
||||
}
|
||||
|
||||
void ESPUIClass::button(const char *label, void (*callBack)(Control, int), int color,
|
||||
String value) {
|
||||
void ESPUIClass::button(const char *label, void (*callBack)(Control, int),
|
||||
int color, String value) {
|
||||
if (labelExists(label)) {
|
||||
if (debug)
|
||||
Serial.println("UI ERROR: Element " + String(label) +
|
||||
|
Loading…
Reference in New Issue
Block a user