More new code: Autologout and delete key trapping for server

Just talk about kJams stuff with each other, describe things you did that worked, talk about your setup, anything that doesn't fit into the other forums!
Post Reply
DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

More new code: Autologout and delete key trapping for server

Post by DeusExMachina »

Autologout
OK, I did this once before, then Dave and Nik added their own official version. Just as quickly, however, they removed it again.
My understanding is that it was causing a server-side hang.
Well, I went back and added my old code back in in the meantime. (Note: my code does NOT cause ANY problems with kJams server, or kJams itself.) Essentially, it checks for inactivity, and if a person has not moved the mouse or typed into the main screen server page for a set period of time, it logs the singer out and returns the client to the log in screen. I found from experience that essentially NO ONE used the log out button, and as such, if you had publicly available computers with server, the next person to use the machine had full access to the previous person's lists, and could mistakenly add songs to the first person's Tonight list, thinking it was their own.
My code logs the client out automatically after 2 minutes of inactivity (120000 milliseconds.) You can set this to whatever you find appropriate by just changing the millisecond value at the top of the mainscreen.html file.

Delete key trapping:
In addition, I have also trapped the delete key. HTML standards dictate that the backspace key be functionally equivalent to the back button. This can be annoying, but in kJams server, it is SUPER ANNOYING. Especially since macs do not have a backspace key, but rather a delete key, and many do not have a forward delete key at all!
I found that users would select a song and hit delete, to remove the song from their tonight list, for instance, and get frustrated to find themselves back at the login screen. So I rewrote the official page to trap the delete key and redirect it to what it should be doing, removing selections from playlists, and backspacing over text in the search box.

I also make some minor mods to clean up the aesthetics a bit.

As always, I hope someone finds this helpful, and please drop me a P.M. or respond here if you tried it out, and let me know how it is working.

Here is a link to the code:
http://karaoke.kjams.com/wiki/Code/new_ ... autologout

dave
Site Admin
Posts: 6716
Joined: Sun Sep 18, 2005 8:02 am
Location: Seattle
Contact:

Re: More new code: Autologout and delete key trapping for se

Post by dave »

:)

Post Reply