Skip to content

Commit 0d8bf4e

Browse files
authored
Update eleitor_point.html
1 parent 60ae361 commit 0d8bf4e

File tree

1 file changed

+202
-5
lines changed

1 file changed

+202
-5
lines changed

eleitor_point.html

Lines changed: 202 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,51 @@
2626
padding-bottom: 20px;
2727
}
2828

29+
/* Botões do Header */
30+
.botoes-header {
31+
display: flex;
32+
justify-content: center;
33+
gap: 15px;
34+
margin-top: 15px;
35+
flex-wrap: wrap;
36+
}
37+
38+
.btn-header {
39+
background: rgba(212,175,55,0.2);
40+
border: 1px solid #d4af37;
41+
color: #d4af37;
42+
padding: 10px 20px;
43+
border-radius: 15px;
44+
cursor: pointer;
45+
transition: 0.3s;
46+
font-size: 0.9rem;
47+
display: inline-flex;
48+
align-items: center;
49+
gap: 8px;
50+
}
51+
.btn-header:hover {
52+
background: rgba(212,175,55,0.4);
53+
}
54+
55+
.btn-compartilhar-header {
56+
background: linear-gradient(135deg, #d4af37, #f7ef8a);
57+
border: none;
58+
color: #050703;
59+
padding: 10px 20px;
60+
border-radius: 15px;
61+
cursor: pointer;
62+
transition: 0.3s;
63+
font-size: 0.9rem;
64+
font-weight: bold;
65+
display: inline-flex;
66+
align-items: center;
67+
gap: 8px;
68+
}
69+
.btn-compartilhar-header:hover {
70+
transform: translateY(-2px);
71+
box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
72+
}
73+
2974
/* Quadrado Principal */
3075
.quadrado-principal {
3176
background: #1a1a1a;
@@ -280,6 +325,17 @@
280325
padding: 30px;
281326
margin-top: 20px;
282327
}
328+
329+
/* Status de Compartilhamento */
330+
.status-compartilhamento {
331+
margin-top: 15px;
332+
padding: 12px;
333+
background: rgba(86, 171, 47, 0.1);
334+
border: 1px solid #56ab2f;
335+
border-radius: 10px;
336+
color: #56ab2f;
337+
display: none;
338+
}
283339
</style>
284340
</head>
285341
<body>
@@ -294,8 +350,20 @@
294350
<header>
295351
<h1>🔐 Autorizar Votos</h1>
296352
<p id="info-eleicao">Carregando informações da eleição...</p>
297-
<button onclick="abrirConfigAPI()" class="btn-confirmar" style="margin-top: 10px;">⚙️ Configurar API</button>
353+
354+
<!-- BOTÕES DO HEADER - APENAS ADICIONEI O BOTÃO DE COMPARTILHAR AQUI -->
355+
<div class="botoes-header">
356+
<button onclick="abrirConfigAPI()" class="btn-header">
357+
⚙️ Configurar API
358+
</button>
359+
360+
<button onclick="compartilharLink()" class="btn-compartilhar-header">
361+
📤 Compartilhar Link
362+
</button>
363+
</div>
364+
298365
<div id="api-status" class="api-status nao-configurada">⚠️ API: Não Configurada</div>
366+
<div id="status-compartilhamento" class="status-compartilhamento"></div>
299367
</header>
300368

301369
<!-- Modal Config API -->
@@ -569,7 +637,136 @@ <h3>✅ Voto Autorizado!</h3>
569637
});
570638
}
571639

