Permalink
Browse files

Merge pull request #3 from olleman42/master

focus nick reg on load
  • Loading branch information...
2 parents 5f4220d + fa997ce commit 2e3b26dce1a62c2165addf8e8aab1a83069a5301 @Xlator committed Mar 12, 2012
Showing with 10 additions and 5 deletions.
  1. +4 −4 ajax/chat.php
  2. +6 −1 js/jqchat.js
View
@@ -14,10 +14,10 @@
else
session_write_close();
-$headers = getallheaders();
-if(!isset($headers["X-Requested-With"]) || $headers["X-Requested-With"] != "XMLHttpRequest") {
- die();
-}
+// $headers = apache_request_headers();
+// if(!isset($headers["X-Requested-With"]) || $headers["X-Requested-With"] != "XMLHttpRequest") {
+// die();
+// }
if(isset($_POST['mode'])) {
switch($_POST['mode']) {
case "init":
View
@@ -55,11 +55,13 @@ $(document).ready(function() {
// ### Show and handle the registration form
regform: function() {
+ var nickreginput = $('input.regnick');
+
$('form#chatcontrols').hide(); // Hide the chat form
$('form#register').show().children("label").hide().end()
.children(".regsubmit").on("click", function(e) {
e.preventDefault();
- nick = $('input.regnick').val();
+ nick = nickreginput.val();
if(!nick.validateNick()) {
$('label.regerror').hide();
@@ -82,6 +84,9 @@ $(document).ready(function() {
Chat.poll();
}
});
+
+ // Focus nick input upon page load
+ nickreginput[0].focus();
},
// ### Long polling method

0 comments on commit 2e3b26d

Please sign in to comment.