use sender as the provider

This commit is contained in:
Josh de Leeuw 2025-01-06 16:01:09 -05:00
parent b8666774e8
commit 1deb949c7d

View File

@ -5,57 +5,19 @@ We send out newsletters about once a month.
The newsletter includes information about new releases, upcoming events, community spotlights, and other news related to jsPsych. The newsletter includes information about new releases, upcoming events, community spotlights, and other news related to jsPsych.
You can unsubscribe at any time. You can unsubscribe at any time.
<div style="text-align: left" class="sender-form-field" data-sender-form-id="m5li9yz5ejr0wrwxrw5"></div>
<form method="post" name="subscribeform" id="subscribeform" enctype="multipart/form-data"> <script>
<input type="email" name="email" placeholder="Email address" id="email" size="40" class="md-input" required> (function (s, e, n, d, er) {
<input type="hidden" name="htmlemail" value="1"> s['Sender'] = er;
<input type="hidden" name="list[2]" value="signup" /> s[er] = s[er] || function () {
<input type="hidden" name="subscribe" value="subscribe"/> (s[er].q = s[er].q || []).push(arguments)
<button class='md-button md-button--primary' onclick="if (checkform()) {submitForm();} return false;" id="subscribe">Subscribe</button> }, s[er].l = 1 * new Date();
<div id="result"></div> var a = e.createElement(n),
</form> m = e.getElementsByTagName(n)[0];
a.async = 1;
<script type="text/javascript"> a.src = d;
m.parentNode.insertBefore(a, m)
function checkform() { })(window, document, 'script', 'https://cdn.sender.net/accounts_resources/universal.js', 'sender');
const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; sender('06a78af0a32181')
const emailInput = document.getElementById("email");
const resultDiv = document.getElementById("result");
if (!re.test(emailInput.value)) {
resultDiv.innerHTML = "Please enter a valid email address";
emailInput.focus();
return false;
}
return true;
}
async function submitForm() {
const emailInput = document.getElementById("email");
const successMessage = 'Thank you for your registration. Please check your email to confirm.';
const url = 'https://mail.jspsych.org/?p=asubscribe&id=6';
const resultDiv = document.getElementById("result");
const subscribeButton = document.querySelector('button#subscribe');
// Disable the subscribe button
subscribeButton.disabled = true;
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded', // Adjust based on your content type
},
body: new URLSearchParams(new FormData(document.getElementById('subscribeform'))),
});
const data = await response.text();
resultDiv.innerHTML = successMessage;
} catch (error) {
resultDiv.innerHTML = 'An error occurred. Please try again later.';
} finally {
// Re-enable the subscribe button
subscribeButton.disabled = false;
}
}
</script> </script>