572-
// ========== FUNÇÕES PRINCIPAIS ==========
640+
// ========== BOTÃO DE COMPARTILHAR LINK (NOVO) ==========
641+
642+
async function compartilharLink() {
643+
const statusElement = document.getElementById('status-compartilhamento');
644+
645+
// Texto para compartilhar
646+
const textoCompartilhar = `✅ AUTORIZAÇÃO DE VOTO - TERRA DOURADA
647+
648+
Sistema seguro de autorização de votos.
649+
Acesse o link abaixo para autorizar votos:
650+
651+
🔗 ${window.location.href}
652+
653+
Eleição: ${eleicaoAtual ? eleicaoAtual.name : 'Sistema de Votação'}
654+
Data: ${new Date().toLocaleDateString('pt-BR')}
655+
656+
Sistema Terra Dourada - Votação Segura e Transparente`;
657+
658+
// Verifica se a Web Share API está disponível (mobile)
659+
if (navigator.share) {
660+
try {
661+
statusElement.textContent = '📤 Abrindo opções de compartilhamento...';
662+
statusElement.style.display = 'block';
663+
664+
await navigator.share({
665+
title: '✅ Autorização de Voto - Terra Dourada',
666+
text: textoCompartilhar,
667+
url: window.location.href,
668+
});
669+
670+
statusElement.textContent = '✅ Link compartilhado com sucesso!';
671+
setTimeout(() => {
672+
statusElement.style.display = 'none';
673+
}, 3000);
674+
675+
} catch (error) {
676+
console.log('❌ Compartilhamento cancelado:', error);
677+
statusElement.textContent = 'ℹ️ Compartilhamento cancelado';
678+
setTimeout(() => {
679+
statusElement.style.display = 'none';
680+
}, 2000);
681+
}
682+
}
683+
// Fallback para desktop ou navegadores sem Web Share API
684+
else {
685+
mostrarOpcoesCompartilhamentoFallback(textoCompartilhar, window.location.href);
686+
}
687+
}
688+
689+
function mostrarOpcoesCompartilhamentoFallback(texto, url) {
690+
const statusElement = document.getElementById('status-compartilhamento');
691+
692+
// Cria um menu de opções de compartilhamento
693+
const opcoes = `
694+
<div style="text-align: center; margin: 15px 0;">
695+
<p style="color: #d4af37; margin-bottom: 15px;"><strong>Compartilhar link via:</strong></p>
696+
697+
<div style="display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;">
698+
<button onclick="compartilharWhatsApp('${texto.replace(/'/g, "\\'")}')"
699+
style="background: #25D366; color: white; border: none; padding: 12px 20px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; gap: 8px;">
700+
📱 WhatsApp
701+
</button>
702+
703+
<button onclick="compartilharEmail('${texto.replace(/'/g, "\\'")}')"
704+
style="background: #EA4335; color: white; border: none; padding: 12px 20px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; gap: 8px;">
705+
📧 Gmail
706+
</button>
707+
708+
<button onclick="compartilharTelegram('${texto.replace(/'/g, "\\'")}')"
709+
style="background: #0088cc; color: white; border: none; padding: 12px 20px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; gap: 8px;">
710+
✈️ Telegram
711+
</button>
712+
713+
<button onclick="copiarLink('${url.replace(/'/g, "\\'")}')"
714+
style="background: #d4af37; color: #050703; border: none; padding: 12px 20px; border-radius: 10px; cursor: pointer; font-weight: bold; display: flex; align-items: center; gap: 8px;">
715+
📋 Copiar Link
716+
</button>
717+
</div>
718+
</div>
719+
`;
720+
721+
statusElement.innerHTML = opcoes;
722+
statusElement.style.display = 'block';
723+
}
724+
725+
// Funções de fallback para compartilhamento
726+
function compartilharWhatsApp(texto) {
727+
const url = `https://wa.me/?text=${encodeURIComponent(texto)}`;
728+
window.open(url, '_blank');
729+
document.getElementById('status-compartilhamento').style.display = 'none';
730+
}
731+
732+
function compartilharEmail(texto) {
733+
const assunto = '✅ Autorização de Voto - Terra Dourada';
734+
const url = `mailto:?subject=${encodeURIComponent(assunto)}&body=${encodeURIComponent(texto)}`;
735+
window.location.href = url;
736+
document.getElementById('status-compartilhamento').style.display = 'none';
737+
}
738+
739+
function compartilharTelegram(texto) {
740+
const url = `https://t.me/share/url?text=${encodeURIComponent(texto)}`;
741+
window.open(url, '_blank');
742+
document.getElementById('status-compartilhamento').style.display = 'none';
743+
}
744+
745+
function copiarLink(url) {
746+
navigator.clipboard.writeText(url).then(() => {
747+
const statusElement = document.getElementById('status-compartilhamento');
748+
statusElement.innerHTML = '<div style="color: #56ab2f; text-align: center;">✅ Link copiado para a área de transferência!</div>';
749+
setTimeout(() => {
750+
statusElement.style.display = 'none';
751+
}, 2000);
752+
}).catch(() => {
753+
// Fallback para navegadores antigos
754+
const textArea = document.createElement('textarea');
755+
textArea.value = url;
756+
document.body.appendChild(textArea);
757+
textArea.select();
758+
document.execCommand('copy');
759+
document.body.removeChild(textArea);
760+
761+
const statusElement = document.getElementById('status-compartilhamento');
762+
statusElement.innerHTML = '<div style="color: #56ab2f; text-align: center;">✅ Link copiado para a área de transferência!</div>';
763+
setTimeout(() => {
764+
statusElement.style.display = 'none';
765+
}, 2000);
766+
});
767+
}
768+
769+
// ========== FUNÇÕES PRINCIPAIS (TODAS ORIGINAIS) ==========
573770

574771
async function carregarInfoEleicao() {
575772
try {
@@ -1124,7 +1321,7 @@ <h3>✅ Voto Autorizado!</h3>
11241321
if (eleicaoAtual && eleicaoAtual.tipo === 'presencial') {
11251322
document.getElementById('segunda-autorizacao').style.display = 'block';
11261323
} else {
1127-
document.getElementById('botao-autorizar').style.display = 'block';
1324+
document.getElementById('botao-autorizacao').style.display = 'block';
11281325
}
11291326
}
11301327

@@ -1137,7 +1334,7 @@ <h3>✅ Voto Autorizado!</h3>
11371334
}
11381335

11391336
segundaAutorizacaoAprovada = true;
1140-
document.getElementById('botao-autorizar').style.display = 'block';
1337+
document.getElementById('botao-autorizacao').style.display = 'block';
11411338
document.getElementById('segunda-autorizacao').style.background = 'rgba(86, 171, 47, 0.1)';
11421339
document.getElementById('segunda-autorizacao').style.borderColor = '#56ab2f';
11431340
}
@@ -1174,7 +1371,7 @@ <h3>✅ Voto Autorizado!</h3>
11741371
}
11751372

11761373
document.getElementById('resultado-autorizacao').style.display = 'block';
1177-
document.getElementById('botao-autorizar').style.display = 'none';
1374+
document.getElementById('botao-autorizacao').style.display = 'none';
11781375
}
11791376

11801377
function irParaVotacao() {

0 commit comments

Comments
 (0)