mirror of
https://github.com/ivabus/www
synced 2024-11-22 15:15:07 +03:00
Benchmark
This commit is contained in:
parent
930c6b26bc
commit
93f6dd14b0
1 changed files with 45 additions and 44 deletions
|
@ -42,51 +42,52 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const subscribeForm = document.getElementById('subscribeForm');
|
const emailBtn = document.getElementById("email-btn");
|
||||||
const formResponse = document.getElementById('formResponse');
|
const subscribeCollapse = document.querySelector(".subscribe-collapse");
|
||||||
|
|
||||||
subscribeForm.addEventListener('submit', (event) => {
|
emailBtn.addEventListener("click", function() {
|
||||||
event.preventDefault();
|
if (subscribeCollapse.style.display === "none") {
|
||||||
|
subscribeCollapse.style.display = "block";
|
||||||
const email = document.getElementById('email').value;
|
} else {
|
||||||
|
subscribeCollapse.style.display = "none";
|
||||||
if (!email) {
|
|
||||||
formResponse.innerHTML = '<p style="color: red">Please enter a valid email address.</p>';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch('https://manage.klaviyo.com/api/v1/list/R2UVm3/members', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
email: email,
|
|
||||||
api_key: 'pk_231a258e61a40283566192ee59310c7af4'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error('Failed to subscribe');
|
|
||||||
}
|
}
|
||||||
formResponse.innerHTML = '<p style="color: green">Form submitted!</p>';
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
formResponse.innerHTML = '<p style="color: red">An error occurred. Please try again later.</p>';
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- Deep-linking script for Twitter follow button -->
|
const subscribeForm = document.getElementById("subscribeForm");
|
||||||
<script>
|
const formResponse = document.getElementById("formResponse");
|
||||||
document.getElementById("follow-button").addEventListener("click", function() {
|
|
||||||
if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) {
|
subscribeForm.addEventListener("submit", event => {
|
||||||
window.location.href = "twitter://user?screen_name=teaxyz";
|
event.preventDefault();
|
||||||
} else if (navigator.userAgent.match(/Android/i)) {
|
|
||||||
window.location.href = "twitter://user?screen_name=teaxyz";
|
const email = document.getElementById("email").value;
|
||||||
} else {
|
|
||||||
window.location.href = "https://twitter.com/teaxyz";
|
if (!email) {
|
||||||
}
|
formResponse.innerHTML =
|
||||||
});
|
'<p style="color: red">Please enter a valid email address.</p>';
|
||||||
</script>
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch("https://manage.klaviyo.com/api/v1/list/R2UVm3/members", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
email: email,
|
||||||
|
api_key: "pk_231a258e61a40283566192ee59310c7af4"
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error("Failed to subscribe");
|
||||||
|
}
|
||||||
|
formResponse.innerHTML =
|
||||||
|
'<p style="color: green">Form submitted!</p>';
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
formResponse.innerHTML =
|
||||||
|
'<p style="color: red">An error occurred. Please try again later.</p>';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue