From 2dd9c7ec9926a715b741a273bc1bc825ed2a0e60 Mon Sep 17 00:00:00 2001 From: SheetJS Date: Fri, 25 Apr 2014 11:22:36 -0700 Subject: [PATCH] version bump 0.6.5: eliminating bad idioms - cleaned up implicit boolean to number conversions - web demo improved (h/t /u/SpsD3GoiFSmXBAl on reddit) --- index.html | 18 ++++++++++++----- package.json | 2 +- ssf.js | 46 +++++++++++++++++++++---------------------- ssf.md | 55 ++++++++++++++++++++++++++++------------------------ 4 files changed, 67 insertions(+), 54 deletions(-) diff --git a/index.html b/index.html index 9ddc304..8d90e5a 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ -SSF (Spreadsheet Format) Live Demo
+SSF (Spreadsheet Number Format) Live Demo
Github Repo
Issues? Something look weird? Click here and report an issue
@@ -20,11 +20,19 @@ var N = document.getElementById('num'); var T = document.getElementById('txt'); function update() { - try { N.innerText = SSF.format(F.value, Number(V.value)); } catch(e) { N.innerText = e; } - try { T.innerText = SSF.format(F.value, V.value); } catch(e) { T.innerText = e; } + try { N.innerHTML = SSF.format(F.value, Number(V.value)); } catch(e) { N.innerHTML = e; } + try { T.innerHTML = SSF.format(F.value, V.value); } catch(e) { T.innerHTML = e; } + } + if(F.addEventListener) { + F.addEventListener('keyup', update); + V.addEventListener('keyup', update); + } else if(F.attachEvent) { + F.attachEvent('onkeyup', update); + V.attachEvent('onkeyup', update); + } else { + F.oninput = update; + V.oninput = update; } - F.oninput = update; - V.oninput = update; update();