From 3c3be38fb6b85016e3e9aed973955688835a26dd Mon Sep 17 00:00:00 2001 From: Jules Date: Mon, 20 Apr 2015 00:42:17 -0400 Subject: timer button --- js/matrix.js | 6 +++--- webcam.html | 20 +++++++++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/js/matrix.js b/js/matrix.js index 95314b6..d0c6301 100644 --- a/js/matrix.js +++ b/js/matrix.js @@ -170,13 +170,13 @@ Matrix.prototype.mirc = function () { line += lex.sanitize() } else { - if (x > 0 && last) line += "\x03" + // if (x > 0 && last) line += "\x03" line += lex.mirc() last = lex } }) - if (last && ! last.isClear()) { line += "\x03" } - return line + // if (last && ! last.isClear()) { line += "\x03" } + return line.substr(0,400) }).filter(function(line){ return line.length > 0 }) return lines.join("\n") } diff --git a/webcam.html b/webcam.html index 4d352d8..bf528d2 100644 --- a/webcam.html +++ b/webcam.html @@ -33,6 +33,7 @@ label { min-width: 70px; display: inline-block; }
+ @@ -100,12 +101,13 @@ listen(sat_el, window, "sat") listen(lum_el, window, "lum") listen(quant_el, window, "quant") -save_el.addEventListener('click', function(){ +save_el.addEventListener('click', save) +function save (){ MircColor.fromCanvas(camera, saveText, { width: width, ratio: ratio, neighbor: nn }) function saveText(rows) { text_style.value = MircColor.ascii(rows) } -}) +} nn_el.addEventListener('change', function(){ nn = $(nn_el).prop('checked') }) @@ -148,6 +150,18 @@ function toCanvas(rows){ image_style.innerHTML = "" image_style.appendChild(canvas) } - +timer_el.addEventListener("click", function(){ + var secs = 5; + (function step (){ + if (secs > 0) { + timer_el.innerHTML = secs-- + setTimeout(step, 1000) + } + else { + timer_el.innerHTML = "TIMER" + save() + } + })() +}) -- cgit v1.2.3-70-g09d2