/* eazy mobile chrome: hamburger + fullscreen menu + bottom action bar (mobile only) */ (function () { if (customElements.get('ez-mobile-chrome')) return; const HOME = 'index.html'; const LINKS = [ ['אמירנט', 'amirnet.html'], ['הקורסים', 'compare.html'], ['מתחילים בחינם', 'free.html'], ['ללמוד אנגלית', 'learn.html'], ['מחשבון פטור מאנגלית', 'technion.html'], ['עלינו', 'about.html'], ]; class EzMobileChrome extends HTMLElement { connectedCallback() { this.innerHTML = `
eazy
${LINKS.map(([t, h]) => `${t}`).join('')}
שיחת ייעוץ חינם 1-700-70-70-07
שיחת ייעוץ וואטסאפ
`; const menu = this.querySelector('.ezc-menu'); const setOpen = open => { menu.classList.toggle('open', open); document.body.style.overflow = open ? 'hidden' : ''; }; this.querySelector('.ezc-burger').addEventListener('click', () => setOpen(true)); this.querySelector('.ezc-close').addEventListener('click', () => setOpen(false)); menu.querySelectorAll('a').forEach(a => a.addEventListener('click', () => setOpen(false))); } } customElements.define('ez-mobile-chrome', EzMobileChrome); /* Runtime mobile fixes: applied directly to inline styles so they work regardless of how the runtime serializes the style attribute. */ function applyMobileFixes() { if (window.innerWidth > 820) return; document.body.style.fontSize = '20px'; document.querySelectorAll('[style]').forEach(el => { const s = el.style; // floating whatsapp button: bottom bar replaces it if (s.position === 'fixed' && el.tagName === 'A' && el.getAttribute('aria-label') === 'וואטסאפ') { s.display = 'none'; return; } // font floor (breadcrumbs stay compact) const fs = parseFloat(s.fontSize); if (s.display === 'flex' && s.gap === '8px' && fs === 13.5) { s.fontSize = '15px'; el.dataset.ezKeep = '1'; return; } if (fs && fs < 20 && el.tagName !== 'I' && !el.dataset.ezKeep) { if (el.closest('footer')) { if (fs < 16) s.fontSize = '16px'; } else if (el.closest('label')) { s.fontSize = '16px'; } else { s.fontSize = '20px'; if (!s.lineHeight || parseFloat(s.lineHeight) < 1.5) s.lineHeight = '1.55'; } } // grid collapse const g = s.gridTemplateColumns; if (g && !g.startsWith('14px')) { if (el.closest('footer')) s.gridTemplateColumns = '1fr 1fr'; else if (g.includes('repeat(10')) s.gridTemplateColumns = 'repeat(5, 1fr)'; else if (g.includes('repeat(4')) s.gridTemplateColumns = 'repeat(2, 1fr)'; else if (g.trim().split(/\s+/).length > 1 || g.includes('repeat(')) s.gridTemplateColumns = '1fr'; } // breathing room between stacked grid children if (g && s.gap && parseFloat(s.gap) < 16) s.gap = '18px'; // hero cut-out photos + decorations if (el.tagName === 'IMG') { if ((el.getAttribute('src') || '').includes('dot-cluster')) { s.display = 'none'; return; } const ih = parseFloat(s.height); if (ih && ih >= 300) { s.height = 'auto'; s.width = '64vw'; s.position = 'static'; s.margin = '0 auto'; } } if (parseFloat(s.minHeight) >= 300) s.minHeight = '0'; // primary pill CTAs go full-width for a comfortable thumb target if ((el.tagName === 'A' || el.tagName === 'BUTTON') && s.borderRadius === '999px' && parseFloat(s.fontSize) >= 14 && !el.closest('ez-mobile-chrome') && !el.closest('header') && !el.closest('#ez-exit-popup')) { s.display = 'block'; s.width = '100%'; s.textAlign = 'center'; s.boxSizing = 'border-box'; } // section gutters if (/^(SECTION|FOOTER|ARTICLE|HEADER)$/.test(el.tagName)) { if (parseFloat(s.paddingLeft) > 24 || parseFloat(s.paddingRight) > 24 || (s.padding || '').includes('64px')) { s.paddingLeft = '20px'; s.paddingRight = '20px'; } } }); } let raf = 0; const schedule = () => { cancelAnimationFrame(raf); raf = requestAnimationFrame(applyMobileFixes); }; window.addEventListener('resize', schedule); if (document.readyState !== 'loading') schedule(); else document.addEventListener('DOMContentLoaded', schedule); new MutationObserver(schedule).observe(document.documentElement, { childList: true, subtree: true }); // hydration can rewrite inline styles after the last DOM mutation settles — re-apply on a short schedule [400, 1200, 2500, 5000].forEach(t => setTimeout(schedule, t)); /* Exit-intent popup: offered once per session, unless a lead was already sent */ function initExitPopup() { if (document.getElementById('ez-exit-popup')) return; const wrap = document.createElement('div'); wrap.id = 'ez-exit-popup'; wrap.setAttribute('dir', 'rtl'); wrap.style.cssText = 'display:none;position:fixed;inset:0;z-index:300;background:rgba(26,26,32,.55);align-items:center;justify-content:center;padding:24px'; wrap.innerHTML = `
eazy
רגע לפני שיוצאים –
רוצים גישה חינמית למשחק חווייתי ללימוד אנגלית?

כולל לימוד מהשגיאות שלכם. רשמו מספר סלולרי – ותקבלו בוואטסאפ גישה למשחק ללא הגבלה.

אני מאשר/ת פנייה חוזרת ושמירת הפרטים לצורך כך בלבד, בהתאם למדיניות הפרטיות.

`; document.body.appendChild(wrap); const done = () => { wrap.style.display = 'none'; }; wrap.addEventListener('click', e => { if (e.target === wrap) done(); }); wrap.querySelector('#ez-exit-close').addEventListener('click', done); wrap.querySelector('#ez-exit-send').addEventListener('click', () => { sessionStorage.setItem('ez-lead-sent', '1'); const box = wrap.querySelector('div'); box.innerHTML = '
מעולה! בדקו את הוואטסאפ (:
'; setTimeout(done, 1800); }); // any lead-form submit on the page cancels the popup for the session document.addEventListener('click', e => { const b = e.target.closest && e.target.closest('button'); if (b && /דברו איתי/.test(b.textContent)) sessionStorage.setItem('ez-lead-sent', '1'); }, true); const shouldShow = () => !sessionStorage.getItem('ez-exit-popup-shown') && !sessionStorage.getItem('ez-lead-sent'); const show = () => { if (!shouldShow()) return; sessionStorage.setItem('ez-exit-popup-shown', '1'); wrap.style.display = 'flex'; }; // desktop: cursor leaves through the top of the window document.addEventListener('mouseout', e => { if (!e.relatedTarget && e.clientY <= 0) show(); }); // mobile: fast scroll back to the top after real engagement let maxY = 0; window.addEventListener('scroll', () => { const y = window.scrollY; maxY = Math.max(maxY, y); if (window.innerWidth <= 820 && maxY > 900 && y < 80 && maxY - y > 800) show(); }, { passive: true }); } if (document.readyState !== 'loading') initExitPopup(); else document.addEventListener('DOMContentLoaded', initExitPopup); })();