diff options
| author | Adam Soltys <[email protected]> | 2016-11-23 15:32:32 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2016-12-26 14:22:39 -0800 |
| commit | 5c91e5d45afaa22a71bfcdbd4c956a8993388bdb (patch) | |
| tree | 4a15b18e05a5fd13c19aec35954f2d430748a6e0 /public | |
| parent | a38665ae8273da58e657317026bb07f51d4ae731 (diff) | |
| download | coinos-server-5c91e5d45afaa22a71bfcdbd4c956a8993388bdb.tar.gz coinos-server-5c91e5d45afaa22a71bfcdbd4c956a8993388bdb.zip | |
Remove whitespace
Diffstat (limited to 'public')
| -rw-r--r-- | public/js/calculator.coffee | 25 | ||||
| -rw-r--r-- | public/js/calculator.js | 9 |
2 files changed, 15 insertions, 19 deletions
diff --git a/public/js/calculator.coffee b/public/js/calculator.coffee index 7dfb6186..75192596 100644 --- a/public/js/calculator.coffee +++ b/public/js/calculator.coffee @@ -13,7 +13,7 @@ g.transactions = [] $(-> $.ajax( - url: $('#user').val() + '.json', + url: $('#user').val() + '.json', dataType: 'json', success: (data) -> g.user = data @@ -70,8 +70,8 @@ $(-> ) $('#received').click(-> window.location = "/#{g.user.username}/report") - $('#slide').click(-> - $('#controls').slideToggle() + $('#slide').click(-> + $('#controls').slideToggle() $(this).find('i').toggleClass('fa-sort-up').toggleClass('fa-sort-down') ) ) @@ -83,7 +83,7 @@ setup = -> g.user.symbol or= 'quadrigacx' g.user.unit or= 'BTC' - if g.user.title + if g.user.title $('#title').html("<a href='/#{g.user.username}/edit'>#{g.user.title}</a>").show() if g.user.logo @@ -107,7 +107,7 @@ setup = -> fetchExchangeRate = -> $.ajax( url: "ticker?currency=#{g.user.currency}&symbol=#{g.user.symbol}&type=bid", - success: (exchange) -> + success: (exchange) -> if exchange? clear(EXCHANGE_FAIL) else @@ -149,7 +149,6 @@ updateTotal = -> $('#total').html(total.toString()) - # size = $('#calculator').width() * 0.7 size = 300 $('#qr').css('height', size) @@ -160,7 +159,7 @@ updateTotal = -> clearTimeout(g.timeout) g.timeout = setTimeout(-> $('#qr').html('') - new QRCode('qr', + new QRCode('qr', text: "bitcoin:#{g.user.address}?amount=#{g.amount_requested.toString()}" width: size height: size @@ -175,7 +174,7 @@ listen = -> fail(SOCKET_FAIL) if g.attempts > 3 g.blockchain = new WebSocket(API_URL) - g.blockchain.onopen = -> + g.blockchain.onopen = -> if g.blockchain.readyState is 1 g.attempts = 0 clear(SOCKET_FAIL) @@ -195,18 +194,16 @@ listen = -> g.blockchain.onmessage = (e) -> tx = JSON.parse(e.data) - amount = 0 - txid = tx.hash - return if txid == g.last - g.last = txid + return if tx.hash == g.last_seen + g.last_seen = tx.hash for output in tx.outputs - if (output.addresses[0] == g.user.address) + if (output.addresses[0] == g.user.address) amount += output.value / 100000000 - logTransaction(txid, amount) + logTransaction(tx.hash, amount) logTransaction = (txid, amount) -> if $('#received').is(":hidden") and amount >= g.amount_requested diff --git a/public/js/calculator.js b/public/js/calculator.js index c85c9bb3..6e71b56a 100644 --- a/public/js/calculator.js +++ b/public/js/calculator.js @@ -201,14 +201,13 @@ return listen(); }; return g.blockchain.onmessage = function(e) { - var amount, j, len, output, ref, tx, txid; + var amount, j, len, output, ref, tx; tx = JSON.parse(e.data); amount = 0; - txid = tx.hash; - if (txid === g.last) { + if (tx.hash === g.last_seen) { return; } - g.last = txid; + g.last_seen = tx.hash; ref = tx.outputs; for (j = 0, len = ref.length; j < len; j++) { output = ref[j]; @@ -216,7 +215,7 @@ amount += output.value / 100000000; } } - return logTransaction(txid, amount); + return logTransaction(tx.hash, amount); }; } }; |
