You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
962 B

4 years ago
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) {
insertValueToNode(autocompleteDTO.target || null, autocompleteDTO.value || '')
}
);