-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
78 lines (59 loc) · 1.82 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
64
65
66
67
68
69
70
71
72
73
74
const textoIntro = document.querySelector(".text-intro");
const textoOut = document.querySelector(".text-out");
//encriptar codigo
function botonEncriptar()
{
const textoEncriptado = encriptar(textoIntro.value);
textoOut.value = textoEncriptado;
if (textoEncriptado.length>0)
{
textoIntro.value = "";
textoOut.style.backgroundImage = "none";
document.querySelector(".boxCopy").style.display = "flex";
}
}
function encriptar(stringEncriptar)
{
let letras=[["e","enter"],["i","imes"],["a","ai"],["o","ober"],["u","ufat"]];
stringEncriptar = stringEncriptar.toLowerCase();
for (let i = 0; i < letras.length; i++)
{
if (stringEncriptar.includes(letras[i][0]))
{
stringEncriptar=stringEncriptar.replaceAll(letras[i][0], letras[i][1]);
}
}
return stringEncriptar
}
//desencriptar codigo
function botonDesencriptar()
{
const textoEncriptado = desencriptar(textoIntro.value);
textoOut.value = textoEncriptado;
if (textoEncriptado.length>0)
{
textoIntro.value = "";
textoOut.style.backgroundImage = "none";
document.querySelector(".boxCopy").style.display = "flex";
}
}
function desencriptar(stringDesencriptar)
{
let letras=[["e","enter"],["i","imes"],["a","ai"],["o","ober"],["u","ufat"]];
stringDesencriptar = stringDesencriptar.toLowerCase();
for (let i = 0; i<letras.length; i++)
{
if (stringDesencriptar.includes(letras[i][1]))
{
stringDesencriptar = stringDesencriptar.replaceAll(letras[i][1], letras[i][0]);
}
}
return stringDesencriptar
}
//copiar codigo
function copiarTexto(){
const copiar = document.querySelector(".text-out");
copiar.select();
document.execCommand("copy");
botonCopiar.textContent = "copiado";
}