(function () { if (window.__TGMCollectModalIframeLoadedCOLLECTAPPTESTING) return; window.__TGMCollectModalIframeLoadedCOLLECTAPPTESTING = true; function getCurrentScript() { return document.currentScript || (function () { const scripts = document.getElementsByTagName('script'); return scripts[scripts.length - 1]; })(); } function init() { const script = getCurrentScript(); if (!script || !script.parentNode) return; const hostDomain = window.location.hostname; /* ---------- Trigger Button ---------- */ const buttonText = script.getAttribute('data-button-text') || 'Open Form'; const buttonBg = script.getAttribute('data-button-bg-color') || '#ff3d57'; const buttonTextColor = script.getAttribute('data-button-text-color') || '#ffffff'; const button = document.createElement('button'); button.innerText = buttonText; button.style.padding = '0.5rem 1rem'; button.style.cursor = 'pointer'; button.style.borderRadius = '6px'; button.style.backgroundColor = buttonBg; button.style.border = 'solid 1px '+buttonBg; button.style.color = buttonTextColor; button.style.fontSize = '12px'; button.style.fontFamily = 'Inter'; button.style.width = '100%'; /* ---------- Fullscreen Iframe ---------- */ const iframe = document.createElement('iframe'); iframe.src = 'https://apps.tgmbizo.com/form/render/embed/modal/collect-app-testing' + '?origin=' + encodeURIComponent(hostDomain); iframe.style.position = 'fixed'; iframe.style.top = '0'; iframe.style.left = '0'; iframe.style.width = '100vw'; iframe.style.height = '100vh'; iframe.style.border = '0'; iframe.style.display = 'none'; iframe.style.zIndex = '99999'; iframe.loading = 'lazy'; /* ---------- Button Click ---------- */ button.addEventListener('click', function () { iframe.style.display = 'block'; }); /* ---------- Optional: Close from iframe ---------- */ window.addEventListener('message', function (event) { if (event.origin !== 'https://apps.tgmbizo.com') return; if (event.data && event.data.type === 'TGM_IFRAME_CLOSE') { iframe.style.display = 'none'; } }); /* ---------- Mount ---------- */ script.parentNode.insertBefore(button, script.nextSibling); document.body.appendChild(iframe); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); } })();