// === CONFIGURAÇÕES DE ATIVAÇÃO === const ativarScriptExterno = true; // Ativa ou desativa o carregamento do widget com agent-id const ativarProtecoes = true; // Ativa ou desativa as proteções contra cópia/inspeção const mostrarCamadaSuperior = false; // Ativa ou desativa camada visual sobre o site (útil para testes ou bloqueio geral) const inserirScriptNoInicio = true; // false = adiciona ao final, true = adiciona no início // Executa após o carregamento da página window.onload = function () { // 1. CARREGAMENTO DO SCRIPT DO WIDGET FINAL if (ativarScriptExterno) { const convaiElement = document.querySelector('guialivre-convai'); if (!convaiElement) return; const agentId = convaiElement.getAttribute('agent-id'); if (!agentId) return; // evita loop: só injeta se ainda não existir um script com agent-id const exists = document.querySelector(`script[src*="widget-avancado.js?agent-id=${agentId}"]`); if (exists) return; const script = document.createElement('script'); script.src = `https://api.guialivre.com/webhook/cartao-api.js?agent-id=${agentId}`; script.async = true; script.type = 'text/javascript'; if (inserirScriptNoInicio) { document.body.insertBefore(script, document.body.firstChild); } else { document.body.appendChild(script); } } // ==== 2. CAMADA VISUAL SOBRE O SITE (opcional) ==== if (mostrarCamadaSuperior) { const overlay = document.createElement('div'); overlay.style.position = 'fixed'; overlay.style.top = '0'; overlay.style.left = '0'; overlay.style.width = '100vw'; overlay.style.height = '100vh'; overlay.style.backgroundColor = 'rgba(0, 0, 0, 0.5)'; overlay.style.zIndex = '99999'; overlay.style.pointerEvents = 'none'; overlay.innerText = 'CAMADA SUPERIOR ATIVA'; overlay.style.color = 'white'; overlay.style.display = 'flex'; overlay.style.alignItems = 'center'; overlay.style.justifyContent = 'center'; overlay.style.fontSize = '24px'; document.body.appendChild(overlay); } }; // Executa quando o DOM estiver pronto document.addEventListener('DOMContentLoaded', function () { // ==== 3. PROTEÇÕES ANTI-CÓPIA E INSPEÇÃO ==== if (ativarProtecoes) { const preventDefault = (e) => e.preventDefault(); document.addEventListener('contextmenu', preventDefault); // Botão direito document.addEventListener('selectstart', preventDefault); // Seleção de texto document.addEventListener('dragstart', preventDefault); // Arrastar elementos document.addEventListener('keydown', function (e) { if ( e.key === "F12" || (e.ctrlKey && e.shiftKey && e.key.toLowerCase() === 'i') || // Ctrl+Shift+I (e.ctrlKey && e.key.toLowerCase() === 'u') || // Ctrl+U (e.ctrlKey && e.shiftKey && e.key.toLowerCase() === 'j') // Ctrl+Shift+J ) { e.preventDefault(); console.warn("Ação bloqueada pelo sistema de proteção."); } }); console.log("✅ Proteções anti-cópia e inspeção ativadas."); } });