-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
55 lines (38 loc) · 1.43 KB
/
Copy pathscript.js
File metadata and controls
55 lines (38 loc) · 1.43 KB
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
const textoIngresado = document.querySelector("#texto");
const textoResultado = document.querySelector("#textoResultado");
const btnEncriptar = document.querySelector("#encri");
const btnDesencriptar = document.querySelector("#desencri");
const btnCopiar = document.querySelector("#copiar");
function encriptar (){
let texto = textoIngresado.value.toLowerCase();
let textoEncriptado = texto
.replaceAll("e", "enter")
.replaceAll("i", "imes")
.replaceAll("o", "ober")
.replaceAll("a", "ai")
.replaceAll("u", "ufat");
document.getElementById("noResuelto").style.visibility = "hidden";
document.getElementById("copiar").style.visibility = "visible";
textoResultado.value = textoEncriptado;
document.getElementById("texto").value = '';
}
function desencriptar (){
let textoEncriptado = textoIngresado.value.toLowerCase();
let texto = textoEncriptado
.replaceAll("enter", "e")
.replaceAll("imes", "i")
.replaceAll("ober", "o")
.replaceAll("ai", "a")
.replaceAll("ufat", "u");
document.getElementById("noResuelto").style.visibility = "hidden";
document.getElementById("copiar").style.visibility = "visible";
textoResultado.value = texto;
document.getElementById("texto").value = '';
}
function copiar () {
let textoEncriptado = textoResultado.value;
navigator.clipboard.writeText(textoEncriptado);
}
btnEncriptar.onclick = encriptar;
btnDesencriptar.onclick = desencriptar;
btnCopiar.onclick = copiar;