-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccion.js
53 lines (33 loc) · 1.53 KB
/
accion.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
var textoOriginal = document.querySelector(".textoOriginal");
var textoEncriptado = document.querySelector(".textoEncriptado");
function btencriptar(){
const texto_Original = encriptar (textoOriginal.value );
textoEncriptado.value = texto_Original;
textoOriginal.value ="";
}
function encriptar(texto){
let matrizCodigo = [["e","enter"],["i","imes"],["a","ai"],["o","over"],["u","ufat"]];
// texto = texto.toLowerCase();
for(let i=0;i< matrizCodigo.length; i++){
if(texto.includes(matrizCodigo[i][0])){
texto = texto.replaceAll(matrizCodigo[i][0],matrizCodigo[i][1]);
}
}
return texto;
}
//----------------------------------------------------------------------------------------------------------------------
function btdesencriptar(){
const texto_Original = desencriptar (textoEncriptado.value );
textoOriginal.value = texto_Original;
textoEncriptado.value ="";
}
function desencriptar(texto){
let matrizCodigo = [["enter","e"],["imes","i"],["ai","a"],["over","o"],["ufat","u"]];
for(let i=0;i< matrizCodigo.length; i++){
if(texto.includes(matrizCodigo[i][0])){
texto = texto.replaceAll(matrizCodigo[i][0],matrizCodigo[i][1]);
}
}
return texto;
}
// textoOriginal.value = desencriptar(textoEncriptado);