From 8e9c5829e727feb590166c71c8e9a506c201a535 Mon Sep 17 00:00:00 2001 From: Miguel Angel Astor Romero Date: Wed, 31 Oct 2018 06:08:12 -0400 Subject: [PATCH] Changed more site UI stuff. --- docs/js/eth.js | 9 +++++---- src/js/eth.js | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/js/eth.js b/docs/js/eth.js index d2f72e3..96d2345 100644 --- a/docs/js/eth.js +++ b/docs/js/eth.js @@ -10,7 +10,7 @@ function canIPlayTheGame() { if (result.logs[0].args.player === myAccount) { $('#can_play').text(myAccount + ' can play the game!'); getTimesPlayed(); - loadBalance(); + loadBalance(false); playTheGame(); } else { alert("Whoops! An error ocurred.\nThanks for your money, though :P"); @@ -20,13 +20,15 @@ function canIPlayTheGame() { }); } -function loadBalance() { +function loadBalance(sad) { myWeb3.eth.getCoinbase(function(err, account) { if (err === null) { myAccount = account; myWeb3.eth.getBalance(account, function(err, balance) { if (err === null) { $('#balance').text(myWeb3.fromWei(balance, "ether") + " ETH"); + if (sad) + $('#can_play').text(myAccount + " can't play the game... so sad!"); } }); } @@ -63,9 +65,8 @@ function initWeb3() { pong.setProvider(myWeb3Provider); // update UI - loadBalance(); + loadBalance(true); getTimesPlayed(); - $('#can_play').text(myAccount + " can't play the game... so sad!"); // Register call and listen for events. ethCallback = canIPlayTheGame; diff --git a/src/js/eth.js b/src/js/eth.js index d2f72e3..96d2345 100644 --- a/src/js/eth.js +++ b/src/js/eth.js @@ -10,7 +10,7 @@ function canIPlayTheGame() { if (result.logs[0].args.player === myAccount) { $('#can_play').text(myAccount + ' can play the game!'); getTimesPlayed(); - loadBalance(); + loadBalance(false); playTheGame(); } else { alert("Whoops! An error ocurred.\nThanks for your money, though :P"); @@ -20,13 +20,15 @@ function canIPlayTheGame() { }); } -function loadBalance() { +function loadBalance(sad) { myWeb3.eth.getCoinbase(function(err, account) { if (err === null) { myAccount = account; myWeb3.eth.getBalance(account, function(err, balance) { if (err === null) { $('#balance').text(myWeb3.fromWei(balance, "ether") + " ETH"); + if (sad) + $('#can_play').text(myAccount + " can't play the game... so sad!"); } }); } @@ -63,9 +65,8 @@ function initWeb3() { pong.setProvider(myWeb3Provider); // update UI - loadBalance(); + loadBalance(true); getTimesPlayed(); - $('#can_play').text(myAccount + " can't play the game... so sad!"); // Register call and listen for events. ethCallback = canIPlayTheGame;