var session_start = (msg.payload.CE525.Start);var session_time = (msg.payload.CE525.Session_Time);
var session_time_minutes = session_time*60;
starting_minutes = session_time_minutes * 60000;
var max_gauge_minutes = session_time_minutes+10;var min_max = msg.ui_control = { "min":-0, "max":max_gauge_minutes };
if (session_start === true){var count = session_time_minutes;msg.payload=count;node.send([null,msg]);var countdown = setInterval(function() {count=count-1;msg.payload=count; node.send([null,msg]) }, 60000);context.set('countdown',countdown);}else if (session_start === false){var countdownstop = context.get('countdown')clearInterval(countdownstop);var min_max = msg.ui_control = { "min":0, "max":240 };msg.payload = ("CE525 Sim Session Ended Manually")node.send([msg,msg]);}var d1 = new Date();d1.setHours(1,30,0);
var t = 0;
function f(){ var h= d1.getHours(); var m= d1.getMinutes(); var s=d1.getSeconds(); m= (m<10)?"0"+m: m; s= (s<10)? "0"+s : s; var el= document.getElementById("inputid"); el.value= h+":"+m+":"+s; d1.setSeconds(d1.getSeconds()-1); if( h==0 && m==0 && s==0 ) clearTimeout(t) t= setTimeout(f,1000);}
function pause(){ clearTimeout(t); document.getElementById("pauseButton").disabled = "disabled"; document.getElementById("resumeButton").disabled = "";}
function resume(){ t= setTimeout(f,1000); document.getElementById("pauseButton").disabled = ""; document.getElementById("resumeButton").disabled = "disabled";}<form><input type="text" id="inputid"></form><script type="text/javascript">f()</script>
<input id="pauseButton" type="button" value="Pause" onclick="pause()" /><input id="resumeButton" type="button" value="Resume" onclick="resume()" disabled="disabled" />
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/96b4ce00-23ae-448b-af29-92d07383100b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.