forked from 101studio/chromBank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
31 lines (28 loc) · 810 Bytes
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var bg = chrome.extension.getBackgroundPage();
var c = 0;
var loadAccounts = function() {
var r = bg.Banks.isReady();
if(r === -1) {
window.location = 'options.html#popup';
} else if(r === false) {
if(c<30) {
$('#msg').html('Ładowanie... ('+(++c)+')');
setTimeout(loadAccounts, 500);
} else {
$('#msg').html('Przekroczono czas połączenia');
}
} else {
var list = bg.Banks.getList(), html='';
for(var i in list) {
html += '<tr><th colspan="3">'+i+'</th></tr>';
html+= '<tr><td> </td><td>saldo:</td><td>środki:</td></tr>';
for(var j in list[i]) {
var a = list[i][j];
html+= '<tr><td>'+a.name+'</td><td>' + a.balance + '</td><td><strong>' + a.cash + '</strong></td></tr>';
}
}
$('#msg').html('');
$('#result').html(html);
}
};
loadAccounts();