GithubHelp home page GithubHelp logo

awfice's Introduction

Awfice - the world smallest office suite

Awfice is a collection of tiny office suite apps:

  • a word processor, a spreadsheet, a drawing app and a presentation maker
  • each less than 1KB of plain JavaScript
  • each is literally just one line of code
  • packaged as data URLs, so you can use them right away, without downloading or installing
  • you can also use them offline
  • but they can't store their state, so whatever you type there would be lost on page refresh
  • which can be also sold as a "good for your privacy" feature
  • this project is only a half-joke, I actually use a few Awfice apps as quick scratchpads.
  • the only way to save your job is to save a HTML or send it to the printer/print to PDF.

Text editor - 59 bytes!

A simple rich text editor. Type whatever you want, it won't be saved anywhere, but it might be convenient for quick throwaway notes. You should be able to use Ctrl+B and Ctrl+I to mark text selection as bold or italic. Undo/redo should work as well. You can also copy/paste text and images from other sources.

Copy and add to bookmarks or open in the URL bar:

data:text/html,<body contenteditable style=line-height:1.5;font-size:20px>

Try it!

Spreadsheet - 679 bytes!

A very basic spreadsheet with math formulas. It has 100 rows and 26 columns (A..Z). If the value in the cell starts with an "=" = it is evaluated as a formula. You may refer to other cell values, i.e. "=(A10+A11)/A12". Under the hood it uses eval(), so be careful.

Copy and add to bookmarks or open in the URL bar:

data:text/html,<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>

Try it!

Drawing app - 327 bytes!

Nothing simpler than drawing on a blank canvas with mouse. Works with touch screens as well. To save your results... well, do a screenshot maybe...

Copy and add to bookmarks or open in the URL bar:

data:text/html,<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>

Try it!

Presentation maker - 622 bytes!

Just a variant of a rich text editor with some hotkeys. There are 50 blank slides for you (I hope you don't need to bore your audience with more slides). Each slide is a rich text editor, but there are some hotkeys to make styling better:

  • Ctrl+Alt+1: Header
  • Ctrl+Alt+2: Normal style
  • Ctrl+Alt+3: Align left
  • Ctrl+Alt+4: Align center
  • Ctrl+Alt+5: Align right
  • Ctrl+Alt+6: Outdent
  • Ctrl+Alt+7: Indent
  • Ctrl+Alt+8: Make a list

Copy and add to bookmarks or open in the URL bar:

data:text/html,<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}}

Try it!

Code editor - 686 bytes!

A simple code editor. You can type in HTML, CSS & Javascript.

Copy and add to bookmarks or open in the URL bar:

data:text/html,<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>

Try it!

Calculator - 657 bytes!

A simple calculator which supports the basic operational symbol to calculate.

Copy and add to bookmarks or open in the URL bar:

data:text/html,<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>

Try it!

Contributions

The code is distributed under MIT license. PRs are always welcome, especially if they fix something or make the code smaller, or add features that are valuable, but do not require a lot of code.

To modify something - edit HTML files directly. There is README.sh script that re-generates the README and embeds apps code into it.

awfice's People

Contributors

aej11a avatar brecert avatar doekman avatar imtbl avatar kdrag0n avatar lukyvj avatar sebres avatar sumitgtechpro avatar thiesjoo avatar tijsmaas avatar zhoulion avatar zserge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

awfice's Issues

Any limits or can we propose (or make PRs with) more functionality?

I'd envision this "advanced" functionality:

  • add support for pictures (arbitrary positioned incl. as background) - at least to the presenter
  • very basic interaction among the tools (e.g. find a way to put result from draw to presentation)
  • for each app add support for custom styling (maybe a separate input form for JS which could then be arbitrarily used to write styles for arbitrary elements - assuming elements, e.g. spreadsheet cells, can be easily referred to)
  • ways to save and later restore the content

Thoughts?

Single page with links to all "apps"

I think it would be nice to have a simple single page with links (icons?) opening the apps in new tabs.

This is so that one won't have to go to the repo, scroll down the readme and then click on the "Try this".

(Yes, I can make this myself, but it makes sense if this page is part of the repo, and updated as new apps are added.)

Something like how icloud.com does it:
image

[ tiny code editor ]

data:text/html,<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:18}</style><textarea placeholder=HTML id=h></textarea><textarea placeholder=CSS id=c></textarea><textarea placeholder=JS id=j></textarea><iframe id=i>

Suggestion for Spreadsheet Bookmarklet

Add functionality to jump cursor to the next row after pressing Enter. Right now, nothing happens, to go to new row, I have manually clicked in the next row and start editing.

saving drawing file

