diff options
author | tg(x) <*@tg-x.net> | 2015-12-04 22:47:44 +0100 |
---|---|---|
committer | tg(x) <*@tg-x.net> | 2015-12-04 22:47:44 +0100 |
commit | 1089b40b1c03fa69c0e73dd43e4281aa96388171 (patch) | |
tree | 0cdffcbad05041659dc826db9f5dbf1f47de47e1 /extension/popup/wallet.js | |
parent | 5243a707260af9de820ad02b1972d3280164cf19 (diff) |
DB structure, emscripten interface
Diffstat (limited to 'extension/popup/wallet.js')
-rw-r--r-- | extension/popup/wallet.js | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/extension/popup/wallet.js b/extension/popup/wallet.js index cb7399dac..c148abc85 100644 --- a/extension/popup/wallet.js +++ b/extension/popup/wallet.js @@ -28,8 +28,13 @@ function select_currency (checkbox, currency, amount) function add_currency (currency, amount) { + let empty = document.getElementById('wallet-empty'); + if (! /\bhidden\b/.test(empty.className)) + empty.className += ' hidden'; + let table = document.getElementById('wallet-table'); table.className = table.className.replace(/\bhidden\b/, ''); + let tr = document.createElement('tr'); tr.id = 'wallet-table-'+ currency; table.appendChild(tr); @@ -73,13 +78,20 @@ function update_currency (currency, amount) checkbox._amount = amount; } -document.addEventListener('DOMContentLoaded', function () { - let empty = document.getElementById('wallet-empty'); +document.addEventListener( + 'DOMContentLoaded', + function () { + chrome.runtime.sendMessage({type: "WALLET_GET"}, function(wallet) { + for (let currency in wallet) + { + let amount = amount_format(wallet[currency]); + add_currency(currency, amount); + } + }); - // FIXME - empty.className += ' hidden'; - add_currency('EUR', 42); - add_currency('USD', 17); - add_currency('KUD', 1337); - update_currency('USD', 23); -}); + // FIXME: remove + add_currency('EUR', 42); + add_currency('USD', 17); + add_currency('KUD', 1337); + update_currency('USD', 23); + }); |