aboutsummaryrefslogtreecommitdiff
path: root/calculator/index.html
diff options
context:
space:
mode:
authorChristian Cleberg <hello@cleberg.net>2023-05-22 15:34:10 -0500
committerChristian Cleberg <hello@cleberg.net>2023-05-22 15:34:10 -0500
commit601c0ae6a27a226a97e43920b85255bcce4cbac4 (patch)
tree45b99f5784111de2ecbc8ef8a3780040846d4a09 /calculator/index.html
downloadoffice-601c0ae6a27a226a97e43920b85255bcce4cbac4.tar.gz
office-601c0ae6a27a226a97e43920b85255bcce4cbac4.tar.bz2
office-601c0ae6a27a226a97e43920b85255bcce4cbac4.zip
initial commit
Diffstat (limited to 'calculator/index.html')
-rw-r--r--calculator/index.html1
1 files changed, 1 insertions, 0 deletions
diff --git a/calculator/index.html b/calculator/index.html
new file mode 100644
index 0000000..2860ee5
--- /dev/null
+++ b/calculator/index.html
@@ -0,0 +1 @@
+<table style="text-align: center;width:80vw;margin: 0 auto;"><tbody><tr><td colspan="4"><textarea></textarea></td></tr></tbody><script>let d=document;let tbl=d.querySelector('tbody');let z=d.querySelector('textarea');let oc=(x)=>z.value+=x;let cl=()=>z.value='';let re=()=>{try{z.value=eval(z.value);}catch(error){cl();}};[[1,2,3,'+'],[4,5,6,'-'],[7,8,9,'*'],['C',0,'=','/']].forEach((a)=>{let r=d.createElement('tr');r.style.lineHeight='64px';tbl.appendChild(r);a.forEach((b)=>{let tb=d.createElement('tb');tb.innerText=b;tb.style.padding='16px';tb.style.border='1px solid';r.appendChild(tb);tb.onclick=b==='='?re:b==='C'?cl:()=>oc(b);})})</script></table>