Very clever! 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.
That's a great idea, did you do it for Chrome? Seems like with Chrome it's non-trivial to set the page for new tabs...
Turn your browser into a notepad with one line
71–80 of 186 posts
Re: Turn your browser into a notepad with one line
#72I'm actually surprised this link got this much traction, I actually thought this was a thing that most developers were aware of. Shows you that you ought to reconsider when disseminating information that you as a learned developer think is "too basic" to bother writing about.
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.
Re: Turn your browser into a notepad with one line
#73For even more fun, turn your notepad into an interactive JavaScript environment: data:text/html, 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'; } }
Re: Turn your browser into a notepad with one line
#74Re: Turn your browser into a notepad with one line
#75Very clever! 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.
That's a great idea, did you do it for Chrome? Seems like with Chrome it's non-trivial to set the page for new tabs...
In FF, you can do it with about:config
Just set "browser.newtab.url" to the page mentioned in the original link.
Re: Turn your browser into a notepad with one line
#76Forgive me for the shameless plug...but thought this might be useful for other HNers and related to OP. 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
FYI local storage is not reliable, so you may want to think about a fallback, or at least putting a disclaimer explaining that what you write will probably but nitndefinitely still be there when you come back.
Re: Turn your browser into a notepad with one line
#77I think the best part is how short and elegant it is. 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): http://mrcoles.com/one-line-browser-notepad-bookmark/
This one works (# is breaking it really):
data:text/html, html,body{background:%23111;color:%23fff;font: normal 16px/24px "Helvetica Neue",helvetica,arial;}body{padding:24px 48px}document.body.focus();Re: Turn your browser into a notepad with one line
#78piratepad.net/[gibberishstring]
It's totally public though and there is no way to delete pads, so use with caution.
Re: Turn your browser into a notepad with one line
#79After some mix-and-matching of the awesome code snippets posted in the comments, I came up with something easy on the eyes (with a nice little color transition (for webkit-enabled browsers): data:text/html, http://fonts.googleapis.com/css?family=Lato:100,200,300,400,... rel='stylesheet' type='text/css'> html { font-family: "Lato"; color:#e9e9e9; background-color:#222; } * { -webkit-transition: all linear 1s; }
data:text/html, 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;}Poop.