-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
63 lines (48 loc) · 1.78 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
function btnEncriptar() {
let texto = document.getElementById('txtEncriptador').value;
texto = String(texto).replace(/e/g, 'enter');
texto = String(texto).replace(/i/g, 'imes');
texto = String(texto).replace(/a/g, 'ai');
texto = String(texto).replace(/o/g, 'ober');
texto = String(texto).replace(/u/g, 'ufat');
document.getElementById('txtEncriptado').value = texto
btnClique('encriptar');
limparCampo('txtEncriptador');
}
function btnDesencriptar() {
let texto = document.getElementById('txtEncriptador').value;
texto = String(texto).replace(/enter/g, 'e');
texto = String(texto).replace(/imes/g, 'i');
texto = String(texto).replace(/ai/g, 'a');
texto = String(texto).replace(/ober/g, 'o');
texto = String(texto).replace(/ufat/g, 'u');
document.getElementById('txtEncriptado').value = texto;
btnClique('desencriptar');
limparCampo('txtEncriptador');
}
function btnCopiar(){
const texto = document.getElementById('txtEncriptado');
navigator.clipboard.writeText(texto.value);
btnClique('copiar');
limparCampo('txtEncriptado');
}
function btnClique(id) {
let botao = document.getElementById(id);
let corOriginal = botao.style.backgroundColor;
let textoOriginal = botao.innerHTML;
let corTextoOriginal = botao.style.color;
botao.disabled = false;
botao.innerHTML = 'Feito!';
botao.style.backgroundColor = '#E5E5E5';
botao.style.color = '#0A3871'
setTimeout(() => {
botao.innerHTML = textoOriginal;
botao.style.backgroundColor = corOriginal;
botao.style.color = corTextoOriginal;
botao.disabled = false;
}, 1000);
}
function limparCampo(id) {
texto = document.getElementById(id);
texto.value = ''
}