summaryrefslogtreecommitdiff
path: root/js/record.concat.js
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2013-12-19 10:16:20 -0500
committerJulie Lala <jules@okfoc.us>2013-12-19 10:16:20 -0500
commit251a6352ff02299b917e5e119ae12391375a592e (patch)
tree75cee4085f5732e0c4fa69d6ccb0c30ac894c924 /js/record.concat.js
parent8ba7f3baf74a407a7c0005ab2aa1ecb5e36ef60f (diff)
_int/_float type indifference
Diffstat (limited to 'js/record.concat.js')
-rw-r--r--js/record.concat.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/js/record.concat.js b/js/record.concat.js
index b4715ac..6cf6dba 100644
--- a/js/record.concat.js
+++ b/js/record.concat.js
@@ -907,6 +907,8 @@ function GifEncoder(){
].join("")
;(function(){
+ if (document.getElementById("gif-recorder")) return;
+
var canvases = document.getElementsByTagName("canvas")
if (canvases.length == 0) { alert("no canvas found"); return; }
@@ -933,6 +935,7 @@ function GifEncoder(){
document.body.parentNode.style.height = "100%"
// var template = document.getElementById("template").innerHTML
var el = document.createElement("div")
+ el.id = "gif-recorder"
// el.innerHTML = template
el.innerHTML = UI_TEMPLATE
document.body.appendChild(el)
@@ -1007,16 +1010,18 @@ function GifEncoder(){
controls.style.display = "block"
document.getElementById("record").focus()
}
- function _int(el){ return parseInt(el.value) }
- function _float(el){ return parseFloat(el.value) }
+ function _int(el){ return parseInt(typeof el == "string" ? document.getElementById(el).value : el.value) }
+ function _float(el){ return parseFloat(typeof el == "string" ? document.getElementById(el).value : el.value) }
function show(id){ document.getElementById(id).style.display="block" }
function hide(id){ document.getElementById(id).style.display="none" }
function enable(id){ document.getElementById(id).removeAttribute("disabled") }
function disable(id){ document.getElementById(id).setAttribute("disabled","disabled") }
function px(n){ return (~~n) + "px" }
- function record(){
+ function record(e){
+ e.stopPropagation()
count = _int("framecount")
delay = _float("framedelay") * 1000
+ console.log(count, delay)
if (isNaN(count) || isNaN(delay)) return
done = 0
frame_t = 0
@@ -1089,7 +1094,8 @@ function GifEncoder(){
enable("record")
enable("save")
}
- function save (){
+ function save (e){
+ e.stopPropagation()
if (! lastGif) return;
var filename = (window.location.host + window.location.pathname).replace(/[^a-zA-Z0-9]/g,"-").replace(/-+/,"-")
var blob = dataUriToBlob(lastGif)