aboutsummaryrefslogtreecommitdiff
path: root/extension/popup
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2015-12-16 08:01:43 +0100
committerFlorian Dold <florian.dold@gmail.com>2015-12-16 08:01:43 +0100
commit1b295d0f1aa18ece305fdc96cc356bfc2e794934 (patch)
tree32d227edf658ba83e83008d9c20f310510b9843f /extension/popup
parent331547059868a0e36acf5f2efac71ecbd1a96c8c (diff)
show balance
Diffstat (limited to 'extension/popup')
-rw-r--r--extension/popup/popup.css4
-rw-r--r--extension/popup/wallet.html51
-rw-r--r--extension/popup/wallet.js100
3 files changed, 2 insertions, 153 deletions
diff --git a/extension/popup/popup.css b/extension/popup/popup.css
index 023d1520b..80a0829e5 100644
--- a/extension/popup/popup.css
+++ b/extension/popup/popup.css
@@ -1,5 +1,5 @@
body {
- width: 35em;
+ width: 30em;
margin: 0;
padding: 0
}
@@ -48,4 +48,4 @@ body {
#reserve-create table .input input[type="text"] {
width: 100%;
-} \ No newline at end of file
+}
diff --git a/extension/popup/wallet.html b/extension/popup/wallet.html
deleted file mode 100644
index d481193c6..000000000
--- a/extension/popup/wallet.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-
-<html>
- <head>
- <meta charset="utf-8">
- <link rel="stylesheet" href="popup.css" type="text/css">
- <script src="../lib/util.js" type="text/javascript"></script>
- <script src="wallet.js" type="text/javascript"></script>
- </head>
-
- <body>
- <div id="header" class="nav">
- <a href="wallet.html" class="active">Wallet</a>
- <a href="transactions.html">Transactions</a>
- <a href="reserves.html">Reserves</a>
- <button id="debug">Debug!</button>
- </div>
-
- <div id="content">
- <table id="wallet-table" class="hidden">
- <thead>
- <tr>
- <th colspan="2">Amount</th>
- <th>Show</th>
- </tr>
- </thead>
- <tbody>
- <!--
- <tr>
- <td class="amount">42</td>
- <td class="currency">EUR</td>
- <td class="select"><input type="checkbox" /></td>
- </tr>
- <tr>
- <td class="amount">23</td>
- <td class="currency">USD</td>
- <td class="select"><input type="checkbox" /></td>
- </tr>
- <tr>
- <td class="amount">1337</td>
- <td class="currency">KUD</td>
- <td class="select"><input type="checkbox" /></td>
- </tr>
- -->
- </tbody>
- </table>
- <p id="wallet-empty">The wallet is empty.</p>
- </div>
-
- </body>
-</html>
diff --git a/extension/popup/wallet.js b/extension/popup/wallet.js
deleted file mode 100644
index da8cf72d3..000000000
--- a/extension/popup/wallet.js
+++ /dev/null
@@ -1,100 +0,0 @@
-'use strict';
-
-var selected_currency = 'EUR'; // FIXME
-
-function select_currency (checkbox, currency, amount)
-{
- selected_currency = currency;
-
- if (checkbox.checked)
- {
- let inputs = document.getElementsByTagName('input');
- for (let i = 0; i < inputs.length; i++)
- {
- let input = inputs[i];
- if (input != checkbox)
- input.checked = false;
- }
- chrome.browserAction.setBadgeText({text: amount.toString()})
- chrome.browserAction.setTitle({title: 'Taler: ' + amount + ' ' + currency});
- }
- else
- {
- chrome.browserAction.setBadgeText({text: ''})
- chrome.browserAction.setTitle({title: 'Taler'});
- }
-}
-
-
-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);
-
- let td_amount = document.createElement('td');
- td_amount.id = 'wallet-currency-'+ currency +'-amount';
- td_amount.className = 'amount';
- let text_amount = document.createTextNode(amount);
- tr.appendChild(td_amount).appendChild(text_amount);
-
- let td_currency = document.createElement('td');
- td_currency.id = 'wallet-table-'+ currency +'-currency';
- td_currency.className = 'currency';
- let text_currency = document.createTextNode(currency);
- tr.appendChild(td_currency).appendChild(text_currency);
-
- let td_select = document.createElement('td');
- td_select.id = 'wallet-table-'+ currency +'-select';
- td_select.className = 'select';
- let checkbox = document.createElement('input');
- checkbox.id = 'wallet-table-'+ currency +'-checkbox';
- checkbox.setAttribute('type', 'checkbox');
- if (currency == selected_currency)
- checkbox.checked = true;
- tr.appendChild(td_select).appendChild(checkbox);
-
- checkbox._amount = amount;
- checkbox.addEventListener('click', function () {
- select_currency(this, currency, this._amount);
- });
-}
-
-function update_currency (currency, amount)
-{
- let td_amount = document.getElementById('wallet-currency-'+ currency +'-amount');
- let text_amount = document.createTextNode(amount);
- td_amount.removeChild(td_amount.firstChild);
- td_amount.appendChild(text_amount);
-
- let checkbox = document.getElementById('wallet-table-'+ currency +'-checkbox');
- checkbox._amount = amount;
-}
-
-document.addEventListener('DOMContentLoaded', (e) => {
- //chrome.runtime.sendMessage({type: "WALLET_GET"}, function(wallet) {
- // for (let currency in wallet) {
- // let amount = amount_format(wallet[currency]);
- // add_currency(currency, amount);
- // }
- //});
-
- // FIXME: remove
- add_currency('EUR', 42);
- add_currency('USD', 17);
- add_currency('KUD', 1337);
- update_currency('USD', 23);
-
- document.getElementById("debug").addEventListener("click", (e) => {
- chrome.tabs.create({
- "url": chrome.extension.getURL("pages/debug.html")
- });
- });
-});