Replace jQuery with vanilla JS in PayPalEmail adapter (#3146)

* Replace jQuery with vanilla JS in `PayPalEmail` adapter

Removes jQuery dependency for auto-redirect functionality by using
document.addEventListener('DOMContentLoaded', ...) instead of .ready()

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Adam DaleyandCopilot authored and GitHub committed 2026-01-13 18:17:21 +00:00
1 parent b2152a2e12
commit db28331ecc
1 file changed
+6 -1
+6 -1
View File
@@ -268,7 +268,12 @@ class Payment_Adapter_PayPalEmail extends Payment_AdapterAbstract implements FOS
if (isset($this->config['auto_redirect']) && $this->config['auto_redirect']) {
$form .= sprintf('<h2>%s</h2>', __trans('Redirecting to PayPal.com'));
$form .= "<script type='text/javascript'>$(document).ready(function(){ document.getElementById('payment_button').style.display = 'none'; document.forms['payment_form'].submit();});</script>";
$form .= "<script>
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('payment_button').style.display = 'none';
document.forms['payment_form'].submit();
});
</script>";
}
return $form;