From cfa304d028fa7d32ed5bebd1de7dd41100f4d025 Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Sun, 20 Jul 2014 18:40:43 -0700 Subject: [PATCH] Handle focus on login screen --- client/js/chat.js | 16 +++++++++------- config.json | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/client/js/chat.js b/client/js/chat.js index 9e000af9..32019d4f 100644 --- a/client/js/chat.js +++ b/client/js/chat.js @@ -404,14 +404,16 @@ $(function() { var windows = $("#windows"); var forms = $("#sign-in, #connect"); - windows.on("show", ".window", function() { - // Temporary. - return; - + windows.on("show", "#sign-in", function() { var self = $(this); - setTimeout(function() { - self.find("input").eq(0).focus().select(); - }, 0); + var inputs = self.find("input"); + inputs.each(function() { + var self = $(this); + if (self.val() === "") { + self.focus(); + return false; + } + }) }); windows.on("click", ".input", function() { diff --git a/config.json b/config.json index 8914005b..f16cea1a 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,5 @@ { "port": 9000, "theme": "themes/example.css", - "public": true + "public": false }