From f59d747af1b43dc3903305ab69f76b6d1c3594d3 Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Tue, 4 Sep 2018 17:44:05 +0300 Subject: [PATCH] do not reset original attr every ws message --- code/html/custom.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/code/html/custom.js b/code/html/custom.js index e513218b..e0646b30 100644 --- a/code/html/custom.js +++ b/code/html/custom.js @@ -300,10 +300,18 @@ function sendConfig(data) { websock.send(JSON.stringify({config: data})); } -function resetOriginals() { +function setOriginalsFromValues(force) { + var force = (true === force); $("input,select").each(function() { - $(this).attr("original", $(this).val()); + var initial = (null === $(this).attr("original")); + if (force || initial) { + $(this).attr("original", $(this).val()); + } }); +} + +function resetOriginals() { + setOriginalsFromValues(true); numReboot = numReconnect = numReload = 0; } @@ -1458,7 +1466,7 @@ function processData(data) { generateAPIKey(); } - resetOriginals(); + setOriginalsFromValues(); }