-
Notifications
You must be signed in to change notification settings - Fork 18
/
paypal.user.js
69 lines (58 loc) · 1.83 KB
/
paypal.user.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
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
function collect(){
var _ = function(a){
return document.querySelectorAll(a);
}
var total = 0;
var exrate = {
'EUR':7.7745,
'USD':6.5255,
'GBP':8.5053,
'SGD':4.8427,
'RUB':0.1140,
'CNY':1
}
var invoices = [
{amount:59 , c:'CNY' , desc:'tcloud'},
{amount:42 , c:'CNY' , desc:'starrydns'},
{amount:30 , c:'CNY',desc:'vps.pm'},
{amount:26 , c:'CNY',desc:'vps77-crea'},
{amount:6.99 , c:'EUR',desc:'online'},
{amount:8.99 , c:'EUR',desc:'ks'},
{amount:3.75 , c:'EUR',desc:'dedi vie cn2'},
{amount:3.9 , c:'EUR',desc:'gcore khv'},
{amount:0.9 , c:'GBP',desc:'piohost'},
{amount:10 , c:'USD',desc:'aliyun hk'},
{amount:4.5 , c:'USD',desc:'aliyun sgp'},
{amount:7.99 , c:'USD',desc:'rfc hk'},
{amount:2.5 , c:'USD',desc:'vultr jp'},
{amount:1 , c:'USD',desc:'ru-vstoike'},
{amount:5 , c:'SGD',desc:'beyotta'},
{amount:1.7 , c:'EUR',desc:'sparta'},
{amount:1 , c:'USD',desc:'dedi-SK'},
{amount:0.375 , c:'USD',desc:'eth-qn'},
{amount:1 , c:'USD',desc:'eth-cc'},
{amount:3 , c:'USD',desc:'hostdare-usla-qn'},
{amount:1 , c:'USD',desc:'providerservice-qn'},
{amount:5.35 , c:'USD',desc:'quadcone(MC)'},
{amount:0.6 , c:'USD',desc:'virmach'},
{amount:0.1 , c:'USD',desc:'virmach'},
];
var amouts = _('.transactionAmount');
amouts.forEach(function(el){
var s = el.querySelector('.vx_h3').innerHTML;
var v_t = el.querySelector('.vx_h4').innerHTML;
var c = el.querySelector('.currencyCode') ? el.querySelector('.currencyCode').innerHTML : 'USD';
var v = parseFloat( (v_t.match(/\d+\.\d+/) || [0])[0] );
invoices.push({amount:v , c : c , s:s});
});
invoices.forEach(function(p){
if(p.s == '+'){
total -= exrate[p.c] * p.amount ;
}else{
total += exrate[p.c] * p.amount ;
}
if(isNaN(p.amount) || !exrate[p.c]) console.log(p)
});
console.log('Total : ' , total);
}
collect();