forked from jakubwolny/chromBank
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnewtab.html
More file actions
144 lines (128 loc) · 6.23 KB
/
newtab.html
File metadata and controls
144 lines (128 loc) · 6.23 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>101</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
var MBANK = 'https://www.mbank.com.pl';
var FORM = '#MainForm';
var clicked = false;
$.get(MBANK, function(html) {
// $('#result').html(data);
$(html).find('#MainForm').appendTo('#result');
// $(html).appendTo('body');
$('#customer').val(localStorage.customer);
$('#password').val(localStorage.password);
}, 'html');
var bIsPosting = false;
var bIsActionPosting = false;
function doSubmit(addr, target, method, parameters, causesvalidation, resetform, isAction, funct2call) {
// if (isAction == true && bIsActionPosting) {
// alert('sActionDone');
// return false;
// }
var theform=document.forms[0];
theform.action = addr;
if(target!='_blank' && target!='_new')
theform.target = target;
else
theform.target = Math.round(32000 * Math.random());
theform.method = method;
if(parameters != null)
document.getElementById('__PARAMETERS').value = parameters;
if(resetform)
leaveOnlySession(parameters);
if (isAction == true) {
bIsActionPosting = true;
}
if (funct2call != null) {
if (eval(funct2call) == false) {
bIsActionPosting = false;
return false;
}
}
// theform.submit();
if(addr.indexOf('/') == 0){
addr = addr.substr(1);
}
$.post(MBANK + '/' + addr, $(FORM).serialize(), function(data, textStatus, jqXHR){
process(data, this.url);
});
return false;
}
function OperationHistoryExport(export_checkbox, checked_url, unchecked_url) {
var obj = document.getElementById('Activity_Data');
if (obj != null)
obj.value = '';
if (export_checkbox.checked)
{
doSubmit(checked_url, '', 'POST', '', true, false, true, null);
}
else
doSubmit(unchecked_url, '', 'POST', '', true, false, true, null);
return false;
}
function process(html, url){
url = url.substr(MBANK.length + 1);
$('#result').empty();
console.log(url);
if(url == 'logon.aspx'){
$.get(MBANK + "/accounts_list.aspx", function(html){
$(html).find(FORM).appendTo('#result');
$('#contextInfo span').text(); // imie i nazwisko
$('#AccountsGrid li:eq(2)').each(function(){
if(!$(this).is('.header, .footer')){
$(this).find('p').each(function(){
var cssClass = $(this).attr('class');
if(cssClass == 'Account'){
console.log($(this).text());
}else if(cssClass == 'Actions') {
$(this).find('a:eq(2)').click();
}
});
}
})
});
}else if(url == 'account_oper_list.aspx'){
$(html).find(FORM).appendTo('#result');
if($('#account_operations').length){
var transactions = [];
var html = [];
$('#account_operations li').each(function(){
var t = $(this);
if(!t.hasClass('header')){
var p = t.children('p');
console.log(p.filter('.OperationDescription'));
var t = {
date1: p.filter('.Date').children('span').eq(0).text(),
date2: p.filter('.Date').children('span').eq(1).text(),
amount: p.filter('.Amount').eq(0).text(),
balance: p.filter('.Amount').eq(1).text()
}
var description = p.filter('.OperationDescription');
t.type = description.children('a').text();
var spans = description.children('span');
if(spans.length == 2){
t.name = spans.eq(1).text();
}else {
t.name = spans.eq(0).text();
}
transactions.push(t);
html.push('<li>' + t.name + '<strong>' + t.amount + '</strong></li>');
}
});
$('#result').empty().html('<ul>' + html.join('') + '</ul>');
}else{
$('#Submit').click();
}
}
}
</script>
<style type="text/css">
</style>
</head>
<body>
<div id="result"></div>
</body>
</html>