]> projects.mako.cc - scuttle/blobdiff - templates/register.tpl.php
Tagged 0.7.5
[scuttle] / templates / register.tpl.php
index 7160535422b1fbbf032a192f26cd238137bf68a4..8629ec2bcb8edc1ddf99f471a447b0ca07bcd39b 100644 (file)
@@ -1,12 +1,4 @@
-<?php
-$this->includeTemplate($GLOBALS['top_include']);
-?>
-
-<script type="text/javascript">
-window.onload = function() {
-    document.getElementById("username").focus();
-}
-</script>
+<?php $this->includeTemplate($GLOBALS['top_include']); ?> 
 
 <p><?php echo sprintf(T_('Sign up here to create a free %s account. All the information requested below is required'), $GLOBALS['sitename']); ?>.</p>
 
@@ -14,7 +6,7 @@ window.onload = function() {
 <table>
 <tr>
     <th align="left"><label for="username"><?php echo T_('Username'); ?></label></th>
-    <td><input type="text" id="username" name="username" size="20" class="required" onkeyup="isAvailable(this, '')" /></td>
+    <td><input type="text" id="username" name="username" size="20" class="required" /></td>
     <td id="availability"></td>
 </tr>
 <tr>
@@ -34,7 +26,26 @@ window.onload = function() {
 </tr>
 </table>
 </form>
+<script type="text/javascript">
+$(function() {
+  $("#username").focus()
+                .keydown(function() {
+                  clearTimeout(self.searching);
+                  self.searching = setTimeout(function() {
+                    $.get("<?php echo $GLOBALS['root']; ?>ajaxIsAvailable.php?username=" + $("#username").val(), function(data) {
+                        if (data) {
+                          $("#availability").removeClass()
+                                            .html("<?php echo T_('Available'); ?>");
+                        } else {
+                          $("#availability").removeClass()
+                                            .addClass("not-available")
+                                            .html("<?php echo T_('Not Available'); ?>");
+                        }
+                      }
+                    );
+                  }, 300);
+                });
+});
+</script>
 
-<?php
-$this->includeTemplate($GLOBALS['bottom_include']);
-?>
\ No newline at end of file
+<?php $this->includeTemplate($GLOBALS['bottom_include']); ?>
\ No newline at end of file

Benjamin Mako Hill || Want to submit a patch?