Move all assets to source folder

This commit is contained in:
Kevin Peng
2025-04-20 06:34:16 +08:00
parent f51d39ee96
commit 460c8204b6
157 changed files with 0 additions and 0 deletions

View File

@@ -1,38 +0,0 @@
document.addEventListener('DOMContentLoaded', function() {
const form = document.getElementById('subscribe-form');
const message = document.getElementById('form-message');
form.addEventListener('submit', function(event) {
event.preventDefault();
// Set the source input to the current page's domain (protocol + domain + port)
const sourceInput = form.querySelector('input[name="source"]');
sourceInput.value = window.location.origin;
const formData = new FormData(form);
const data = {};
formData.forEach((value, key) => { data[key] = value; });
fetch('https://script.google.com/macros/s/AKfycbwBqXSVZWT5GBsq5bPyz6xqF_RR7JZhK9PyszpvcztgZf3HbXhB4bUFALgkNq-DBpp2/exec', {
method: 'POST',
mode: 'no-cors',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams(data).toString(),
})
.then(response => {
message.style.display = 'block';
message.style.color = '#df4d3f';
message.textContent = 'Thank you for subscribing!';
form.reset();
setTimeout(() => { message.style.display = 'none'; }, 5000);
})
.catch(error => {
message.style.display = 'block';
message.style.color = 'red';
message.textContent = 'Error subscribing. Please try again.';
console.error('Error:', error);
});
});
});