diff --git a/app/www/static/js/intval.core.js b/app/www/static/js/intval.core.js index b710177..d05ba9d 100644 --- a/app/www/static/js/intval.core.js +++ b/app/www/static/js/intval.core.js @@ -174,9 +174,25 @@ var setState = function (res) { if (res.sequence == true) { STATE.sequence = true; mobile.ble.active = true; - document.getElementById('seq').classList.add('focus'); + seqState(true); } }; + +var seqState = function (state) { + const elem = document.getElementById('seq') + if (state) { + if (!elem.classList.contains('focus')) { + elem.classList.add('focus'); + elem.innerText = 'STOP SEQUENCE'; + } + } else { + if (elem.classList.contains('focus')) { + elem.classList.remove('focus'); + elem.innerText = 'START SEQUENCE'; + } + } +}; + var appPage = function () { unsetPages(); document.getElementById('app').classList.add('selected'); diff --git a/app/www/static/js/intval.web.js b/app/www/static/js/intval.web.js index 21653b3..371c523 100644 --- a/app/www/static/js/intval.web.js +++ b/app/www/static/js/intval.web.js @@ -152,14 +152,11 @@ web.sequenceSuccess = function (res) { if (res.started && res.started != false) { STATE.sequence = true; document.getElementById('seq').focus(); - if (!document.getElementById('seq').classList.contains('focus')) { - document.getElementById('seq').classList.add('focus'); - } + seqState(true); } else if (res.stopped) { STATE.sequence = false; document.getElementById('seq').blur(); - document.getElementById('seq').classList.remove('focus'); - //update frontend at end of sequence + seqState(false); mobile.getState(); } }