News for hackers. Stuff that matters.
Re:Turn your browser into a notepad with one line by simonsarris on Tuesday January 29, 2013 @02:39PM (#5135788)
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/)

Re:Turn your browser into a notepad with one line by jfaucett on Tuesday January 29, 2013 @03:59PM (#5136220)
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
Re:Turn your browser into a notepad with one line by zchr on Tuesday January 29, 2013 @09:41PM (#5137741)
Made it a chrome extension for an easier install.

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

Re:Turn your browser into a notepad with one line by cfontes on Wednesday January 30, 2013 @06:16AM (#5138986)
Thanks, works like a charm.
Re:Turn your browser into a notepad with one line by aeon10 on Wednesday January 30, 2013 @10:09AM (#5139775)
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

Re:Turn your browser into a notepad with one line by jfaucett on Wednesday January 30, 2013 @04:11PM (#5141781)
nice :) I just merged your modifications.
Re:Turn your browser into a notepad with one line by dirkk0 on Tuesday January 29, 2013 @05:31PM (#5136810)
ok - and how do I retrieve the saved contents?
Re:Turn your browser into a notepad with one line by brunolazzaro on Tuesday January 29, 2013 @05:47PM (#5136885)
They are loaded when you re-open the extension by the looks of it.
Re:Turn your browser into a notepad with one line by dirkk0 on Wednesday January 30, 2013 @02:22AM (#5138513)
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.
Re:Turn your browser into a notepad with one line by reidrac on Wednesday January 30, 2013 @04:01AM (#5138689)
Did you save it? (CTRL+S)
Re:Turn your browser into a notepad with one line by dirkk0 on Wednesday January 30, 2013 @04:47AM (#5138765)
No, I didn't. Now it works, thanks!
Re:Turn your browser into a notepad with one line by maskedinvader on Tuesday January 29, 2013 @09:14PM (#5137678)
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.
Re:Turn your browser into a notepad with one line by wilfra on Tuesday January 29, 2013 @06:58PM (#5137222)
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.
Re:Turn your browser into a notepad with one line by justjohn on Tuesday January 29, 2013 @08:21PM (#5137532)
In Chrome: 1. Tools -> Extensions 2. Enable "Developer Mode" 3. "Load Unpacked Extension" and select the directory you cloned into.
Re:Turn your browser into a notepad with one line by wilfra on Tuesday January 29, 2013 @10:11PM (#5137835)
Thanks!
Re:Turn your browser into a notepad with one line by mikegirouard on Tuesday January 29, 2013 @03:01PM (#5135904)
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.

Re:Turn your browser into a notepad with one line by mmahemoff on Tuesday January 29, 2013 @06:33PM (#5137128)
A pity Chrome basically gave up on file:///. A lot of cool things worked better with it (like TiddlyWiki).
Re:Turn your browser into a notepad with one line by minikomi on Wednesday January 30, 2013 @05:12AM (#5138813)
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

Re:Turn your browser into a notepad with one line by Davertron on Wednesday January 30, 2013 @08:20AM (#5139309)
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

Re:Turn your browser into a notepad with one line by jancborchardt on Wednesday January 30, 2013 @03:00AM (#5138582)
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

Re:Turn your browser into a notepad with one line by nitrogen on Tuesday January 29, 2013 @03:06PM (#5135935)
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.
Re:Turn your browser into a notepad with one line by Flenser on Wednesday January 30, 2013 @04:48AM (#5138766)
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.
Re:Turn your browser into a notepad with one line by csel on Tuesday January 29, 2013 @03:02PM (#5135912)
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.
Re:Turn your browser into a notepad with one line by jQueryIsAwesome on Wednesday January 30, 2013 @01:17PM (#5140859)

    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