aboutsummaryrefslogtreecommitdiffstats
path: root/public/js/index.coffee
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2017-01-15 18:24:09 -0800
committerAdam Soltys <[email protected]>2017-01-15 18:24:09 -0800
commit7762ceaa7e2bb34f8758e17a4c8f512fa6a81b9e (patch)
tree91bb1d1b8fe6ad77a48f0e429d9bfd35834c78d9 /public/js/index.coffee
parent0ae266bf88f9f79c7e99b272688126898303daa4 (diff)
downloadcoinos-server-7762ceaa7e2bb34f8758e17a4c8f512fa6a81b9e.tar.gz
coinos-server-7762ceaa7e2bb34f8758e17a4c8f512fa6a81b9e.zip
Initial Vueification
Diffstat (limited to 'public/js/index.coffee')
-rw-r--r--public/js/index.coffee44
1 files changed, 0 insertions, 44 deletions
diff --git a/public/js/index.coffee b/public/js/index.coffee
deleted file mode 100644
index 090abbe2..00000000
--- a/public/js/index.coffee
+++ /dev/null
@@ -1,44 +0,0 @@
-#= require js/jquery-1.8.2.min.js
-#= require js/bootstrap.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) ->
- commission = 0.015
- commission *= -1 if type is 'bid'
-
- $.ajax(
- url: "/ticker?symbol=virtexCAD&type=#{type}&amount=100",
- success: (exchange) ->
- if not exchange?
- exchange = '??'
-
- exchange = exchange - exchange * commission
- $("##{type}").html(exchange.toFixed(2))
- error: ->
- $("##{type}").html('??')
- )