diff --git a/src/layout.mjs b/src/layout.mjs index d5c4b05..3b68a63 100644 --- a/src/layout.mjs +++ b/src/layout.mjs @@ -279,6 +279,5 @@ ${scripts} export const GHL_SCRIPT = ''; export const ghlForm = (id, name) => ``; -// Calendars start without a src: book.js loads them once the visitor has sent the lead form. export const ghlCalendar = (id, title) => - ``; + ``; diff --git a/src/pages/book.mjs b/src/pages/book.mjs index 5f7afa1..f88a25f 100644 --- a/src/pages/book.mjs +++ b/src/pages/book.mjs @@ -34,7 +34,8 @@ export default { `, title: 'Book Your Call | Dylan Mazzei', description: 'Book a free 15-minute intro call with Dylan Mazzei’s team or a 15-minute 1:1 session with Dylan.', - scripts: GHL_SCRIPT + '\n', + // book.js before form_embed.js, so a locked page removes the calendars first. + scripts: '\n' + GHL_SCRIPT, body: `
diff --git a/static/assets/book.js b/static/assets/book.js index cd9345a..f9423ed 100644 --- a/static/assets/book.js +++ b/static/assets/book.js @@ -1,6 +1,11 @@ (function () { - if (document.documentElement.getAttribute('data-gate') !== 'open') return; - document.querySelectorAll('iframe[data-src]').forEach(function (f) { f.src = f.getAttribute('data-src'); }); + // 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) {