Created on February 04, 2016 21:01 | Updated about 5 years ago
Link: https://github.com/alvaro283/iieproyect
test
setup: function() { // code to run on startup $W.timer = {} $W.timer.title = prompt('Please provide a title for the spectra you will be capturing. They will also be numbered sequentially.') $W.timer.number = 0 $W.timer.countdown = 60*60 // seconds until next capture // run this every second: setInterval(function() { $W.timer.countdown -= 1 $('#readout').html($W.timer.countdown+" seconds until autocapture") },1000) // run this every hour: $W.timer.capture = function() { $W.timer.number += 1 if ($W.calibration_id) { // submit the data: $.ajax({ url: "/spectrums", type: "POST", data: { spectrum: { title: $W.timer.title+" #"+$W.timer.number, notes: "Part of a series of hourly spectrum captures using the API.", calibration_id: $W.calibration_id }, dataurl: $W.excerptCanvas(0,0,$W.width,1,$W.ctx).canvas.toDataURL(), tags: "periodic,macro", } }) } } $W.timer.capture() setInterval($W.timer.capture,1000*60*60) $.mobile.changePage("#capture","slide") }, draw: function() { }