{"id":12,"date":"2026-07-11T05:05:08","date_gmt":"2026-07-11T05:05:08","guid":{"rendered":"https:\/\/id2026v1.aplicativo.email\/?page_id=12"},"modified":"2026-07-11T05:37:51","modified_gmt":"2026-07-11T05:37:51","slug":"ch-adm","status":"publish","type":"page","link":"https:\/\/id2026v1.aplicativo.email\/index.php\/ch-adm\/","title":{"rendered":"CH ADM"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"12\" class=\"elementor elementor-12\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"elementor-element elementor-element-4aa129a e-flex e-con-boxed e-con e-parent\" data-id=\"4aa129a\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-ccbb76f elementor-widget elementor-widget-html\" data-id=\"ccbb76f\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t\t<div style=\"max-width: 450px; margin: 0 auto; border: 1px solid #ddd; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif; height: 500px; box-shadow: 0 4px 10px rgba(0,0,0,0.1);\">\r\n    \r\n    <!-- Topo do Chat -->\r\n    <div style=\"background: #075e54; color: white; padding: 12px 15px; display: flex; justify-content: space-between; align-items: center;\">\r\n        <div style=\"display: flex; align-items: center; gap: 10px;\">\r\n            <div style=\"width: 35px; height: 35px; background: #dfe5e7; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 18px;\">\ud83d\udd2b<\/div>\r\n            <h3 style=\"margin: 0; font-size: 16px; font-weight: 500;\">Chat Cibern\u00e9tico<\/h3>\r\n        <\/div>\r\n        <button id=\"btn-zerar\" style=\"background: transparent; color: white; border: 1px solid rgba(255,255,255,0.4); padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 12px; transition: 0.3s;\">Zerar Chat<\/button>\r\n    <\/div>\r\n    \r\n    <!-- Tela de Mensagens (Fundo WhatsApp) -->\r\n    <div id=\"tela-chat\" style=\"flex: 1; background-color: #efeae2; background-image: url('https:\/\/user-images.githubusercontent.com\/15075759\/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png'); overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 8px;\">\r\n        <!-- Os bal\u00f5es entrar\u00e3o aqui -->\r\n    <\/div>\r\n\r\n    <!-- Barra inferior de digita\u00e7\u00e3o -->\r\n    <div style=\"background: #f0f0f0; padding: 10px; display: flex; align-items: center; gap: 8px;\">\r\n        \r\n        <!-- \u00cdcone Clipe de Papel -->\r\n        <label for=\"anexo-chat\" style=\"cursor: pointer; padding: 5px; color: #54656f; display: flex; align-items: center;\">\r\n            <svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill=\"currentColor\" d=\"M1.816 15.556v.002c0 1.502.584 2.912 1.646 3.972s2.472 1.647 3.974 1.647a5.58 5.58 0 0 0 3.972-1.645l9.547-9.548c.769-.768 1.147-1.767 1.058-2.817-.079-.968-.548-1.927-1.319-2.698-1.594-1.592-4.068-1.711-5.517-.262l-7.916 7.915c-.881.881-.792 2.25.214 3.261.959.958 2.423 1.053 3.263.215l5.511-5.512c.28-.28.267-.722.053-.936l-.244-.244c-.191-.191-.567-.349-.957.04l-5.506 5.506c-.18.18-.635.127-.976-.214-.098-.097-.576-.613-.213-.973l7.915-7.917c.818-.817 2.267-.699 3.23.262.5.501.802 1.1.849 1.685.051.573-.156 1.111-.589 1.543l-9.547 9.549a3.97 3.97 0 0 1-2.829 1.171 3.975 3.975 0 0 1-2.83-1.173 3.973 3.973 0 0 1-1.172-2.828c0-1.071.415-2.076 1.172-2.83l7.209-7.211c.157-.157.264-.579.028-.814L11.5 4.36a.572.572 0 0 0-.834.018l-7.205 7.207a5.577 5.577 0 0 0-1.645 3.971z\"><\/path><\/svg>\r\n        <\/label>\r\n        <input type=\"file\" id=\"anexo-chat\" accept=\".jpg, .jpeg, .png, .gif, .pdf, .txt\" style=\"display: none;\">\r\n        \r\n        <!-- Campo de Mensagem -->\r\n        <input type=\"text\" id=\"texto-msg\" placeholder=\"Mensagem\" style=\"flex: 1; padding: 12px 15px; border: none; border-radius: 24px; outline: none; font-size: 15px; background: white;\">\r\n        \r\n        <!-- Bot\u00e3o Seta Enviar -->\r\n        <button id=\"btn-enviar\" style=\"background: #00a884; color: white; border: none; width: 42px; height: 42px; border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: 0.2s;\">\r\n            <svg viewBox=\"0 0 24 24\" width=\"22\" height=\"22\" style=\"margin-left: 2px;\"><path fill=\"currentColor\" d=\"M1.101 21.757L23.8 12.028 1.101 2.3l.011 7.912 13.623 1.816-13.623 1.817-.011 7.912z\"><\/path><\/svg>\r\n        <\/button>\r\n    <\/div>\r\n<\/div>\r\n\r\n<script>\r\ndocument.addEventListener(\"DOMContentLoaded\", function() {\r\n    \/\/ SUAS URLs DA VALUE HOST (ATUALIZE AQUI)\r\n    const URL_PHP = \"https:\/\/id2026v1.aplicativo.email\/salvar_chat.php\";\r\n    const URL_TXT = \"https:\/\/id2026v1.aplicativo.email\/chat_log.txt\";\r\n\r\n    const telaChat = document.getElementById(\"tela-chat\");\r\n    const inputMsg = document.getElementById(\"texto-msg\");\r\n    const inputAnexo = document.getElementById(\"anexo-chat\");\r\n    const btnEnviar = document.getElementById(\"btn-enviar\");\r\n    const btnZerar = document.getElementById(\"btn-zerar\");\r\n\r\n    \/\/ Gera um ID invis\u00edvel exclusivo para este usu\u00e1rio e salva no navegador dele\r\n    let meuId = localStorage.getItem('chat_usuario_id');\r\n    if (!meuId) {\r\n        meuId = \"id-\" + Math.floor(Math.random() * 10000);\r\n        localStorage.setItem('chat_usuario_id', meuId);\r\n    }\r\n\r\n    let conteudoAnterior = \"\";\r\n\r\n    function atualizarChat() {\r\n        fetch(URL_TXT + '?nocache=' + new Date().getTime())\r\n            .then(res => res.ok ? res.text() : \"\")\r\n            .then(texto => {\r\n                if(texto.trim() === \"\") {\r\n                    telaChat.innerHTML = '<div style=\"background: rgba(255,255,255,0.8); color: #54656f; padding: 6px 12px; border-radius: 12px; font-size: 13px; align-self: center; margin-top: 20px;\">Nenhuma mensagem ainda.<\/div>';\r\n                    return;\r\n                }\r\n                \r\n                \/\/ S\u00f3 processa e renderiza se houve alguma mensagem nova\r\n                if(texto !== conteudoAnterior) {\r\n                    conteudoAnterior = texto;\r\n                    const linhas = texto.trim().split('\\n');\r\n                    let htmlFinal = '';\r\n                    \r\n                    linhas.forEach(linha => {\r\n                        if(!linha) return;\r\n                        try {\r\n                            const msg = JSON.parse(linha);\r\n                            \r\n                            \/\/ A L\u00f3gica de Ouro: Fui eu que enviei?\r\n                            const souEu = (msg.id === meuId);\r\n                            \r\n                            \/\/ Estilos Condicionais baseados em quem enviou\r\n                            const alinhamento = souEu ? 'flex-end' : 'flex-start';\r\n                            const corFundo = souEu ? '#dcf8c6' : '#ffffff';\r\n                            const arredondamento = souEu ? '12px 0px 12px 12px' : '0px 12px 12px 12px';\r\n                            \r\n                            \/\/ Formata o anexo se houver\r\n                            let anexoHtml = '';\r\n                            if(msg.anexo_url) {\r\n                                if(msg.anexo_tipo === 'imagem') {\r\n                                    anexoHtml = `<div style=\"margin-bottom:5px;\"><a href=\"${msg.anexo_url}\" target=\"_blank\"><img decoding=\"async\" src=\"${msg.anexo_url}\" style=\"max-width: 220px; width: 100%; border-radius: 6px; display: block;\"><\/a><\/div>`;\r\n                                } else {\r\n                                    anexoHtml = `<div style=\"margin-bottom:5px;\"><a href=\"${msg.anexo_url}\" target=\"_blank\" style=\"color: #027eb5; text-decoration: none; display: flex; align-items: center; gap: 5px; font-weight: bold; font-size: 13px;\">\ud83d\udcc4 Ver Documento<\/a><\/div>`;\r\n                                }\r\n                            }\r\n\r\n                            \/\/ Etiqueta de nome (s\u00f3 aparece se for de OUTRA pessoa)\r\n                            let nomeHtml = souEu ? '' : `<div style=\"font-size: 11px; color: #1fa855; font-weight: bold; margin-bottom: 2px;\">${msg.id}<\/div>`;\r\n                            \r\n                            \/\/ Monta o Bal\u00e3o\r\n                            htmlFinal += `\r\n                            <div style=\"display: flex; justify-content: ${alinhamento}; width: 100%;\">\r\n                                <div style=\"background: ${corFundo}; padding: 6px 10px; border-radius: ${arredondamento}; max-width: 80%; box-shadow: 0 1px 1px rgba(0,0,0,0.1); position: relative; min-width: 80px;\">\r\n                                    ${nomeHtml}\r\n                                    ${anexoHtml}\r\n                                    <div style=\"font-size: 14.5px; color: #111b21; word-wrap: break-word;\">${msg.mensagem}<\/div>\r\n                                    <div style=\"font-size: 11px; color: #667781; text-align: right; margin-top: 2px; height: 12px; float: right; margin-left: 10px;\">${msg.hora || ''}<\/div>\r\n                                <\/div>\r\n                            <\/div>`;\r\n                            \r\n                        } catch(e) { console.log(\"Erro ao ler linha:\", e); }\r\n                    });\r\n                    \r\n                    telaChat.innerHTML = htmlFinal;\r\n                    telaChat.scrollTop = telaChat.scrollHeight; \/\/ Desce a tela\r\n                }\r\n            });\r\n    }\r\n\r\n    setInterval(atualizarChat, 3000);\r\n    atualizarChat();\r\n\r\n    \/\/ Evento de Envio\r\n    btnEnviar.addEventListener(\"click\", function() {\r\n        const msg = inputMsg.value.trim();\r\n        const arquivo = inputAnexo.files[0];\r\n\r\n        if (msg === \"\" && !arquivo) return; \/\/ N\u00e3o envia vazio\r\n\r\n        \/\/ Feedback visual de carregamento r\u00e1pido\r\n        btnEnviar.style.opacity = \"0.5\";\r\n\r\n        const dados = new FormData();\r\n        dados.append(\"usuario_id\", meuId); \/\/ Envia o ID invis\u00edvel em vez do nome\r\n        dados.append(\"mensagem\", msg);\r\n        if (arquivo) dados.append(\"arquivo\", arquivo);\r\n\r\n        fetch(URL_PHP, { method: 'POST', body: dados })\r\n        .then(() => {\r\n            inputMsg.value = \"\";\r\n            inputAnexo.value = \"\";\r\n            btnEnviar.style.opacity = \"1\";\r\n            atualizarChat();\r\n        }).catch(() => {\r\n            btnEnviar.style.opacity = \"1\";\r\n        });\r\n    });\r\n\r\n    \/\/ Evento de Zerar\r\n    btnZerar.addEventListener(\"click\", function() {\r\n        if (confirm(\"Apagar tudo para todos?\")) {\r\n            const dados = new FormData();\r\n            dados.append(\"acao\", \"limpar\");\r\n            fetch(URL_PHP, { method: 'POST', body: dados }).then(atualizarChat);\r\n        }\r\n    });\r\n\r\n    \/\/ Enviar com Enter\r\n    inputMsg.addEventListener('keypress', function (e) {\r\n        if (e.key === 'Enter') btnEnviar.click();\r\n    });\r\n});\r\n<\/script>\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>\ud83d\udd2b Chat Cibern\u00e9tico Zerar Chat<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_canvas","meta":{"footnotes":""},"class_list":["post-12","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/id2026v1.aplicativo.email\/index.php\/wp-json\/wp\/v2\/pages\/12","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/id2026v1.aplicativo.email\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/id2026v1.aplicativo.email\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/id2026v1.aplicativo.email\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/id2026v1.aplicativo.email\/index.php\/wp-json\/wp\/v2\/comments?post=12"}],"version-history":[{"count":13,"href":"https:\/\/id2026v1.aplicativo.email\/index.php\/wp-json\/wp\/v2\/pages\/12\/revisions"}],"predecessor-version":[{"id":42,"href":"https:\/\/id2026v1.aplicativo.email\/index.php\/wp-json\/wp\/v2\/pages\/12\/revisions\/42"}],"wp:attachment":[{"href":"https:\/\/id2026v1.aplicativo.email\/index.php\/wp-json\/wp\/v2\/media?parent=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}