summaryrefslogtreecommitdiff
path: root/js/record.js
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-01-01 14:29:19 -0500
committerJulie Lala <jules@okfoc.us>2014-01-01 14:29:19 -0500
commit10e4555669b554c74db9fc84e19aad4fe0caec24 (patch)
treea2482d6abf84f3350cfc72372902fbbef4b780c7 /js/record.js
parent9f8bb35589ab934409da4880312e916e71a97b96 (diff)
show/hide with esc
Diffstat (limited to 'js/record.js')
-rw-r--r--js/record.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/js/record.js b/js/record.js
index 06c8ba9..fab2669 100644
--- a/js/record.js
+++ b/js/record.js
@@ -36,6 +36,7 @@
el.innerHTML = UI_TEMPLATE
document.body.appendChild(el)
bind()
+ activate()
}
function bind(){
curtain = $("curtain")
@@ -54,8 +55,25 @@
h_el.addEventListener("change", box_position, false)
x_el.addEventListener("change", box_position, false)
y_el.addEventListener("change", box_position, false)
+ window.addEventListener("keydown", keydown, false)
+ }
+ var listening = false
+ function activate(){
+ listening = true
outline.style.display = "none"
controls.style.display = "block"
+ curtain.style.display = "block"
+ }
+ function deactivate(){
+ listening = false
+ outline.style.display = "none"
+ controls.style.display = "none"
+ curtain.style.display = "none"
+ }
+ function keydown(e){
+ if (e.keyCode == 27) { // esc
+ ! activated ? activate : deactivate
+ }
}
function defer(callback){
var timeout = null
@@ -65,6 +83,7 @@
}
}
function box_start(e){
+ if (! listening) return
e.stopPropagation()
x = e.pageX
y = e.pageY
@@ -116,6 +135,7 @@
function unclickable(id){ $(id).style.pointerEvents = "none" }
function px(n){ return (~~n) + "px" }
function record(e){
+ if (! listening) return
e.stopPropagation()
count = _int("framecount")
delay = _float("framedelay") * 1000