-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
57 lines (44 loc) · 2.03 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
48
49
50
51
52
53
54
55
56
57
function buttonEncriptar() {
if (document.getElementById("textboxEncrypt").value != "") {
var textboxEncrypt = document.getElementById("textboxEncrypt").value.toLowerCase();
var textEncrypted = textboxEncrypt.replace(/e/img, "enter");
var textEncrypted = textEncrypted.replace(/i/img, "imes");
var textEncrypted = textEncrypted.replace(/a/img, "ai");
var textEncrypted = textEncrypted.replace(/o/img, "ober");
var textEncrypted = textEncrypted.replace(/u/img, "ufat");
document.getElementById("textboxDecrypt").innerHTML = textEncrypted;
document.getElementById("muneco").style.visibility = 'hidden';
document.getElementById("textoMuneco1").style.display = 'none';
document.getElementById("textoMuneco2").style.display = 'none';
document.getElementById("textboxDecrypt").style.display = 'flex';
document.getElementById("buttonCopiar").style.display = 'inline-table';
}
else{
alert("No olvides ingresar el texto a encriptar ;D.")
}
}
function buttonCopiar() {
var textCopy = document.getElementById("textboxDecrypt");
console.log(textCopy.value);
textCopy.select();
document.execCommand("copy");
alert("Texto copiado.")
// navigator.clipboard.writeText(textCopy).then(
// () => {
// alert("Copiado.")
// },
// () => {
// alert("Fallo al copiar.")
// }
// );
}
function buttonDesencriptar() {
var textboxEncrypt = document.getElementById("textboxEncrypt").value.toLowerCase();
//alert(textboxEncrypt);
var textEncrypted = textboxEncrypt.replace(/enter/img, "e");
var textEncrypted = textEncrypted.replace(/imes/img, "i");
var textEncrypted = textEncrypted.replace(/ai/img, "a");
var textEncrypted = textEncrypted.replace(/ober/img, "o");
var textEncrypted = textEncrypted.replace(/ufat/img, "u");
document.getElementById("textboxDecrypt").innerHTML = textEncrypted;
}