Commit 601c0ae6a2

601c0ae6a27a226a97e43920b85255bcce4cbac4

Unsigned

cmc <hello@cleberg.net> · 2023-05-22 20:34 UTC

initial commit

Layout: unified · split

LICENSE added +19
@@ -0,0 +1,19 @@
1MIT License
2
3Permission is hereby granted, free of charge, to any person obtaining a copy
4of this software and associated documentation files (the "Software"), to deal
5in the Software without restriction, including without limitation the rights
6to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7copies of the Software, and to permit persons to whom the Software is
8furnished to do so, subject to the following conditions:
9
10The above copyright notice and this permission notice shall be included in all
11copies or substantial portions of the Software.
12
13THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19SOFTWARE.
README.md added +3
@@ -0,0 +1,3 @@
1# Office
2
3A fork of [awfice](https://github.com/zserge/awfice).
calculator/index.html added +1
@@ -0,0 +1 @@
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>
code/index.html added +1
@@ -0,0 +1 @@
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>
drawing/index.html added +1
@@ -0,0 +1 @@
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>
index.html added +37
@@ -0,0 +1,37 @@
1<!doctype html>
2<html lang="en">
3<head>
4 <title>Office</title>
5</head>
6<body>
7 <h1>Office</h1>
8 <p>This website hosts <a href="https://git.sr.ht/~cmc/office"
9 rel="noreferrer,noopener" target="_blank">Office</a>, my fork of <a
10 href="https://github.com/zserge/awfice"
11 rel="noreferrer,noopener" target="_blank">Awfice</a>.</p>
12 <p>Office is a collection of tiny office suite apps:</p>
13 <ul>
14 <li>a word processor, a spreadsheet, a drawing app and a presentation
15 maker</li>
16 <li>each less than 1KB of plain JavaScript</li>
17 <li>each is literally just one line of code</li>
18 <li>packaged as data URLs, so you can use them right away, without
19 downloading or installing</li>
20 <li>you can also use them offline</li>
21 <li>but they can't store their state, so whatever you type there would be
22 lost on page refresh</li>
23 <li>the only way to save your job is to save a HTML or send it to the
24 printer/print to PDF.</li>
25 </ul>
26
27 <h2>Office Suite Apps:</h2>
28 <ul>
29 <li><a href="/text/">Text Editor</a></li>
30 <li><a href="/code/">Code Editor</a></li>
31 <li><a href="/spreadsheet/">Spreadsheet</a></li>
32 <li><a href="/calculator/">Calculator</a></li>
33 <li><a href="/slides/">Slide Deck</a></li>
34 <li><a href="/drawing/">Drawing</a></li>
35 </ul>
36</body>
37</html>
slides/index.html added +1
@@ -0,0 +1 @@
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}}
spreadsheet/index.html added +1
@@ -0,0 +1 @@
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>
text/index.html added +1
@@ -0,0 +1 @@
1<body contenteditable style=line-height:1.5;font-size:20px onload=document.body.focus()>