News for hackers. Stuff that matters.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by danso on Friday January 25, 2013 @12:47AM (#5114187)
Ok I'll be the pendant that says it...you probably can't appropriate the image of Austin Powers for your open source library. Not that Mike Myers seems the type to flip out about it, but his movie studio probably is.

Otherwise, great work...and it behaves reasonably well even on iOS

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by tripzilch on Friday January 25, 2013 @06:55AM (#5115015)
Someone had to point it out, yes. I had the same thought and it made me sad. That page is beautiful, quirky and funny, made with DIY love. It's a perfect example of the value of remix culture, adding a touch of originality (yes, originality) to brighten up an otherwise boring github page.

I believe the author picked the cross hatched texture background to match the rest, as well as the font and the muted retro green and orange-red, so it's not like it was a mere copy/paste job, either. More like (apart from the name pun) Austin Powers is just another ingredient, like the colour to paint with, the texture, the font, etc.

Further--this is a personal belief so take it cum grano salis--if one releases a blockbuster film, one of the (intended!) effects is having its iconography engrained in the public's mind and culture. Saying you cannot use imagery that has been force-fed into the public consciousness at all, is like getting hit by a fire hose and being told you're not allowed to drink or wash with the water. And I had this thought, having to fear being punished for using a certain icon to communicate your ideas, is a lot (but not exactly, I do hope you can see the similarities though) like what the Danish cartoonist had to fear when drawing Muhammed. (let me repeat: there's a lot of differences between the situations, but also an eerie similarity)

Anyway, it's a really great library, I'm looking forward to having an excuse to use it.

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by codewright on Friday January 25, 2013 @12:51AM (#5114203)
I'll be the pedant to mention that a pendant is worn around the neck.

You like this? On-demand editing services: [email protected]

Clickable: http://www.edithero.com/

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by aarondf on Friday January 25, 2013 @07:25AM (#5115090)
Good hustling! (Serious, not sarcastic.)

Your comment was funny and provided value (now I know about your service). Well played.

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by jgj on Friday January 25, 2013 @08:12AM (#5115201)
It's funny, in another thread he got voted down as close to #f6f6ef as I've ever seen and scolded to boot
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by danso on Friday January 25, 2013 @10:25AM (#5115808)
For the record, I approve and upvoted. I had half-written a comeback but decided I was not actually clever and that I deserve to be mocked. "Pendant" indeed.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by codewright on Friday January 25, 2013 @10:43AM (#5115893)
Thanks everybody! I'll do a Show HN post after we finish fiddling with some conversion tracking bits.

Getting scolded by a 3 karma account was fun :)

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by gojomo on Friday January 25, 2013 @04:28AM (#5114704)
I'd guess a non-profit project with such small, incidental, reverent-without-being-misleading image reuse can wait until they receive a souvenir cease-and-desist letter, if ever, before worrying about the rights issues.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by afandian on Friday January 25, 2013 @04:48AM (#5114753)
The same day as this article is published. http://arstechnica.com/tech-policy/2013/01/six-year-old-danc...
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by gojomo on Friday January 25, 2013 @05:13AM (#5114813)
That suit supports the idea the project can wait for communication from the rightsholder at negligible risk. (That is, there's no need for ad hoc copyright warnings from third-party non-experts.)

To wit: this is a lawsuit of choice, initiated by a plaintiff (backed by the EFF) who had material briefly taken-down by a DMCA notification. The studio didn't sue: it only sent a take-down, then was itself sued. The studio doesn't appear to be seeking damages, even though the alleged-infringing video has now been up for years (post-counter-notify, with more than 1.2 million views). The studio just wants the take-down honored and the lawsuit dismissed.

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by the1 on Friday January 25, 2013 @08:21AM (#5115230)
how do you know if that's Mike Myers in Austin Powers? It's the author in Halloween costume.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by Permit on Friday January 25, 2013 @12:34AM (#5114146)
I like this a lot. I really wish they'd add the tab functionality to Stack Overflow. I can't count the times I've tabbed out of the text box there.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by evincarofautumn on Friday January 25, 2013 @01:42AM (#5114354)
You should have the option to make backspace delete a full level of indentation, if soft tabs are on.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by jakiestfu on Friday January 25, 2013 @02:39AM (#5114469)
Yes, I will implement that tomorrow, thank you
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by MasterScrat on Friday January 25, 2013 @04:56AM (#5114766)
Keeping the indentation level on new lines would be nice too.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by jakiestfu on Friday January 25, 2013 @11:56AM (#5116372)
Indentation levels should be converting line to line, is it not for you?
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by MasterScrat on Sunday January 27, 2013 @05:44AM (#5123859)
Nope (Chrome 24.0.1312.56 on OS X 10.6.8).
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by nbashaw on Friday January 25, 2013 @12:59AM (#5114231)
This is awesome. I'm using http://ace.ajax.org/ right now in production and it's a huge heavyweight pain (but still the best thing out there). If only this had syntax highlighting i'd switch in an instant.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by chr1 on Friday January 25, 2013 @01:49AM (#5114381)
Maybe you'll like http://kueblc.github.com/LDT/examples/generic.html? but if you fix undo, add bracket matching, etc it will become huge too.

Also wanted to ask why do you think that ace is a pain? I agree that it's big, but seems to work ok?

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by TomasSedovic on Friday January 25, 2013 @06:26AM (#5114951)
Thanks so much for the LDT link, it's exactly what I was looking for (and thought impossible).

I can't speak for the GP, but my problem with ACE et al. is that they replace the textarea with their own HTML structure (e.g. a div for every line). I understand the reason why, but it means they have to reimplement all the textbox behaviour and they never get it completely right.

For example: when I double-click on a word in the textbox I'm writing this in, and then middle-click somewhere else, the word gets pasted there.

In ACE, it pastes a different text in a different location.

ACE is brilliant if you want to a full-fledged text editor. But it's an overkill if all you need is a normal textarea with some colours.

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by thewarrior on Friday January 25, 2013 @03:05AM (#5114537)
Really good work . Was reading your code to catch up on some javascript , but didn't understand what you're doing here . Surely this is a bug ?

https://github.com/jakiestfu/Behave.js/blob/master/behave.js...

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by evoxed on Friday January 25, 2013 @01:49AM (#5114379)
Hey, this looks handy! I just wrote something kinda similar as part of an ad-hoc UI layer that just had to be done in HTML/JS. At first I was horrified, but by a couple hundred lines in I realized how nice it would feel to finally tame those meager input boxes into full on forces of good. ;)
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by fidz on Friday January 25, 2013 @01:21AM (#5114298)
Just curious who is the person in the background page?
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by tantalor on Friday January 25, 2013 @01:23AM (#5114308)
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by jamiebicknell on Friday January 25, 2013 @06:19AM (#5114936)
Good work, like it a lot. I almost feel allowing tabs should be a browser based setting, I'd have it enabled, but I can imagine other people wouldn't never need to use a tab.

I built something similar for keeping indentation/bullets/lists on new lines to assist with Markdown in an ordinary textarea -> http://jamiebicknell.github.com/Markdown-Helper/

ps: long time lurker, first time poster.

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by jakiestfu on Friday January 25, 2013 @12:01PM (#5116406)
The option to disable tabs behavior is there. When to do that is up to you;]
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by valgaze on Friday January 25, 2013 @01:57AM (#5114401)
Great tool and I'm enamored with the layout- scrolling background, AP stays with you.

Not sure how to repeat it every time but weird artifact quirk if one scrolls to the bottom on iPad safari & scrolls back up: http://i.imgur.com/Hby2ZsL.jpg

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by tantalor on Friday January 25, 2013 @02:14AM (#5114430)
The layout might be familiar,

http://meyerweb.com/eric/css/edge/complexspiral/demo.html

The Internet Archive pegs that page to October 2001. That's like 4 or 5 Internets ago.

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by nbashaw on Friday January 25, 2013 @02:33AM (#5114460)
That's just background-position: fixed; The background in this page scrolls but austin powers is position: fixed; bottom: 0; left: 0;
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by WickyNilliams on Friday January 25, 2013 @11:05AM (#5116019)
Question: What does this do for accessibility if navigating with a keyboard? How would one genuinely tab out of the field?

Suggestion: Big notice somewhere saying "NO JQUERY DEPENDENCY". Things are so bad these days I assume jQuery dependency until I see something stating otherwise!

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by jakiestfu on Friday January 25, 2013 @02:42AM (#5114480)
Since posting and receiving positive feedback, I have added support for unindentation, and multi-line indent/unindent. Will see about adding more features tomorrow! Want to keep this light, it's almost there though. Next is IE support.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by Ygg2 on Saturday January 26, 2013 @08:26AM (#5120272)
Auto expanding for ', [, { (, " is great, but this should be configurable on a language basis. In other languages it's not uncommon to have things like `http://uri.com` or |Special syntax|
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by kalms on Friday January 25, 2013 @08:29AM (#5115256)
This is extremely cool. Thank you!

Sidenote: The name conflicts a bit with http://kennknowles.github.com/behave.js/ - Not sure if that matters to you.

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by bink-lynch on Friday January 25, 2013 @12:40PM (#5116611)
This is great! I removed Ace because it was too heavy for my purpose.

Indent Issue:

Type in at least 3 lines, highlight the middle lines using shift+down-arrow, tab(indent), notice the line below the highlighted lines indents too.

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by jakiestfu on Friday January 25, 2013 @04:05PM (#5117630)
I see what you're talking about. Coda and Aptana both do the same thing, and the reason is you're selecting the \n new line character when you do shit+down-arrow. Try shift + down-arrow + left-arrow
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by bink-lynch on Saturday January 26, 2013 @12:56PM (#5121066)
True; I am getting my habits from Sublime Text 2 and Eclipse. These don't indent the unhighlighted line below. Guess there are two ways to go :)
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by hilti on Friday January 25, 2013 @01:45AM (#5114364)
Great landing page. Just add syntax highlighting and it'll be perfect.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by user24 on Friday January 25, 2013 @03:20AM (#5114568)
It absolutely crashed Firefox 18.0.1 under Mac. I typed

hgjj]{return}{return}{return}{return}

and it just beachballed. I had to force quit the browser. Happened the second time I tried it too.

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by chewmieser on Friday January 25, 2013 @11:29AM (#5116186)
Chromium 24.0.1302.0 (162733) on OS X 10.8.2: Same issue as above, although I just had to close out the tab instead of forcing the browser to close.

The issue is with the ']', and ONLY after I hit the return key. The entire page becomes unresponsive afterwards.

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by jakiestfu on Friday January 25, 2013 @04:12PM (#5117659)
Fixed!
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by jakiestfu on Friday January 25, 2013 @04:00PM (#5117598)
Thank you for catching this, there are multiple instances where the same bug causes an infinite loop, muahaha. Will fix soon
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by user24 on Monday January 28, 2013 @11:31AM (#5129171)
sweet. Thanks for fixing.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by axelfreeman on Friday January 25, 2013 @03:51AM (#5114622)
works for me in FF 18.0.1 on win7.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by DoubleCluster on Friday January 25, 2013 @04:38AM (#5114725)
Ohh... shiny!

Can we also get Elastic tabstops? http://nickgravgaard.com/elastictabstops/

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by jakiestfu on Friday January 25, 2013 @11:59AM (#5116386)
How would you want the definition to be? How would you "activate" elastic tab stops?
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by tantalor on Friday January 25, 2013 @01:17AM (#5114286)
> var editor = new Behave({

> var editor = Behave({

Is it a constructor or not?

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by tantalor on Friday January 25, 2013 @01:23AM (#5114305)
On further inspection, it must be a constructor.

The second case is incorrect. The function assigns to "this", which would be undefined in strict mode, or the global object. Very bad either way.

Remember kids: objects are your friend.

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by jakiestfu on Friday January 25, 2013 @01:42AM (#5114353)
Thank you good sir. It is a constructor, I've fixed the sites
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by state on Friday January 25, 2013 @01:31AM (#5114322)
I wish it could be var editor = now Behave({
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by jeffmess on Friday January 25, 2013 @03:09AM (#5114547)
var editor = oh Behave({
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by ctruman on Friday January 25, 2013 @12:59AM (#5114228)
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by tantalor on Friday January 25, 2013 @02:09AM (#5114416)
Auto indent should indent when a newline is nested in parentheses, like this:

  foo(1,
      2,
      3)
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by jakiestfu on Friday January 25, 2013 @02:40AM (#5114473)
Right now, it is easy to add support for indentation breaks, but it would function like braces or brackets. I'll look into this for parenthesis tomorrow, thanks!
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by BOSH on Friday January 25, 2013 @03:10AM (#5114549)
I like it very much. Simple and elegant solution. Will try to find a use for this lib.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by est on Friday January 25, 2013 @12:52AM (#5114206)
Now please add mouse-hover hint box, dropdown list for auto completion and I am sold
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by visarga on Friday January 25, 2013 @12:53AM (#5114213)
If only TextWrangler had auto-completion and auto-pairing of brackets and quotes.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by bink-lynch on Friday January 25, 2013 @12:19PM (#5116501)
Have you looked at Sublime Text 2?

http://www.sublimetext.com/2

I switched about a year ago and I am very pleased.

EDIT: This shows it off better: http://www.sublimetext.com/

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by jakiestfu on Friday January 25, 2013 @12:56AM (#5114217)
Elaborate on the hover hint box, please
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by est on Friday January 25, 2013 @01:18AM (#5114290)
Okay,

suppose this line:

    result = someFunction(param1, param2='ok')
mouse over to `someFunction`, a small box shows brief description of function, what it does, how many parameters are required, what does optional parameters do.

It's basically a richer version of <span title="text" alt="text"</span>

Re:Show HN: Behave.js – Coding Behaviors for textarea elements by justplay on Friday January 25, 2013 @04:03AM (#5114653)
It is cool but it will more cool if you add highlighting.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by thousande on Friday January 25, 2013 @01:19PM (#5116806)
Use CodeMirror (http://codemirror.net/) for this, or Ace
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by Narretz on Friday January 25, 2013 @05:07AM (#5114797)
Ideally, highlighting should be pluggable into the textarea from another source.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by justplay on Friday January 25, 2013 @05:53AM (#5114899)
Certainly,but it'll more awesome if it included by default. It will give a more IDE type look .
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by culshaw on Friday January 25, 2013 @04:28AM (#5114701)
I can't seem to get it to work on Chrome(24) on a Mac :(
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by bink-lynch on Friday January 25, 2013 @12:31PM (#5116565)
Works for me on Mac/Chrome 24.0.1312.56.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by thomasfl on Friday January 25, 2013 @04:35AM (#5114723)
Works great! Seems to have issues with IE 9 though.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by apathetic on Friday January 25, 2013 @05:41AM (#5114870)
When you undo, it's undoing it very weirdly.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by swah on Friday January 25, 2013 @05:29AM (#5114852)
This is my FUD regarding adopting AngularJS: most exciting things in Javascript world happen either in the jQuery world, or on top of bare-bones Javascript.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by solarbunny on Friday January 25, 2013 @09:13AM (#5115458)
Try to type in: {}]]] and press Enter...
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by wheaties on Friday January 25, 2013 @09:15AM (#5115468)
Ok, looks like you found a bug which sends things into an infinite loop.
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by jakiestfu on Friday January 25, 2013 @11:57AM (#5116383)
Thank you, will fix!
Re:Show HN: Behave.js – Coding Behaviors for textarea elements by Inversechi on Friday January 25, 2013 @04:42AM (#5114733)
Awesome - Well done!