(function() { // Function to get all parameter cookies function getAllParameterCookies() { const cookies = {}; const allCookies = document.cookie.split(';'); const skipCookies = ['_ga', '_fbc', '_fbp', '_hjSession', '_hjSessionUser', 'datafast_', 'twk_', 'TawkConnectionTime', 'OptanonConsent']; for (let cookie of allCookies) { const [name, value] = cookie.trim().split('='); if (name && value) { const shouldSkip = skipCookies.some(skip => name.startsWith(skip)); if (!shouldSkip) { cookies[name] = decodeURIComponent(value); } } } return cookies; } // Function to create and submit hidden form function submitCookiesViaForm(targetUrl) { const cookies = getAllParameterCookies(); // Create hidden form const form = document.createElement('form'); form.method = 'POST'; form.action = targetUrl; // or a different endpoint that handles the data form.style.display = 'none'; // Add cookie data as hidden fields Object.entries(cookies).forEach(([key, value]) => { const input = document.createElement('input'); input.type = 'hidden'; input.name = key; input.value = value; form.appendChild(input); }); // Add metadata const sourceInput = document.createElement('input'); sourceInput.type = 'hidden'; sourceInput.name = 'source_url'; sourceInput.value = window.location.href; form.appendChild(sourceInput); const timestampInput = document.createElement('input'); timestampInput.type = 'hidden'; timestampInput.name = 'timestamp'; timestampInput.value = new Date().toISOString(); form.appendChild(timestampInput); // Add to page and submit document.body.appendChild(form); console.log('Submitting form with cookies:', cookies); form.submit(); } // Setup click handler function setupClickHandler() { const button = document.querySelector('a[href="https://dashboard.whatsable.app/signin"]'); if (button) { button.addEventListener('click', function(event) { event.preventDefault(); submitCookiesViaForm(this.href); }); console.log('Form submission click handler added'); } } // Setup when DOM is ready if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', setupClickHandler); } else { setupClickHandler(); } setTimeout(setupClickHandler, 1000); })();