1
0
mirror of https://github.com/s00500/ESPUI.git synced 2024-11-24 02:10:55 +00:00

Merge pull request #97 from ericBcreator/add_tab_callback_function

Add tab callback function
This commit is contained in:
Lukas Bachschwell 2020-10-02 19:04:26 +02:00 committed by GitHub
commit 34d974b03b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 500 deletions

7
data/js/controls.js vendored
View File

@ -557,7 +557,7 @@ function start() {
case UI_TAB:
$("#tabsnav").append(
"<li><a href='#tab" + data.id + "'>" + data.value + "</a></li>"
"<li><a onmouseup='tabclick(" + data.id + ")' href='#tab" + data.id + "'>" + data.value + "</a></li>"
);
$("#tabscontent").append("<div id='tab" + data.id + "'></div>");
@ -814,6 +814,11 @@ function textchange(number) {
websock.send("tvalue:" + val + ":" + number);
}
function tabclick(number) {
var val = $("#tab" + number).val();
websock.send("tabvalue:" + val + ":" + number);
}
function selectchange(number) {
var val = $("#select" + number).val();
websock.send("svalue:" + val + ":" + number);

File diff suppressed because one or more lines are too long

View File

@ -541,6 +541,10 @@ void onWsEvent(
ESPUI.updateControl(c, client->id());
c->callback(c, T_VALUE);
}
else if (msg.startsWith("tabvalue:"))
{
c->callback(c, client->id());
}
else if (msg.startsWith(F("svalue:")))
{
c->value = msg.substring(msg.indexOf(':') + 1, msg.lastIndexOf(':'));

File diff suppressed because one or more lines are too long