, , as literal // strings anywhere in this script. Third-party Shopify apps (e.g. // discount-scheduler) scan the raw page HTML with naive string.replace // on those tokens and inject their HTML right inside our JS strings, // producing a SyntaxError from the embedded newline. // Solution: write an implicit-structure HTML document — no , // , or closing tags needed. Browsers always create those elements // even when absent from the markup. var docParts = [ '', '', '', css ? '' : '', body, ]; var doc = docParts.join(''); var iframe = document.createElement('iframe'); iframe.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;' + 'border:none;z-index:2147483647;display:block;'; iframe.setAttribute('scrolling', 'yes'); document.documentElement.style.overflow = 'hidden'; document.body.innerHTML = ''; document.body.style.cssText = 'margin:0;padding:0;overflow:hidden;'; document.body.appendChild(iframe); document.body.classList.remove('bc-checking'); var preload = document.getElementById('block-country-preload'); if (preload) preload.remove(); // srcdoc is the cleanest approach; fall back to contentDocument.write try { iframe.srcdoc = doc; } catch (e) { var id = iframe.contentDocument || (iframe.contentWindow && iframe.contentWindow.document); if (id) { id.open(); id.write(doc); id.close(); } } return; } // Legacy CSS-class fallback var overlay = document.createElement('div'); overlay.id = 'block-country-overlay'; overlay.className = 'block-country-fullpage'; overlay.innerHTML = createBlockContent(design); overlay.style.cssText = 'position:fixed;top:0;left:0;right:0;bottom:0;width:100%;height:100%;' + 'z-index:999999;display:flex;align-items:center;justify-content:center;' + 'background-color:' + (design.backgroundColor || '#FFFFFF') + ';' + 'color:' + (design.textColor || '#000000') + ';' + (design.backgroundImage ? 'background-image:url(' + JSON.stringify(design.backgroundImage) + ');' + 'background-size:cover;background-position:center;' : ''); document.body.innerHTML = ''; document.body.appendChild(overlay); document.body.classList.remove('bc-checking'); var preload = document.getElementById('block-country-preload'); if (preload) preload.remove(); if (design.customCss) { var st = document.createElement('style'); st.textContent = design.customCss; document.head.appendChild(st); } } // ── Popup block ───────────────────────────────────────────────────────── function showPopupBlock(design) { showContent(); document.body.style.overflow = 'hidden'; var modal = document.createElement('div'); modal.id = 'block-country-modal'; modal.className = 'block-country-popup'; var contentBg = (design.backgroundColor || '#FFFFFF') + ';color:' + (design.textColor || '#000000') + (design.backgroundImage ? ';background-image:url(' + JSON.stringify(design.backgroundImage) + ');background-size:cover;background-position:center' : ''); modal.innerHTML = '
' + '
' + createBlockContent(design) + '
'; var ms = document.createElement('style'); ms.textContent = '.block-country-popup{position:fixed;top:0;left:0;right:0;bottom:0;z-index:999999;' + 'display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.6)}' + '.block-country-popup-backdrop{position:absolute;top:0;left:0;right:0;bottom:0;' + 'background:rgba(0,0,0,0.95);backdrop-filter:blur(4px)}' + '.block-country-popup-content{position:relative;max-width:500px;padding:40px;' + 'border-radius:12px;box-shadow:0 20px 60px rgba(0,0,0,0.3);text-align:center}'; document.head.appendChild(ms); document.body.appendChild(modal); if (design.customCss) { var cs = document.createElement('style'); cs.textContent = design.customCss; document.head.appendChild(cs); } } // ── Banner block ───────────────────────────────────────────────────────── function showBannerBlock(design) { showContent(); var banner = document.createElement('div'); banner.id = 'block-country-banner'; banner.className = 'block-country-banner'; var btnHtml = design.buttonText && design.buttonUrl ? '' + escHtml(design.buttonText) + '' : ''; banner.innerHTML = '
' + '' + escHtml(design.title || 'Access Restricted') + '' + '' + escHtml(design.message || '') + '' + btnHtml + '
'; var bs = document.createElement('style'); bs.textContent = '.block-country-banner{position:fixed;top:0;left:0;right:0;z-index:999999;' + 'background-color:' + (design.backgroundColor || '#dc3545') + ';' + 'color:' + (design.textColor || '#FFFFFF') + ';' + 'padding:16px;text-align:center;box-shadow:0 2px 10px rgba(0,0,0,0.2)}' + '.block-country-banner-content{display:flex;align-items:center;justify-content:center;' + 'gap:16px;flex-wrap:wrap}' + '.block-country-banner-btn{padding:8px 16px;background:' + (design.textColor || '#FFFFFF') + ';' + 'color:' + (design.backgroundColor || '#dc3545') + ';' + 'text-decoration:none;border-radius:4px;font-weight:600}' + 'body{padding-top:60px!important}'; document.head.appendChild(bs); document.body.insertBefore(banner, document.body.firstChild); if (design.customCss) { var cs = document.createElement('style'); cs.textContent = design.customCss; document.head.appendChild(cs); } } // ── Helpers ────────────────────────────────────────────────────────────── function createBlockContent(design) { var c = '
'; if (design.logoUrl) { c += ''; } c += ''; c += '

' + escHtml(design.title || 'Access Restricted') + '

'; c += '

' + escHtml(design.message || 'Access to this store is restricted from your location.') + '

'; if (design.subMessage) { c += '

' + escHtml(design.subMessage) + '

'; } if (design.buttonText && design.buttonUrl) { c += '' + escHtml(design.buttonText) + ''; } c += '
'; return c; } function escHtml(s) { if (!s) return ''; return String(s) .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, '''); } })();

Contact Us

We'd love to hear from you. Our team is here to help.
Let your customers get in touch with you by filling out the email form below.

Ce site est protégé par hCaptcha, et la Politique de confidentialité et les Conditions de service de hCaptcha s’appliquent.