From 33b71c31341ad649999dd25d7461d82149b04937 Mon Sep 17 00:00:00 2001 From: chrono Date: Thu, 28 Nov 2013 17:17:15 +0100 Subject: [PATCH] Cleanup of index.html --- public/assets/js/picoreflow.js | 349 ++++++++++++++++++++++++++++++++ public/index.html | 352 +-------------------------------- storage/profiles/lead.json | 2 +- 3 files changed, 353 insertions(+), 350 deletions(-) create mode 100644 public/assets/js/picoreflow.js diff --git a/public/assets/js/picoreflow.js b/public/assets/js/picoreflow.js new file mode 100644 index 0000000..4abfe05 --- /dev/null +++ b/public/assets/js/picoreflow.js @@ -0,0 +1,349 @@ + + +function updateProgress(percentage){ + if(state=="RUNNING") { + if(percentage > 100) percentage = 100; + $('#progressBar').css('width', percentage+'%'); + if(percentage>=5) $('#progressBar').html(percentage+'%'); +} else { + $('#progressBar').css('width', 0+'%'); + $('#progressBar').html(''); +} +} + + +function runTask() { + var test = { + "cmd": "RUN", + "profile": profiles[selected_profile] + } + + console.log(JSON.stringify(test)); + + ws_control.send(JSON.stringify(test)); + graph.series[1].setData([]); +} + + +function abortTask() { + var test = {"cmd": "STOP"}; + console.log(JSON.stringify(test)); + ws_control.send(JSON.stringify(test)); +} + + +function enterEditMode() { + state="EDIT" + $('#main_status').slideUp(); + $('#saveas').show(); + $('#e2').select2('container').hide(); + $('#nav_start').hide(); + $('#btn_edit').hide(); + $('#btn_exit').show(); + $('#form_profile_name').attr('value', profiles[selected_profile].name); + graph.series[0].options.marker.enabled=true; + graph.series[0].options.draggableX=true; + graph.series[0].options.draggableY=true; + graph.render(); + +} +function leaveEditMode() { + state="IDLE"; + $('#saveas').hide(); + $('#e2').select2('container').show(); + $('#main_status').slideDown(); + $('#nav_start').show(); + $('#btn_edit').show(); + $('#btn_exit').hide(); + graph.series[0].options.marker.enabled=false; + graph.series[0].options.draggableX=false; + graph.series[0].options.draggableY=false; + graph.render(); +} + +function saveProfile() { + name = $('#form_profile_name').val(); + console.log('Trying to save profile: ' + name); + var rawdata = graph.series[0].data; + var data = []; + + for(var i=0; i + + @@ -105,95 +107,6 @@