mirror of
https://github.com/twofas/2fas-browser-extension.git
synced 2024-11-22 18:19:59 +01:00
#1501 clickSubmit - trim FIX
This commit is contained in:
parent
dd25e9ebe5
commit
73c2d38f4d
@ -62,10 +62,19 @@ const clickSubmit = (inputElement, siteURL) => {
|
||||
if (form) {
|
||||
const formSubmit = Array.from(form.querySelectorAll('button[type="submit"], input[type="submit"]'));
|
||||
|
||||
if (formSubmit && formSubmit.length === 1 && !ignoreButtonTexts().includes(formSubmit[0].innerText.trim().toLowerCase())) {
|
||||
try {
|
||||
formSubmit[0].click();
|
||||
} catch (e) {}
|
||||
if (formSubmit && formSubmit.length === 1) {
|
||||
const formSubmitText = formSubmit[0]?.innerText;
|
||||
|
||||
if (
|
||||
formSubmitText &&
|
||||
typeof formSubmitText.trim === 'function' &&
|
||||
typeof formSubmitText.toLowerCase === 'function' &&
|
||||
!ignoreButtonTexts().includes(formSubmitText.trim().toLowerCase())
|
||||
) {
|
||||
try {
|
||||
formSubmit[0].click();
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -46,14 +46,36 @@ const getFormElements = () => {
|
||||
}
|
||||
|
||||
if (element.nodeName.toLowerCase() === 'button') {
|
||||
return buttonsTexts.includes(element.innerText.trim().toLowerCase())
|
||||
const elementText = element?.innerText;
|
||||
|
||||
if (
|
||||
elementText &&
|
||||
typeof elementText.trim === 'function' &&
|
||||
typeof elementText.toLowerCase === 'function'
|
||||
) {
|
||||
return buttonsTexts.includes(elementText.trim().toLowerCase())
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
}
|
||||
|
||||
return elements.filter(element => !ignoreButtonTexts().includes(element.innerText.trim().toLowerCase()));
|
||||
return elements.filter(element => {
|
||||
const elementText = element?.innerText;
|
||||
|
||||
if (
|
||||
elementText &&
|
||||
typeof elementText.trim === 'function' &&
|
||||
typeof elementText.toLowerCase === 'function'
|
||||
) {
|
||||
return !ignoreButtonTexts().includes(elementText.trim().toLowerCase());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = getFormElements;
|
||||
|
@ -35,10 +35,34 @@ const getFormSubmitElements = () => {
|
||||
|
||||
if (submits.length <= 0) {
|
||||
const buttons = Array.from(document.querySelectorAll('input[type="button"],button'));
|
||||
submits = buttons.filter(button => buttonsTexts.includes(button.innerText.trim().toLowerCase()));
|
||||
submits = buttons.filter(button => {
|
||||
const buttonText = button?.innerText;
|
||||
|
||||
if (
|
||||
buttonText &&
|
||||
typeof buttonText.trim === 'function' &&
|
||||
typeof buttonText.toLowerCase === 'function'
|
||||
) {
|
||||
return buttonsTexts.includes(buttonText.trim().toLowerCase())
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return submits.filter(button => !ignoreButtonTexts().includes(button.innerText.trim().toLowerCase()));
|
||||
return submits.filter(button => {
|
||||
const buttonText = button?.innerText;
|
||||
|
||||
if (
|
||||
buttonText &&
|
||||
typeof buttonText.trim === 'function' &&
|
||||
typeof buttonText.toLowerCase === 'function'
|
||||
) {
|
||||
return !ignoreButtonTexts().includes(button.innerText.trim().toLowerCase());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = getFormSubmitElements;
|
||||
|
Loading…
Reference in New Issue
Block a user