this feature will make possible for people participate in a chat and also do something else, go to another windows and such...

the idea is change page title and focus thru javascript on any new message

don't know yet if it should be default or by user request, like using some checkbox like chatbox module does

Comments

DaveNotik’s picture

Title: alert user on any new message » Alert user on any new message

Do not force a focus change.

If the window does not have focus, simply indicate that there is a new chat line(s) by changing the window title back and forth, from what it actually is to e.g.:

guest01 says "Dave, how are you..."

Always use the first line that hasn't been seen (i.e. don't change this text every time a new line comes in).

The browser will handle cutting off the text when it's too long.

Anonymous’s picture

i agree with dave on this one - just let the user know, don't grab focus.

pacheco’s picture

cool, i agree...

will code that, tks!

pacheco’s picture

ok, having some problem trying to implement that:

window.onfocus and window.onblur worked fine in FireFox
but IE has this weird thing about throwing an window.onblur if you change focus inside the window
like when you just click inside textentry box...

does anyone knows some workaround for that?

DaveNotik’s picture

Suggestion:

Blink the title whenever you're not in the chatroom textbox, versus not in the window/tab. Might be easier to code.

IE sucks. The onblur() works per element, I believe, and might need to be in the BODY tag. BODY onblur="whatever();"

Not sure.

http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onblur.asp

pacheco’s picture

campfire does that using a litlle sound alert
will try to implement that too...

pacheco’s picture

just added visual alerts, please test it.

i've added focus handling on each UI element as a workaround for that window's events inconsistency between browsers.

when all elements looses focus and a new msg comes, title will toggle between "* New message" and page's title every one second.

Anonymous’s picture

woohoo, nice work, i'll give it thorough going over tonight.

Anonymous’s picture

ok, i've tested this and it works as advertised.

i've committed some changes to add the username of the first unseen message to the title bar.

i'll wait until someone else says they've tested it and its ok before moving to fixed.

well done paulo!

pacheco’s picture

cool, but don't mark as fixed yet

i will add sound alerts too... :)

Anonymous’s picture

ok, great, i'll wait.

it would good if the sound was configurable per chatroom?

cheers
justin

pacheco’s picture

don't think so, UI elements (including sounds) should remain consistent in my opinion

it would be like having a diferent away icon for each chatroom

Anonymous’s picture

hi paulo,

a agree with the consistency thing. i meant configurable as in "be able to turn it on or off". does that sound better?

pacheco’s picture

yeah, thats better, i was thinking about having another checkbox to let users turn sounds off too, like:

[_______________________] [Send]
[_] set my status to "away"
[_] turn sounds off

what do you think?

DaveNotik’s picture

Checkboxes? Eh.

I'd suggest simple links, like so:

[________________________] [Send]

Sound is on | off
Status is active | away

Whichever option is *not* true is linked so it can be clicked, i.e. if sound is on, "off" is linked and clickable and "on" is bold and not linked. Change via JS onClick.

That seems best for now, although I always wonder if we can't handle session-specific user settings better.

Anonymous’s picture

Status: Active » Closed (duplicate)

there's now a specific issue for this ( http://drupal.org/node/82235 ), so i'm marking this as a duplicate.

can we continue the discussion there?