aboutsummaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2012-11-13 19:27:09 -0800
committerAdam Soltys <[email protected]>2012-11-13 19:27:09 -0800
commit16062edf148ea44bc8a5f40732c0dc1d363d588c (patch)
tree1c29230affc47ce26fee30d9f971c1f75e79a43a /public
parent54c28a395db853c601d3592c967f322c7f09e1d4 (diff)
downloadcoinos-server-16062edf148ea44bc8a5f40732c0dc1d363d588c.tar.gz
coinos-server-16062edf148ea44bc8a5f40732c0dc1d363d588c.zip
Allow market selection
Diffstat (limited to 'public')
-rw-r--r--public/js/calculator.coffee21
-rw-r--r--public/js/index.coffee9
2 files changed, 21 insertions, 9 deletions
diff --git a/public/js/calculator.coffee b/public/js/calculator.coffee
index 01523d9a..3d1d61b4 100644
--- a/public/js/calculator.coffee
+++ b/public/js/calculator.coffee
@@ -8,8 +8,9 @@ g = exports ? this
$(->
g.websocket = null
g.user = $('#user').val()
- g.title = get('title')
+ g.name = get('name')
g.address = get('address')
+ g.symbol = get('symbol')
g.commission = get('commission')
g.logo = get('logo')
g.exchange = 0
@@ -20,7 +21,7 @@ $(->
if user? and user
$.getJSON(user + '.json', (data) ->
- g.title = data.name
+ g.name = data.name
g.address = data.address
g.commission = data.commission
g.logo = data.logo
@@ -53,7 +54,7 @@ exchangeFail = ->
$('#calculator').hide()
fetchExchangeRate = ->
- $.getJSON('ticker')
+ $.getJSON('ticker?symbol=' + g.symbol)
.success((data) ->
unless data?
exchangeFail()
@@ -71,18 +72,20 @@ fetchExchangeRate = ->
setTimeout(fetchExchangeRate, 900000)
setupPage = ->
- unless g.address
- g.address = '1VAnbtCAnYccECnjaMCPnWwt81EHCVgNr'
-
- unless g.commission
- g.commission = 3
+ g.address or= '1VAnbtCAnYccECnjaMCPnWwt81EHCVgNr'
+ g.commission or= 3
+ g.symbol or= 'virtexCAD'
if g.logo
$('#logo').attr('src', g.logo).show()
+ else if not g.name
+ $('#logo').attr('src', 'img/bitcoin.png').show()
else
- $('#title').html(title).show()
+ $('#name').html(g.name).show()
$('#address').html(g.address)
+ $('#symbol').html(g.symbol + " - " + commission.toFixed(0) + "%")
+ $('#currency').html(g.symbol.slice(-3))
$('#received').hide()
fetchExchangeRate()
diff --git a/public/js/index.coffee b/public/js/index.coffee
new file mode 100644
index 00000000..d832c4ed
--- /dev/null
+++ b/public/js/index.coffee
@@ -0,0 +1,9 @@
+#= require jquery-1.8.2.min.js
+
+$(->
+ symbols = ['mtgoxUSD', 'btceUSD', 'bitstampUSD', 'virwoxSLL', 'btcdeEUR', 'mtgoxEUR', 'btc24EUR', 'mtgoxAUD', 'cryptoxAUD', 'mtgoxGBP', 'btcnCNY', 'intrsngEUR', 'virtexCAD', 'mtgoxPLN', 'cbxUSD', 'bitcurexPLN', 'bitmarketEUR', 'bitfloorUSD', 'mrcdBRL', 'bcEUR']
+
+ $.each(symbols, (i, v) ->
+ $('#symbol').append("<option>#{v}</option>")
+ )
+)