// 3) Se for HUMANO + SLUG: redireciona invisível pro WhatsApp (ultrarrápido e leve) try { // Esconde o conteúdo da página imediatamente document.documentElement.style.opacity = "0"; const central = document.getElementById("central"); if (central) central.style.display = "none"; // Já define fallback (caso a planilha demore ou falhe) let destino = `https://wa.me/${DEFAULT_NUMBER}?text=${encodeURIComponent(DEFAULT_MSG)}`; // Dispara o fetch sem bloquear o carregamento fetch(SHEET_URL, { cache: "no-store" }) .then(r => r.ok ? r.json() : []) .then(data => { const row = data.find(r => String(r.SLUG || "").trim().toLowerCase() === SLUG.toLowerCase() ); if (row) { const numero = (row.NUMERO || row["NÚMERO"] || "").toString().replace(/\D/g, ""); const mensagem = (row.MENSAGEM || DEFAULT_MSG).toString().trim(); destino = `https://wa.me/${numero}?text=${encodeURIComponent(mensagem)}`; } // Redireciona no mesmo frame, sem abrir pop-up window.location.replace(destino); }) .catch(() => window.location.replace(destino)); // Fallback rápido (máx. 500ms) — garante que mesmo offline abra o WhatsApp setTimeout(() => window.location.replace(destino), 500); } catch (err) { window.location.replace(`https://wa.me/${DEFAULT_NUMBER}?text=${encodeURIComponent(DEFAULT_MSG)}`); }