daf95278a7
The gate loaded the calendar iframes after GHL's form_embed.js ran, so it never auto-sized them and the details step was cut off. The iframes keep their src again; book.js runs first and removes them when the page is locked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
1.3 KiB
JavaScript
29 lines
1.3 KiB
JavaScript
(function () {
|
|
// Without the lead form, drop the calendars before GHL's form_embed.js picks them up.
|
|
// The iframes keep their src in the HTML: form_embed.js only sizes iframes that already
|
|
// point at /booking when it runs, and an unsized calendar hides its confirm button.
|
|
if (document.documentElement.getAttribute('data-gate') !== 'open') {
|
|
document.querySelectorAll('iframe.ghl-cal').forEach(function (f) { f.remove(); });
|
|
return;
|
|
}
|
|
var tabs = document.querySelectorAll('[data-call]');
|
|
var select = function (id, scroll) {
|
|
tabs.forEach(function (t) {
|
|
var on = t.getAttribute('data-call') === id;
|
|
t.setAttribute('aria-selected', String(on));
|
|
var panel = document.getElementById('cal-' + t.getAttribute('data-call'));
|
|
if (panel) { if (on) panel.removeAttribute('data-off'); else panel.setAttribute('data-off', ''); }
|
|
});
|
|
if (scroll) document.getElementById('schedule').scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
};
|
|
tabs.forEach(function (t) {
|
|
t.addEventListener('click', function () {
|
|
var id = t.getAttribute('data-call');
|
|
select(id, true);
|
|
try { history.replaceState(null, '', '#' + id); } catch (e) {}
|
|
});
|
|
});
|
|
var hash = location.hash.replace('#', '');
|
|
if (hash === 'free' || hash === 'vip') select(hash, false);
|
|
})();
|