-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
47 lines (42 loc) · 1.77 KB
/
script.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
//e-- > enter
//o-- > ober
//i-- > imes
//a-- > ai
//u-- > ufat
function encriptar() {
var texto = document.getElementById("inputTexto").value.toLowerCase();
// i es para que afecte tanto mayusculas como minusculas
// g toda la linea
// m para que afecte el parrafo
var txtCifrado = texto.replace(/e/img, "enter")
var txtCifrado = txtCifrado.replace(/o/img, "ober")
var txtCifrado = txtCifrado.replace(/i/img, "imes")
var txtCifrado = txtCifrado.replace(/a/img, "ai")
var txtCifrado = txtCifrado.replace(/u/img, "ufat")
document.getElementById("imgDer").style.display = "none";
document.getElementById("texto").style.display = "none";
document.getElementById("texto2").innerHTML = txtCifrado;
document.getElementById("copiar").style.display = "show";
document.getElementById("copiar").style.display = "inherit";
}
function desencriptar() {
var texto = document.getElementById("inputTexto").value.toLowerCase();
// i es para que afecte tanto mayusculas como minusculas
// g toda la linea
// m para que afecte el parrafo
var txtCifrado = texto.replace(/enter/img, "e")
var txtCifrado = txtCifrado.replace(/ober/img, "o")
var txtCifrado = txtCifrado.replace(/imes/img, "i")
var txtCifrado = txtCifrado.replace(/ai/img, "a")
var txtCifrado = txtCifrado.replace(/ufat/img, "u")
document.getElementById("imgDer").style.display = "none";
document.getElementById("texto").style.display = "none";
document.getElementById("texto2").innerHTML = txtCifrado;
document.getElementById("copiar").style.display = "show";
document.getElementById("copiar").style.display = "inherit";
}
function copy() {
var contenido = document.querySelector("#texto2");
contenido.select();
document.execCommand("copy");
}