aboutsummaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/js/index.coffee21
1 files changed, 21 insertions, 0 deletions
diff --git a/public/js/index.coffee b/public/js/index.coffee
index ea4f9ac3..940a5e2a 100644
--- a/public/js/index.coffee
+++ b/public/js/index.coffee
@@ -1,8 +1,29 @@
#= require jquery-1.8.2.min.js
+g = exports ? this
+
$(->
fetchExchangeRate('ask')
fetchExchangeRate('bid')
+
+ $('#username').blur(->
+ $.get(
+ "/#{$(this).val()}/exists",
+ username: $(this).val(),
+ (data) ->
+ if data is "true"
+ $('#username').prev().css('color', 'red').html('Username (taken)')
+ g.preventSubmit = true
+ else
+ $('#username').prev().css('color', 'black').html('Username')
+ g.preventSubmit = false
+ )
+ )
+
+ $('#signup').submit(->
+ return false if g.preventSubmit
+ return true
+ )
)
fetchExchangeRate = (type) ->