we can a button that can trigger event using html2canvas.js or take screenshot to save paint file in png or jpeg.

Future plans?

I find the idea of awfice really fun, but outside of the proposed code editor, I don't really know what else to add right now.

I've thought about an encrypted p2p messaging tool using WebRTC but it's be hard to correctly "polish" it because of code size, and to have it work without a server manual signalling would be needed (sending the descriptions back and forth manually) which is complicated, and is not exactly practical.

More features could be added to some of tools (like colors and brush size for drawing), but I don't know what the intended scope is for code other than less than keeping the size less than 1kb.

Any feedback would be appreciated.

Text editor could be way smaller

The text editor could instead use the <p> Paragraph tag and be way smaller
data:text/html,<p contenteditable>
is the smallest text editor

Mobile/Touch Support for Draw

Currently the drawing app does not support touch events. I have added touch support which increased the size from 327 to 542 bytes. Is this something desired? If so assign this issue to me and I can commit it to a new branch.

Drawing app could be shrunk

The drawing app could be shrunken from 342 Characters to 222 characters if the code was changed to this:

Data url data:text/html,<canvas id=v></canvas><script>with(v.getContext`2d`)v.onpointerdown=e=>(beginPath(),moveTo(e.x,e.y)),v.onpointermove=e=>(lineTo(e.x,e.y),stroke()),v.width=innerWidth,v.height=innerHeight,lineWidth=2</script>

Note: could be even smaller if closing script tag was removed

Un-minified versions?

Is it possible to make a folder of annotated versions of these files? Thanks either way!

PR:(Includes Security Update)New improved spreadsheets app

Hello i have added some functionality to spreadsheets app and still kept it under 1 kb(841 bytes to be exact).
Update 7:12/04/2021 Size gets smaller, leaves room for improvement
Update 6:06/03/2021 Size gets smaller, leaves room for improvement
Update 5:03/03/2021 I have redesigned the interface, it now have more modern design now, you also can use tab to jump cursor to the next row.
Update 4:03/04/2021 Discovered a bug only this version had, if there is only whitespaces on the cell it shows as 0.Fixed now.
Update 3:03/04/2021 Works on Chrome 89 perfectly, also has been tested on Firefox 78 ESR now.Also works perfectly
Update 2:03/04/2021 I have updated it.It did not only became smaller in size, also comes with very important security update.
Update:02/04/2021 I have remade it again so it is less resource intensive and smaller.

data:text/html;charset=utf-8,<table id=t><script>o=(a,b)=>b=JSON.parse(a);for(I=[],D={},C={},q=_=>I.forEach(e=>{e.innerText=D[e.id]}),i=0;i<151;i++)for(r=t.insertRow(-1),j=0;j<27;j++)c=String.fromCharCode(64+j),d=r.insertCell(-1),d.innerText=i?j?'':i:c,l=t.rows[0].cells[0],l.innerText='💾',l.onclick=e=>(k=prompt('📂',JSON.stringify(C)),k&&(C=o(k,C),q())),i*j&&I.push(d.appendChild(((x,f)=>(f.id=x,f.tabIndex=j,f.contentEditable=!0,f.onfocus=e=>f.innerText=C[x]||'',f.onblur=e=>{C[x]=f.innerText,q()},get=_=>{v=C[x];!v?.trim()?v='':v;if('='!=v[0])return isNaN(v)|v==''?v:~~v;with(D)return eval(v.toUpperCase().slice(1))},a={get},Object.defineProperty(D,x,a),f))(c+i,document.createElement`p`)))</script><style>td{box-shadow:0 0 1q}p{cursor:cell;min-width:70}tr:hover{background:beige}:is(tr,td):first-child{background:tan;text-align:center}td:hover{background:peru}

Click Here To Download The Html Version

Bug Fixes(Which original program has):

  • Newer versions of Chrome and Firefox can't load the original app properly when using data:text/html version.In this version this problem has been fixed.
  • Fixed a bug also original program has, which it doesn't show any entry starting with number(eg. "1234 avenue")
  • (Security Update)You can no longer run any (harmful or not)javascript from cells itself(eg."=alert(a1)"), but you may still use formulas normally.

Added functions:

  • Save/Load Function(Thanks @doekman for that.)
  • Resizable table areas(Both horizontal and vertical.)
  • Modern looking UI(Active cell highlighting, cursors, graphical save button etc.)
  • Press Tab or Shift+Tab to go down and up a row.
  • UTF-8 Support.

Functions are planned to be added(not implemented yet):

  • Import/Export to File

It is usable now since it can save and load files, doesn't have eval security bug and supports resizing of the tables.
Hope it will help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.