-
Notifications
You must be signed in to change notification settings - Fork 0
/
content.js
29 lines (23 loc) · 889 Bytes
/
content.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
function fillOrder(order) {
var changeEvent,
idPrefix = '#ctl00_ctl00_ctl00_cphbody_cphbody_cphbody_tabcontrol_';
$(idPrefix + 'txtTrkDobro').val(order.iban);
$(idPrefix + 'txtZnesek').val(order.amount.replace('.', ','));
$(idPrefix + 'txtNamenKoda').val(order.code);
$(idPrefix + 'txtNamen').val(order.purpose);
$(idPrefix + 'txtReferencaDobro1').val(order.reference.substr(2,2));
$(idPrefix + 'txtReferencaDobro2').val(order.reference.substr(4));
//triggers filling bic and address fields from iban
changeEvent = document.createEvent("HTMLEvents");
changeEvent.initEvent('change', true, true);
$(idPrefix + 'txtTrkDobro')[0].dispatchEvent(changeEvent);
}
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
switch (request.action) {
case 'fillOrder':
fillOrder(request.order);
break;
default:
console.log(request.text);
}
});