Добавил обработку виртуального поля счета

This commit is contained in:
Sipachev Igor 2021-03-09 13:03:25 +07:00
parent 06ada6bd79
commit fff52e9bed

View File

@ -1,40 +1,44 @@
function insertValueToNode(target, value) {
let nodeList = []
switch (target) {
case 'personal_id':
nodeList = document.querySelectorAll('*[name*="personal_id"]')
break
case 'iban':
nodeList = document.querySelectorAll('*[name*="bankaccount"]')
break
case 'phone':
nodeList = document.querySelectorAll('*[name*="phone"]')
break
case 'first_name':
nodeList = document.querySelectorAll('*[name*="first_name"]')
break
case 'last_name':
nodeList = document.querySelectorAll('*[name*="last_name"]')
break
}
for (const node of nodeList) {
node.value = value
}
}
chrome.runtime.onMessage.addListener(
function(autocompleteDTO, sender, sendResponse) {
switch (autocompleteDTO.action) {
case 'insert':
insertValueToNode(autocompleteDTO.target || null, autocompleteDTO.value || '')
break
case 'clean_notification':
var elementList = document.querySelectorAll('.uk-notify-message');
elementList.forEach(function(elementItem) {
elementItem.remove()
});
break
}
}
);
function insertValueToNode(target, value) {
let nodeList = []
switch (target) {
case 'personal_id':
nodeList = document.querySelectorAll('*[name*="personal_id"]')
break
case 'iban':
nodeList = document.querySelectorAll('.user-bank-account__fake')
for (const node of nodeList) {
node.value = value.substr(2)
}
nodeList = document.querySelectorAll('*[name*="bankaccount"]')
break
case 'phone':
nodeList = document.querySelectorAll('*[name*="phone"]')
break
case 'first_name':
nodeList = document.querySelectorAll('*[name*="first_name"]')
break
case 'last_name':
nodeList = document.querySelectorAll('*[name*="last_name"]')
break
}
for (const node of nodeList) {
node.value = value
}
}
chrome.runtime.onMessage.addListener(
function(autocompleteDTO, sender, sendResponse) {
switch (autocompleteDTO.action) {
case 'insert':
insertValueToNode(autocompleteDTO.target || null, autocompleteDTO.value || '')
break
case 'clean_notification':
var elementList = document.querySelectorAll('.uk-notify-message');
elementList.forEach(function(elementItem) {
elementItem.remove()
});
break
}
}
);