/* ========================================================================= iFLY UI v1 (shared file for the refreshed pages) Pages: What is iFLY, Birthday parties, Private events, Sydney, All Abilities. Load once, as the very first line of each page's code: v1 harmonises what is already on the pages (type, colour, spacing, buttons, bottom bar, chat bubble). It does not change any page's HTML. Spec: project doc "ifly-ui-spec.md". ========================================================================= */ (function(){ 'use strict'; if(window.IFLY_UI)return;window.IFLY_UI={version:'1.0.3'}; /* ---------- 1. Styles ---------- */ var P=':is(#ifly-ft-page,#ifly-bp-page,#ifly-cp-page,#ifly-sl-page)'; var B='body:has(#ifly-ft-page,#ifly-bp-page,#ifly-cp-page,#ifly-sl-page)'; var css=` /* Tokens */ :root{ --ifly-ui-navy:#0B1F4B; --ifly-ui-deep:#07153A; --ifly-ui-mid:#0E2A66; --ifly-ui-red:#C8102E; --ifly-ui-red-hover:#A00D25; --ifly-ui-coral:#FF9AA5; --ifly-ui-paper:#F6F4F0; --ifly-ui-rule:#D5DCEE; --ifly-ui-h1:clamp(50px,4.88vw + 31.7px,102px); --ifly-ui-h2:clamp(38px,3.19vw + 26px,72px); --ifly-ui-body:clamp(16px,.094vw + 15.65px,17px); --ifly-ui-gutter:20px; } /* Type: page headline */ ${P} h1{font-size:var(--ifly-ui-h1)!important;line-height:.98!important;letter-spacing:-.01em!important;text-transform:uppercase!important;max-width:100%;overflow-wrap:normal;text-wrap:balance} /* Type: section headings (final call to action keeps its own larger size) */ ${P} h2:not(:is(.ifly-ft-final,.ifly-bp-final,.ifly-cp-transition-final,.ifly-sl-s14,.ifly-sl-s61) h2){font-size:var(--ifly-ui-h2)!important;line-height:.95!important;letter-spacing:normal!important;text-transform:uppercase!important;text-wrap:balance} /* Type: eyebrow labels (Sydney style: red, letter-spaced, plain text, not a heading) */ ${P} :is(.ifly-ft-eyebrow,.ifly-bp-eyebrow,.ifly-cp-eyebrow,.ifly-sl-eyebrow,.ifly-sl-bt){font-size:15px!important;letter-spacing:.14em!important;text-transform:uppercase!important;font-style:italic!important;font-weight:500!important;color:var(--ifly-ui-red)} ${P} :is(.ifly-ft-dark,.ifly-bp-dark,.ifly-cp-dark,.ifly-ft-final,.ifly-bp-final,.ifly-cp-transition-final,.ifly-sl-s24,.ifly-sl-s25,.ifly-sl-s06,.ifly-sl-s14,.ifly-sl-s61,.ifly-sl-s43,[data-ifly-ui-band]) :is(.ifly-ft-eyebrow,.ifly-bp-eyebrow,.ifly-cp-eyebrow,.ifly-sl-eyebrow,.ifly-sl-bt){color:var(--ifly-ui-coral)} ${P} .ifly-sl-s02 .ifly-sl-eyebrow{color:#fff} /* Type: body text */ ${P} :is(.ifly-ft-section,.ifly-bp-section,.ifly-cp-section,.ifly-sl-sec) :is(p:not([class]),.ifly-sl-intro,.ifly-sl-s30-u9,.ifly-sl-s01-u8 p){font-size:var(--ifly-ui-body)!important;line-height:1.6!important} ${P} :is(.ifly-ft-section,.ifly-bp-section,.ifly-cp-section):not(.ifly-ft-dark,.ifly-bp-dark,.ifly-cp-dark,.ifly-ft-final,.ifly-bp-final) p:not([class]){color:var(--ifly-ui-navy)} /* No one-word last lines: newer browsers rebalance the text, the script below covers the rest */ ${P} :is(p,li,blockquote,figcaption,dd,summary){text-wrap:pretty} ${P} :is(h1,h2,h3,h4){text-wrap:balance} /* Buttons: one size everywhere */ ${P} :is(.ifly-ft-btn,.ifly-bp-btn,.ifly-cp-btn,.ifly-sl-btn):not(.ifly-sl-s61-button,.ifly-sl-visit-contact .ifly-sl-btn){font-size:17px!important;min-height:54px;padding-top:15px!important;padding-bottom:15px!important;box-sizing:border-box;border-radius:0} /* Phone side margins: 20px on every page */ @media(max-width:767px){ ${P} :is(.ifly-sl-s43-u4,#ifly-sl-aa-introduction,.ifly-sl-s30-u1,.ifly-sl-s10-u1,.ifly-sl-s31-u1,.ifly-sl-s52-u2,.ifly-sl-s25-u1){padding-left:var(--ifly-ui-gutter)!important;padding-right:var(--ifly-ui-gutter)!important;box-sizing:border-box!important;max-width:100%!important} } /* Hero buttons: hidden on phones when the hero has a quick menu (the bottom bar and header cover booking) */ @media(max-width:767px){ ${P} .ifly-sl-s43:has(.ifly-sl-quick) .ifly-sl-s43-u8{display:none!important} } /* Quick facts: label above the number in coral */ ${P} #ifly-sl-sydney-facts .ifly-sl-s06-u5{color:var(--ifly-ui-coral)!important} /* Reviews band: red, or navy when a red section sits directly above or below */ ${P} .ifly-sl-s02[data-ifly-ui-band="navy"] .ifly-sl-s02-u1{background-color:var(--ifly-ui-deep)!important;background-image:repeating-linear-gradient(115deg,rgba(255,255,255,.05) 0 2px,transparent 2px 46px),linear-gradient(110deg,var(--ifly-ui-deep) 0%,var(--ifly-ui-mid) 55%,#2C2F8C 100%)!important} /* Reviews (What is iFLY family): start each review at the top so short reviews don't float in a gap */ ${P} :is(.ifly-ft-review,.ifly-bp-review,.ifly-cp-review){justify-content:flex-start!important} /* Template: hide the redundant "Ready to go?" block (any link format) */ ${B} .section.py-4:has(> .continer.text-center > a[href$="/gifts"]):has(> .continer.text-center > a[href$="/book-now"]){display:none!important} /* ---------- Bottom bar (desktop tabs and each page's own phone bar) ---------- */ #bookingBar .nav-link .ifly-sl-tab-ic,#bookingBar .nav-link .ifly-sl-tab-short,#bookingBar .nav-link .ifly-sl-tab-full{display:none} ${B} #bookingBar.ifly-sl-tabbar{padding:6px 16px!important;background:#fff!important;border-top:1px solid #E1E5EC;box-shadow:0 -2px 12px rgba(7,21,58,.06)} ${B} #bookingBar.ifly-sl-tabbar > .nav-tabs{gap:0;max-width:640px} ${B} #bookingBar.ifly-sl-tabbar > .nav-tabs .nav-link{flex-direction:column;gap:3px;min-height:52px;padding:4px 2px!important;background:none!important;border:0!important;border-radius:8px!important;color:var(--ifly-ui-navy)!important;font-family:din-2014,sans-serif!important;font-style:normal!important;text-transform:none!important;font-size:14px!important;font-weight:600!important;line-height:1.2;letter-spacing:0!important;white-space:nowrap;transition:background-color .15s ease} ${B} #bookingBar.ifly-sl-tabbar > .nav-tabs #giftvoucher-tab{background:none!important;color:var(--ifly-ui-red)!important;font-weight:700!important} ${B} #bookingBar.ifly-sl-tabbar.ifly-tb-hasbook > .nav-tabs #giftvoucher-tab{color:var(--ifly-ui-navy)!important;font-weight:600!important} ${B} #bookingBar.ifly-sl-tabbar > .nav-tabs .nav-link.ifly-tb-book{color:var(--ifly-ui-red)!important;font-weight:700!important} ${B} #bookingBar.ifly-sl-tabbar > .nav-tabs .nav-link:hover,${B} #bookingBar.ifly-sl-tabbar > .nav-tabs #giftvoucher-tab:hover{background:#F1F3F8!important} ${B} #bookingBar.ifly-sl-tabbar > .nav-tabs .nav-link:focus-visible{outline:2px solid var(--ifly-ui-red);outline-offset:-2px} ${B} #bookingBar.ifly-sl-tabbar > .nav-tabs .nav-link span{height:auto;width:auto;margin:0;background:none} ${B} #bookingBar.ifly-sl-tabbar > .nav-tabs .nav-link .ifly-sl-tab-full{display:block} ${B} #bookingBar.ifly-sl-tabbar > .nav-tabs .nav-link .ifly-sl-tab-ic{display:block;width:24px;height:24px;line-height:0} ${B} .ifly-sl-tab-ic svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round} @media(max-width:767px){ ${B} #bookingBar.ifly-sl-tabbar{padding:6px 4px calc(6px + env(safe-area-inset-bottom,0px))!important} ${B} #bookingBar.ifly-sl-tabbar > .nav-tabs .nav-link{font-size:12px!important;min-height:48px} ${B} #bookingBar.ifly-sl-tabbar > .nav-tabs .nav-link .ifly-sl-tab-full{display:none} ${B} #bookingBar.ifly-sl-tabbar > .nav-tabs .nav-link .ifly-sl-tab-short{display:block} ${B} #bookingBar{transition:transform .35s ease,opacity .35s ease} body.ifly-ui-bar-hidden #bookingBar,body.ifly-ui-bar-hidden .ifly-tb-mbar{transform:translateY(110%)!important;opacity:0!important;pointer-events:none!important} ${B} .ifly-tb-mbar{gap:0!important;padding:6px 4px calc(6px + env(safe-area-inset-bottom,0px))!important;background:#fff!important;border-top:1px solid #E1E5EC!important;box-shadow:0 -2px 12px rgba(7,21,58,.06)!important;transition:transform .35s ease,opacity .35s ease} ${B} .ifly-tb-mbar > a{flex:1 1 0!important;flex-direction:column!important;gap:3px!important;height:auto!important;min-height:48px!important;max-height:none!important;padding:4px 2px!important;background:none!important;box-shadow:none!important;border-radius:8px!important;color:var(--ifly-ui-navy)!important;font:600 12px/1.2 din-2014,sans-serif!important;text-transform:none!important;letter-spacing:0!important;white-space:nowrap!important;-webkit-tap-highlight-color:transparent} ${B} .ifly-tb-mbar > a.ifly-tb-book{color:var(--ifly-ui-red)!important;font-weight:700!important} ${B} .ifly-tb-mbar > a:active{background:#F1F3F8!important} ${B} .ifly-tb-mbar .ifly-sl-tab-ic{display:block;width:24px;height:24px;line-height:0} } /* ---------- Chat bubble: right side, above the bar, out of the way while reading ---------- */ html ${B} iframe#launcher{left:auto!important;right:max(16px,env(safe-area-inset-right,0px))!important;bottom:80px!important;transition:opacity .25s ease,transform .25s ease!important} @media(max-width:767px){html ${B} iframe#launcher{bottom:72px!important}} html body.ifly-ui-chat-away iframe#launcher{opacity:0!important;transform:translateY(10px)!important;pointer-events:none!important} @media(prefers-reduced-motion:reduce){${B} #bookingBar,${B} .ifly-tb-mbar,html ${B} iframe#launcher{transition:none!important}} `; var style=document.createElement('style');style.id='ifly-ui-css';style.textContent=css; (document.head||document.documentElement).appendChild(style); /* ---------- 2. Behaviour (runs once the page has loaded) ---------- */ var I={ tag:'', group:'', repeat:'', gift:'', pin:'', cal:'', mail:'' }; function icon(n){return '';} var phone=window.matchMedia('(max-width:767px)'); function init(){ var root=document.querySelector('#ifly-ft-page,#ifly-bp-page,#ifly-cp-page,#ifly-sl-page');if(!root)return; /* Chat bubble: remove the old per-page rules that hid it, so Zendesk can still show and hide it itself */ Array.prototype.forEach.call(document.styleSheets,function(sh){ var rules;try{rules=sh.cssRules;}catch(e){return;} for(var i=rules.length-1;i>=0;i--){var r=rules[i]; if(r.selectorText&&/iframe#launcher/.test(r.selectorText)&&/display:\s*none/.test(r.style.cssText)&&r.parentStyleSheet!==style.sheet){try{sh.deleteRule(i);}catch(e){}}} }); /* No one-word last lines: join the last two words with a non-breaking space (skipped when the pair is too long to share a phone line) */ var TEXT='h1,h2,h3,h4,p,li,blockquote,figcaption,dd,dt,summary,label,a[class*="btn"],[class*="eyebrow"],[class*="-path-desc"]'; root.querySelectorAll(TEXT).forEach(function(el){ if(el.closest('script,style,textarea,select,[contenteditable]'))return; var w=document.createTreeWalker(el,NodeFilter.SHOW_TEXT,null),n,nodes=[]; while((n=w.nextNode()))nodes.push(n); if(!nodes.length)return; var full=nodes.map(function(x){return x.nodeValue;}).join(''),trim=full.replace(/\s+$/,''); var m=/(\S+)(\s+)(\S+)$/.exec(trim); if(!m||(m[1]+' '+m[3]).length>18)return; var start=trim.length-m[3].length-m[2].length,end=start+m[2].length,pos=0,done=false; nodes.forEach(function(x){ var v=x.nodeValue,s0=pos,e0=pos+v.length;pos=e0; if(e0<=start||s0>=end)return; var a=Math.max(start,s0)-s0,b=Math.min(end,e0)-s0; x.nodeValue=v.slice(0,a)+(done?'':'\u00A0')+v.slice(b);done=true; }); }); /* One red: swap the older reds for the brand red */ var olds=['rgb(197, 16, 46)','rgb(206, 32, 58)','rgb(219, 43, 37)','rgb(181, 27, 51)']; root.querySelectorAll('a,button,span,div,p,section').forEach(function(el){ var c=getComputedStyle(el); if(olds.indexOf(c.backgroundColor)>-1)el.style.setProperty('background-color','#C8102E'); if(olds.indexOf(c.color)>-1)el.style.setProperty('color','#C8102E'); if(olds.indexOf(c.borderTopColor)>-1&&c.borderTopWidth!=='0px')el.style.setProperty('border-color','#C8102E'); }); /* Desktop booking tabs: icons and labels */ var bar=document.getElementById('bookingBar'); if(bar&&!bar.classList.contains('ifly-sl-tabbar')){ var map={'giftvoucher-tab':['tag','Prices','Check prices'],'groupsparties-tab':['group','Groups','Groups & parties'],'returnflyers-tab':['repeat','Return flyers','Return flyers'],'redeemvoucher-tab':['gift','Vouchers','Redeem vouchers']}; Object.keys(map).forEach(function(id){var a=bar.querySelector('#'+id),m=map[id];if(a)a.innerHTML=icon(m[0])+''+m[1]+''+m[2]+'';}); var book=bar.querySelector('.nav-tabs a.bookingTab'); if(book){book.innerHTML=icon('cal')+'BookBook now';book.classList.add('ifly-tb-book');bar.classList.add('ifly-tb-hasbook');} bar.classList.add('ifly-sl-tabbar'); } /* The page's own phone bar: icons */ var mbar=root.querySelector('[class*="-mobile-booking"]'); if(mbar&&!mbar.classList.contains('ifly-tb-mbar')){ Array.prototype.forEach.call(mbar.querySelectorAll('a'),function(a){ var label=a.textContent.trim(),t=label.toLowerCase(),n=/book/.test(t)?'pin':/enquir/.test(t)?'mail':/price/.test(t)?'tag':'gift'; if(/book/.test(t))a.classList.add('ifly-tb-book'); a.innerHTML=icon(n)+''+label.replace(/^check prices$/i,'Check prices')+''; }); mbar.classList.add('ifly-tb-mbar'); } /* Phones: hide the bottom bar (and chat bubble) until the visitor scrolls past the quick menu or hero */ var cue=root.querySelector('nav[class*="mobile-chips"],.ifly-sl-quick')||root.querySelector('[class*="-hero"],.ifly-sl-s43'); var past=true,down=false; function applyChat(){document.body.classList.toggle('ifly-ui-chat-away',down||(phone.matches&&!past));} function applyBar(){document.body.classList.toggle('ifly-ui-bar-hidden',phone.matches&&!past);applyChat();} if(cue&&'IntersectionObserver' in window){ var mark=document.createElement('div');mark.setAttribute('aria-hidden','true');mark.style.cssText='height:1px;margin-top:-1px;pointer-events:none'; cue.parentNode.insertBefore(mark,cue.nextSibling); new IntersectionObserver(function(e){var r=e[0];past=!r.isIntersecting&&r.boundingClientRect.top<0;applyBar();}).observe(mark); phone.addEventListener('change',applyBar); } /* Chat bubble: fades while scrolling down, returns when scrolling stops or goes up */ /* (on phones it also stays off the hero, see applyChat above) */ var lastY=window.scrollY,idle=0; window.addEventListener('scroll',function(){ var y=window.scrollY; if(y>lastY+4)down=true;else if(y