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

master
Sipachev Igor 4 years ago
parent 06ada6bd79
commit fff52e9bed
  1. 84
      assets/js/script.js

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

Loading…
Cancel
Save