Turn your browser into a notepad with one line
81–90 of 186 posts
Re: Turn your browser into a notepad with one line
#82Ah 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, 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)}; Firefox will save it to localStorage but clear the local storage afte…
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
#83For 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'; } }
Is there an equivalent to `this.onkeyup` for touch devices that don't generate onkeyup events? Trying to make this work on an iPad, but I only have surface knowledge of JS.
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.
Re: Turn your browser into a notepad with one line
#84For 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'; } }
Is there an equivalent to `this.onkeyup` for touch devices that don't generate onkeyup events? Trying to make this work on an iPad, but I only have surface knowledge of JS.
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.
Re: Turn your browser into a notepad with one line
#85Very 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...
Re: Turn your browser into a notepad with one line
#86Personally I'm more interested in the concept of typing gibberish to clear your mind. What particular kind of gibberish? Doggerel verse? Blind keyboard mashing?
I often do an exercise that I've started referring to as a "brain dump". Sometimes when I feel overwhelmed, for whatever reason, it helps to just simply start typing. I start by just saying whatever is most present on my mind, and each new thought starts on a new line. More often than not I end up drilling down to some kind of inner conflict buried pretty deep in my mind. What's really amazing is when seemingly unrel…
Re: Turn your browser into a notepad with one line
#87Earlier quoted context omitted.
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
ok - and how do I retrieve the saved contents?
Re: Turn your browser into a notepad with one line
#88 cat > /dev/null
Type whatever you want, then control-D to end.Re: Turn your browser into a notepad with one line
#89This is what the scratch (EDIT: read scratch as * scratch * without the spaces--is there any way to escape that properly on HN?) buffer is for in Emacs, and I find it extremely useful. Also, unlike using a different tool, it allows me to use all the Emacs-specific features I usually rely on. (For example, I can easily type special characters like r₁ × r₂ ≈ r₃ using the TeX mode.) If you want more than one scratch buf…
Re: Turn your browser into a notepad with one line
#90Nifty trick. To build on this, if you use chrome, add it as a search engine with a special keyword so you can type in your URL bar something like "note + + " then you're in typing mode.
In fact, if you add the `%s` variable inside the HTML tag: data:text/html, %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.