summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules <jules@asdf.us>2015-04-20 00:42:17 -0400
committerJules <jules@asdf.us>2015-04-20 00:42:17 -0400
commit3c3be38fb6b85016e3e9aed973955688835a26dd (patch)
treee3de2bf10dc0d3c480285db6330775b1cca66e0d
parentaede4580450a2d8c37825d22871fa90cc15c1528 (diff)
timer button
-rw-r--r--js/matrix.js6
-rw-r--r--webcam.html20
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; }
<br>
<input type="text" id="text_style">
<button id="save_el">SAVE</button>
+ <button id="timer_el">TIMER</button>
</body>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
@@ -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()
+ }
+ })()
+})
</script>