diff options
author | Christian Cleberg <hello@cleberg.net> | 2023-05-22 15:34:10 -0500 |
---|---|---|
committer | Christian Cleberg <hello@cleberg.net> | 2023-05-22 15:34:10 -0500 |
commit | 601c0ae6a27a226a97e43920b85255bcce4cbac4 (patch) | |
tree | 45b99f5784111de2ecbc8ef8a3780040846d4a09 | |
download | office-601c0ae6a27a226a97e43920b85255bcce4cbac4.tar.gz office-601c0ae6a27a226a97e43920b85255bcce4cbac4.tar.bz2 office-601c0ae6a27a226a97e43920b85255bcce4cbac4.zip |
initial commit
-rw-r--r-- | LICENSE | 19 | ||||
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | calculator/index.html | 1 | ||||
-rw-r--r-- | code/index.html | 1 | ||||
-rw-r--r-- | drawing/index.html | 1 | ||||
-rw-r--r-- | index.html | 37 | ||||
-rw-r--r-- | slides/index.html | 1 | ||||
-rw-r--r-- | spreadsheet/index.html | 1 | ||||
-rw-r--r-- | text/index.html | 1 |
9 files changed, 65 insertions, 0 deletions
@@ -0,0 +1,19 @@ +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f854bee --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Office + +A fork of [awfice](https://github.com/zserge/awfice). 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> diff --git a/code/index.html b/code/index.html new file mode 100644 index 0000000..e0c7556 --- /dev/null +++ b/code/index.html @@ -0,0 +1 @@ +<body oninput="i.srcdoc=h.value+'<style>'+c.value+'</style><script>'+j.value+'</script>'"><style>textarea,iframe{width:100%;height:50%;}body{margin:0;}textarea{width: 33.33%;font-size:18px;padding:0.5em}</style><textarea placeholder="HTML" id="h"></textarea><textarea placeholder="CSS" id="c"></textarea><textarea placeholder="JS" id="j"></textarea><iframe id="i"></iframe><script>document.querySelectorAll("textarea").forEach((t)=>t.addEventListener("keydown",function(t){var e,s;"Tab"==t.key&&(t.preventDefault(),e=this.selectionStart,s=this.selectionEnd,this.value=this.value.substring(0,e)+" "+this.value.substring(s),this.selectionStart=this.selectionEnd=e+1)}))</script></body> diff --git a/drawing/index.html b/drawing/index.html new file mode 100644 index 0000000..2340823 --- /dev/null +++ b/drawing/index.html @@ -0,0 +1 @@ +<canvas id=v><script>d=document,d.body.style.margin=0,P="onpointer",c=v.getContext`2d`,v.width=innerWidth,v.height=innerHeight,c.lineWidth=2,f=0,d[P+"down"]=e=>{f=e.pointerId+1;e.preventDefault();c.beginPath();c.moveTo(e.x,e.y)};d[P+"move"]=e=>{f==e.pointerId+1&&c.lineTo(e.x,e.y);c.stroke()},d[P+"up"]=_=>f=0</script></canvas> diff --git a/index.html b/index.html new file mode 100644 index 0000000..107fe83 --- /dev/null +++ b/index.html @@ -0,0 +1,37 @@ +<!doctype html> +<html lang="en"> +<head> + <title>Office</title> +</head> +<body> + <h1>Office</h1> + <p>This website hosts <a href="https://git.sr.ht/~cmc/office" + rel="noreferrer,noopener" target="_blank">Office</a>, my fork of <a + href="https://github.com/zserge/awfice" + rel="noreferrer,noopener" target="_blank">Awfice</a>.</p> + <p>Office is a collection of tiny office suite apps:</p> + <ul> + <li>a word processor, a spreadsheet, a drawing app and a presentation + maker</li> + <li>each less than 1KB of plain JavaScript</li> + <li>each is literally just one line of code</li> + <li>packaged as data URLs, so you can use them right away, without + downloading or installing</li> + <li>you can also use them offline</li> + <li>but they can't store their state, so whatever you type there would be + lost on page refresh</li> + <li>the only way to save your job is to save a HTML or send it to the + printer/print to PDF.</li> + </ul> + + <h2>Office Suite Apps:</h2> + <ul> + <li><a href="/text/">Text Editor</a></li> + <li><a href="/code/">Code Editor</a></li> + <li><a href="/spreadsheet/">Spreadsheet</a></li> + <li><a href="/calculator/">Calculator</a></li> + <li><a href="/slides/">Slide Deck</a></li> + <li><a href="/drawing/">Drawing</a></li> + </ul> +</body> +</html> diff --git a/slides/index.html b/slides/index.html new file mode 100644 index 0000000..6c68a6a --- /dev/null +++ b/slides/index.html @@ -0,0 +1 @@ +<body><script>d=document;for(i=0;i<50;i++)d.body.innerHTML+='<div style="position:relative;width:90%;padding-top:60%;margin:5%;border:1px solid silver;page-break-after:always"><div contenteditable style=outline:none;position:absolute;right:10%;bottom:10%;left:10%;top:10%;font-size:5vmin>';d.querySelectorAll("div>div").forEach(e=>e.onkeydown=e=>{n=e.ctrlKey&&e.altKey&&e.keyCode-49,f="formatBlock",j="justify",x=[f,f,j+"Left",j+"Center",j+"Right","outdent","indent","insertUnorderedList"][n],y=["<h1>","<div>"][n],x&&d.execCommand(x,!1,y)})</script><style>@page{size:6in 8in landscape}@media print{*{border:0 !important}} diff --git a/spreadsheet/index.html b/spreadsheet/index.html new file mode 100644 index 0000000..cbcf724 --- /dev/null +++ b/spreadsheet/index.html @@ -0,0 +1 @@ +<table id=t><script>z=Object.defineProperty,p=parseFloat;for(I=[],D={},C={},q=_=>I.forEach(e=>{try{e.value=D[e.id]}catch(e){}}),i=0;i<101;i++)for(r=t.insertRow(-1),j=0;j<27;j++)c=String.fromCharCode(65+j-1),d=r.insertCell(-1),d.innerHTML=i?j?"":i:c,i*j&&I.push(d.appendChild((f=>(f.id=c+i,f.onfocus=e=>f.value=C[f.id]||"",f.onblur=e=>{C[f.id]=f.value,q()},get=_=>{v=C[f.id]||"";if("="!=v.charAt(0))return isNaN(p(v))?v:p(v);with(D)return eval(v.slice(1))},a={get},z(D,f.id,a),z(D,f.id.toLowerCase(),a),f))(document.createElement`input`)))</script><style>#t{border-collapse:collapse}td{border:1px solid gray;text-align:right}input{border:none;width:4rem;text-align:center}</style> diff --git a/text/index.html b/text/index.html new file mode 100644 index 0000000..2d5ad8d --- /dev/null +++ b/text/index.html @@ -0,0 +1 @@ +<body contenteditable style=line-height:1.5;font-size:20px onload=document.body.focus()> |