Hacker News new | comments | show | ask | jobs | submit login

Ah shoot. If Chrome allowed localStorage to be accessible from file:/// then we could add save (CTRL+S) and automatic load using this:

    data:text/html,<html><script>window.onload=function(){var a=document.body;a.innerText=localStorage.mydoc;a.addEventListener("keydown",function(b){b.ctrlKey&&83==b.which&&(localStorage.mydoc=a.innerHTML,b.preventDefault())},!1)};</script><body contenteditable></body></html>
Firefox will save it to localStorage but clear the local storage afterwards. Weird.

Oh well.

At least we can still turn our (Chrome) browsers into desktop calculators by pressing CTRL+SHIFT+J!

(If you want the un-minified version of the code I wrote: http://jsfiddle.net/d5sGq/)




That is so cool :). I just slapped together a (really) simple chrome ext for opening up a new tab in "contenteditable" mode. It saves the contents into localStorage, thats it for now :) Here it is if anyones interested https://github.com/jwaterfaucett/textpad


Made it a chrome extension for an easier install.

https://chrome.google.com/webstore/detail/textpad/edopaieiod...


Thanks, works like a charm.


I forked your code, added support so you can do (C-N) to open a new tab, click tab and start typing (the cursor will be at the end of the line), polished it up a bit (changed font to consolas, added a grey background with a tint of white text-shadow). I've sent a pull request.

https://github.com/AeonAxan/textpad


nice :) I just merged your modifications.


ok - and how do I retrieve the saved contents?


They are loaded when you re-open the extension by the looks of it.


Doesn't work for me - seems I am doing something wrong. I open a tab, write something, close the tab. I open a fresh tab - no text. I'd expect that the written text would show up.


Did you save it? (CTRL+S)


No, I didn't. Now it works, thanks!


this is cool, just wondering is there an easy way to export the text ? save as and then renaming to .txt doesnt seem to grab the text, just the html.


Can anybody please give me quick install instructions? There is no readme and I'm unfamiliar with how to add a Chrome extension based on a Github repo.


In Chrome: 1. Tools -> Extensions 2. Enable "Developer Mode" 3. "Load Unpacked Extension" and select the directory you cloned into.


Thanks!


If you can sacrifice the automatic load, simply hitting C-S will allow saving a hard file to disk.

What's particularly nice about this is that when re-opened, they are still editable.


A pity Chrome basically gave up on file:///. A lot of cool things worked better with it (like TiddlyWiki).


If you don't mind loading jquery I made a version which saves to OpenKeyVal. Just set your secret key..

https://gist.github.com/4672169


I forked yours and made it a JavaScript editor. You can use ctrl+j to execute what's in the buffer.

https://gist.github.com/4673043


There's a simple pure frontend editor web app at http://litewrite.net - since it uses AppCache and localStorage you can also use it anywhere. Even sync with remotestorage.

Source is open at http://github.com/litewrite/litewrite


Firefox has Ctrl+Shift+K for its web console. It's not as polished as Chrome's, but at least allows running JavaScript in the current page.


You could use some JavaScript to change window.location.href to a new data uri containing the content of the page that you could then bookmark. There's a limit to the length of URLs so it would be an interesting trade off of save size vs features.


Even the simple File - Save Page As and save as a txt file saves a lot of time for me. I know it adds more clutter but beats opening a new app just to type few things.


    data:text/html,<html><script>window.onload=function(){var a=document.body;a.addEventListener("keydown",    	function(b){if(b.ctrlKey&&83===b.which){document.location = 'data:text/html,' + document.childNodes[0].outerHTML;b.preventDefault();}},!1);document.title= document.body.innerText.replace(/\n[\s\S]+$/," - ")+new Date().toString();};</script><body contenteditable></body></html>
With this you can save using the URL!

Just press Ctrl+S and use the browser history to access it later! And this means it also haves a pseudo-version-control-system included! For easy access the first line in the text becomes the title.

In coderwall: https://coderwall.com/p/xh9u3w




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: