some buttons are now websocket-handled
This commit is contained in:
@@ -15,12 +15,31 @@ function initWebSocket() {
|
||||
}
|
||||
|
||||
function initButtons() {
|
||||
document
|
||||
.getElementById("btn-ws-stop")
|
||||
.addEventListener("click", livedebug_stop);
|
||||
document
|
||||
.getElementById("btn-ws-start")
|
||||
.addEventListener("click", livedebug_start);
|
||||
|
||||
var elements = document.getElementsByClassName("btn-wsevent");
|
||||
|
||||
if (elements.length > 0) {
|
||||
for (var i = 0; i < elements.length; i++) {
|
||||
var element = elements[i];
|
||||
element.addEventListener("click", function () {
|
||||
websocket_sendevent("btn-" + element.id, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initSettingInputs() {
|
||||
|
||||
var elements = document.getElementsByClassName("btn-wssetting");
|
||||
|
||||
if (elements.length > 0) {
|
||||
for (var i = 0; i < elements.length; i++) {
|
||||
var element = elements[i];
|
||||
element.addEventListener("change", function () {
|
||||
websocket_sendevent("set-" + element.id, element.value);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onOpen(event) {
|
||||
@@ -112,14 +131,11 @@ function processDataString(dataString, mapping) {
|
||||
function onLoad(event) {
|
||||
initWebSocket();
|
||||
initButtons();
|
||||
initSettingInputs();
|
||||
}
|
||||
|
||||
function livedebug_start() {
|
||||
websocket.send("start");
|
||||
}
|
||||
|
||||
function livedebug_stop() {
|
||||
websocket.send("stop");
|
||||
function websocket_sendevent(element_id, element_value) {
|
||||
websocket.send(element_id + ":" + element_value);
|
||||
}
|
||||
|
||||
function do_resize(textbox) {
|
||||
|
Reference in New Issue
Block a user