Turn your browser into a notepad with one line
coderwall.com
coderwall.com
If you want more than one scratch buffer--which happens to me once in a while--you can just create a new buffer with any name, and it will also do. New buffers are in a different mode by default, but you can set it up to work exactly the same way as scratch if you want.
As another commenter pointed out, you can use the browser to evaluate JavaScript. Emacs lets you do the same thing with elisp in the scratch buffer by default: try entering in an elisp expression and pressing C-j.
Just a fun alternative to this trick for the Emacs users around here :).
edit: misread your comment, thought you were comparing :new and :Scratch (linked above), not emacs' scratch. Not sure about that one, but again, the 'reopen scratch -> find leftover contents' functionality is a neat thing.
I keep it in textmate, been thinking about moving it to vim but I quite like having it in its own space.
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/)
What's particularly nice about this is that when re-opened, they are still editable.
https://chrome.google.com/webstore/detail/textpad/edopaieiod...
Source is open at http://github.com/litewrite/litewrite
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
data:text/html, <html contenteditable onkeyup="eval(this.innerText)">
Then you can upgrade it by pasting in something like this: this.onkeyup = function () {
this.style.backgroundColor = 'white';
try {
eval(this.innerText);
} catch (e) {
this.style.backgroundColor = '#FFAAAA';
}
}Keyup is used here rather than keypress (which fires only once for each down-up event) since backspace won't fire keypress events, which is a nice thing to have in a live environment. But I can't think of any environment which would implement keypress and not keyup, or how one might work around not having key events at all.
I did, however, discover that if you alert in mobile Safari (in simulation and on my iPhone) on a backspace keydown, the keyup never gets through and it will happily erase everything before the cursor.
A list of TouchEvent types is here: http://www.w3.org/TR/touch-events/#list-of-touchevent-types
Here is a document from Apple about touch events:
http://developer.apple.com/library/safari/#documentation/app...
And a list of events supported by the Safari browser: http://developer.apple.com/library/safari/#documentation/app...
I don't have an iPad, but I would love to know, if you could successfully use one of these events in this context.
Edit: For example, orientationchange looks promising. Type something, then change orientation.
window.setInterval(function(){eval(this.innerText)},1000); data:text/html, <html><style> body { font-family: sans-serif }</style><body contenteditable>data:text/html, <html><head><link href='http://fonts.googleapis.com/css?family=Lato:100,200,300,400,... rel='stylesheet' type='text/css'><style type="text/css"> html { font-family: "Lato"; color:#e9e9e9; background-color:#222; } * { -webkit-transition: all linear 1s; }</style></head><body contenteditable style="font-size:2.2em;line-height:1.4;max-width:60rem;margin:0 auto;padding:4rem;">
data:text/html, <html><head><style type="text/css"> html{background-color:#CCCCCC;font-family: Monaco, Consolas, "Lucida Console", monospace;font-size:14px;color:#424242;line-height:1.4;max-width:60rem;margin:0 auto;}body{background-color:#F0F1F1;padding:100px;}</style></head><body contenteditable>Poop.</body></html>
data:text/html, <html><head><link href='http://fonts.googleapis.com/css?family=Lato:100,200,300,400,700,400italic,700italic rel='stylesheet' type='text/css'><style type="text/css"> html { font-family: "Lato"; color:#e9e9e9; background-color:#222; } * { -webkit-transition: all linear 1s; }</style></head><body contenteditable style="font-size:2.2em;line-height:1.4;max-width:60rem;margin:0 auto;padding:4rem;"> data:text/html, <html><head><link href='http://fonts.googleapis.com/css?family=Lato:100,200,300,400,700,400italic,700italic rel='stylesheet' type='text/css'><style type="text/css"> html { font-family: "Lato"; color:#e9e9e9; background-color:#222; } * { -webkit-transition: all linear 1s; }</style></head><body style="font-size:2.2em;line-height:1.4;max-width:60rem;margin:0 auto;padding:4rem;"><div style="border-bottom: 2px white solid"><center><h3 contenteditable>Notes</center></h3></div><br /><br /><div style="height:600px; border: 2px white solid" contenteditable></div>[1] https://chrome.google.com/webstore/detail/web-shortcuts/ipno... [2] http://todotab.github.com/ Pull requests welcome :)
I put together a little project that uses the browsers localstorage so you can jot notes down and come back to them, I find it useful as I'm always in the browser, hope you do too: http://a5.gg
What's really amazing is when seemingly unrelated stressful moments in your life are revealed to be from the same source.
Of course, this is probably a reason to do it.
Doing:
stuff I'm working on right now
ToDo:
Stuff that I know needs to get done
Done:
Stuff that is now done.
Start by dumping everything I'm thinking of in 'Todo' and pick one and put it in Doing and while I'm in the middle of doing it when I think thoughts like "oh and this should really do x" I add that to the Todo pile and go back to doing. Each time I finish of the 'Doing' task I scan the todo list, move anything I need to into Done and pull one up for the Doing pane.By externalizing the bookkeeping of all the things I'm trying to keep straight in my head I free up cycles to actually work on something.
As a result, I've started saving things less and less. However it's still useful to initially type them out. Helps me plan and form my thoughts and ideas. Currently this usually involves opening Textmate or Tumblr (and saving drafts) or email.
Hopefully this will be a solid replacement for all of the above. If I end up typing something I do want to use, then I'll copy and paste it elsewhere. The majority of the time I'll simply close the browser and not save it.
I set this as the default URL for new tabs.. Now, everytime I open a new tab, I have a quick scratchpad for pasting/testing/etc.
In FF, you can do it with about:config
Just set "browser.newtab.url" to the page mentioned in the original link.
Name: note
Keyword: note
URL: data:text/html, <textarea style="font-size: 1em; width: 100%; height: 100%; border: none; outline: none" autofocus /> %s
Of course, you could change the style of the URL. That's just what I defaulted to.
name: note
keyword: n
URL: data:text/html, <html><head><script>function placeCaretAtEnd(el) { el.focus(); if (typeof window.getSelection != "undefined" && typeof document.createRange != "undefined") { var range = document.createRange(); range.selectNodeContents(el); range.collapse(false); var sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(range); } else if (typeof document.body.createTextRange != "undefined") { var textRange = document.body.createTextRange(); textRange.moveToElementText(el); textRange.collapse(false); textRange.select(); } }</script><style> html{background-color:#CCCCCC;font-family: Monaco, Consolas, "Lucida Console", monospace;font-size:14px;color:#424242;line-height:1.4;max-width:60rem;margin:0 auto;}body{background-color:#F0F1F1;padding:100px;}</style></head><body contenteditable autofocus onload="placeCaretAtEnd(window.document.body);">we%20did%20this </body></html>
it uses the "paper" look and feed and sets the focus to the end of the document so that you can just continue writing data:text/html, <html contenteditable>%s
This way, you can enter: note [tab] "foo bar baz" [enter]
And whatever you enter as the search query ends up in the note to start with.Edit: Just saw the other response to this comment saying basically the same thing. Nevermind.
More like it.
This is a hack and a workaround. The bug is clearly using an editor restricted to editting files in a "Project Workspace". Yikes.
Everyone has their own workflow, and they're all insane (for myself, I have an emacsclient wrapper that when called without a file will create a unique name under ~/.emacsclient-scratch and edit that -- so I never lose anything I know I was typing at one point). Still... this just seems like a really bad solution. You get an "editor everywhere" but it's the default editor in your browser. Ick. It's cute though.
I've googled around about this a couple times and not found anything good, so if anyone can point to some clear documentation I'd appreciate it.
Just pin notepad/your favorite editor to the taskbar(win7+) and open it with win+shift+[whatever number that corresponds to the position you placed notepad on the taskbar].
Much faster and much more powerful.
You should still be able to navigate to that alternate app readily.
I find it easier to navigate to a clearly identifiable text editor session (Linux) than try to track to a specific tab somewhere within my multiple browser windows (on multiple workspaces ...).
I like this guys implementation too. https://gist.github.com/4666256
Perhaps an implementation with vim bindings support? :D
I'd rather install this thing on my private webserver.
It doesn't have to be him who is the weakest link in that security chain.
What I don't get from your posting is the second part. Personal computers aren't prone to failure at all. I never had a single HDD crash. I backup my data on a second HDD just in case. It's incredibly unlikely that my data is going to be lost and that the cloud is the only solution for that.
So, there's clearly no compromise for me. Rule is: No cloud, no internet service for private data. And heck, I don't even use any analytics software or other software on my company website that I cannot self-host.
So discovering that 'by accident' web browsers can act as a simple (but huge, bloated and feature-starved) text editor seems like a big deal.
Personally I keep a simple, tiny, old freeware editor called Editpad 3.4, on every PC I use, accessed via desktop shortcut and 'right-click send-to'.
I assume a lot of people won’t realize you can bookmark that URL since it looks so weird. Also, once you’re bookmarking, you can cheat and put more logic into the page. I made a slightly improved one with a dark background and larger font (hard to post the link on HN, so on a separate page):
This one works (# is breaking it really):
data:text/html, <html><head><style>html,body{background:%23111;color:%23fff;font: normal 16px/24px "Helvetica Neue",helvetica,arial;}body{padding:24px 48px}</style></head><body contenteditable><script>document.body.focus();</script></body></html>I dunno, just something I noticed which I think is completely awesome and indicative of the benefits of open-source and open-knowledge.
* Dark background * Tabs work as they suppose to!
<pre> data:text/html, <style>*{padding:0; margin:0}</style><textarea style="font-size: 1.5em; width: 100%; height: 100%; border: none; outline: none; background: #111; color: #eee; padding: 10px;" autofocus onkeydown="if(event.which==9){ this.value += ' '; return false;}" /> </pre>
Possible to add a button that brings up the save dialog in a particular directory (as opposed to cmd-s and choose directory?) Or just the button (just happen to prefer to cmd key myself)?
data:text/html, <html contenteditable style='font-family: monospace'>
1) I have a constant editor opened with a Notes.txt file, so I can save it.
2) I use Sublime Text 2 which maintains the state regardless of whether I've saved the file or not, and is extremely cross platform.
Minimal and disposable browser notepad with friendly URLs being used to save/password protect files.
Also, HOW to open an existing file while retaining 'contenteditable' mode? Everything I try alters the URL field, so returning the browser to standard display-only mode.
Anyway...
So far I don't see one crucial feature: the ability to load an existing file, and edit it. Am I stupidly missing something 'obvious'?
Being able to edit text and save, but not load existing documents and edit them makes this a useless novelty.
I did notice one suggestion to load a doc then use a short js command to switch to contenteditable. But that's not quite there.
Ideally, a browser could be made to work like this:
* Multiple ways to get it started: bookmark, desktop shortcut icon, url to public or private html page containing the config script. Once working like an editor it should stay that way, for multiple file load/saves and multiple tabs open.
* An 'open file' for any existing plaintext or html file, loaded from local filesystem (via file selector popup or bookmark) or the web (type known url or use bookmark).
* Ability to switch back and forth between three modes on the same document: raw plain ascii (no formatting), minimal formatting (B, I, U, bullets), and full html formated display.
* A document 'save as' as plain text (formatting stripped) or html, to the local filesystem, OR (best feature yet) anywhere with write enabled on a public or private web server.
* Nice if also handles encrypted load/save, so the doc is never in plaintext except on the local machine.
With that, the big name 'cloud' services can go take a leap. I could use my own server(s), or ones I happened to trust. There is flatly no way I would ever trust large enterprise cloud services.
Also, a tool like that which would allow editing on ANY machine with web access and local file r/w enabled for the browser, would be very useful for... things.
It always astonished me that browsers did not provide the capability to natively edit the html they displayed. Such an obvious need, and you'd think so simple to implement, that I'd concluded the absence of this ability had to be a deliberate industry-wide agreed policy of capability avoidance. Which means, for political reasons.
As for live-editing HTML, that's usually been considered out of scope for a web browser, and been pushed to authoring or debugging programs. Chrome ships with their developer console integrated, but IIRC Firefox still relies on extensions.
piratepad.net/[gibberishstring]
It's totally public though and there is no way to delete pads, so use with caution.
"javascript: and data: URIs typed or pasted in the address bar are disabled to prevent social engineering attacks. Developers can enable them for testing purposes by toggling the "noscript.allowURLBarJS" preference."
w <enter>
Or, if you're a a super-organized shortcut-type, w <enter> <esc> "@misc"
Bonus points -- combine with ctrl+T and ctrl+W for command-line-fu-like syntax on whichever page you're currently browsing!The `<esc> @misc` part also doesn't make sense. That just does a search for tags, it doesn't put you in a mode to just write, which is what the OP's solution does.
Last but not least, a little pro-tip for ya, since you like the command line (or keyboard shortcuts as they are also called:) : Command-L puts the cursor in the location bar. So you can do <cmd>+L w <enter>. Also, shift back to a previous tab with cmd+shift+[ and +].
Same goes for "@misc". When I want to brain-dump some gibberish, as in the OP's use case, the @misc tag contains a big dump of stuff that I generally refine or delete later.
I don't know why I don't use ctrl+l -- i usually use ctrl+e or ctrl+k and then backspace (why do these do the same thing in chrome?). But yeah, thanks for the advice.
with support for Firefox 18 as well, and It comes with many languages and themes.
As an aside, it's really interesting to look at the source for Ace[1]. It doesn't use contentEditable, but certainly represents the sort of complexity we'd need without contentEditable available.
cat > /dev/null
Type whatever you want, then control-D to end. > /dev/null
...does the same thing.The browser is the new OS!
data:text/html,<textarea style="height:99%;width:100%;" autofocus onfocus="this.value=localStorage['txt']" onchange="localStorage['txt']=this.value;">Actually, hotkey bindings: vim, terminal, root terminal, mail, web, and bc.
Coming soon, find out what happens when you 20 GOTO 10!!!
javascript:document.body.contentEditable='true';document.designMode='on';void 0
(lets you edit currently loaded page.)
1]https://chrome.google.com/webstore/detail/chrome-notepad/ffb...
:D
^ you can now hit ctrl+s to save the file with a real name
Ah, much better.
I have added some color:
data:text/html, <html contenteditable><body style='background-color:rgb(0,81,129); color:rgb(93,180,227);font-family:monospace;font-weight:bold'>ATARI COMPUTER - MEMO PAD</body></html>