Free Trial form in features grid: 2x3 layout, email + location + send

- features-grid changed to repeat(3, 1fr) for 2x3 layout
- 6th cell is a Free Trial card with midnight bg, brass border
- Email input, location dropdown (preselected to best ping server),
  brass Send button
- POST to webhook as JSON {email, location}
- On success: form hides, success message shown
- Responsive: 3col -> 2col -> 1col
This commit is contained in:
2026-08-19 22:58:14 +00:00
parent b5c9361fc9
commit 9a87d3a5fe
3 changed files with 140 additions and 3 deletions
+47
View File
@@ -527,6 +527,18 @@ var si = 0,
/* Ping all servers, pick best, animate hero */
var results = [];
var pending = SERVERS.length;
/* Populate trial form location dropdown */
var trialLoc = document.getElementById('trialLocation');
if (trialLoc) {
SERVERS.forEach(function(s) {
var opt = document.createElement('option');
opt.value = s.host;
opt.textContent = s.city;
trialLoc.appendChild(opt);
});
}
SERVERS.forEach(function(s) {
pingServer(s.host).then(function(r) {
results.push(r);
@@ -537,6 +549,15 @@ var si = 0,
valid.sort(function(a, b) { return a.time - b.time; });
var best = valid[0];
var bestServer = SERVERS.filter(function(s) { return s.host === best.host; })[0];
/* Preselect best server in trial form */
if (trialLoc && bestServer) {
for (var i = 0; i < trialLoc.options.length; i++) {
if (trialLoc.options[i].value === bestServer.host) {
trialLoc.selectedIndex = i;
break;
}
}
}
if (bestServer && heroImages[best.host]) {
/* Highlight the matching server card */
var cards = document.querySelectorAll('.server-card');
@@ -554,6 +575,32 @@ var si = 0,
}
});
});
/* Trial form submission */
var trialForm = document.getElementById('trialForm');
if (trialForm) {
trialForm.addEventListener('submit', function(e) {
e.preventDefault();
var email = document.getElementById('trialEmail').value.trim();
var location = trialLoc.value;
if (!email) return;
var btn = trialForm.querySelector('.btn-brass');
btn.textContent = 'Sending...';
btn.disabled = true;
fetch('https://002-001-5dd6e535-4d1c-46bc-9bd9-42ad4bc5f082.odoo4projects.com/webhook/c25169c6-4234-4b47-8e74-612b9539da0a', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email: email, location: location })
}).then(function() {
trialForm.style.display = 'none';
document.getElementById('trialSuccess').classList.add('visible');
}).catch(function() {
btn.textContent = 'Send';
btn.disabled = false;
alert('Something went wrong. Please try again.');
});
});
}
})();
fetch("blog/index.json?_=" + Date.now())