-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathengine.js
46 lines (43 loc) · 1.86 KB
/
engine.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
function encrypt (){
var text = document.querySelector("#inputText").value;
if (text !== text.toLowerCase()) {
alert("ERROR SUPER HIPER DUPER MEGA FATAL: Solo letras minúsculas");
return;
}
if (text.match(/[^a-z ]/i)) {
alert("ERROR SUPER HIPER DUPER MEGA FATAL: No incluyas caracteres especiales ni acentos.");
return;
}
var cipherText = text
.replace(/e/g, "enter")
.replace(/i/g, "imes")
.replace(/a/g, "ai")
.replace(/o/g, "ober")
.replace(/u/g, "ufat");
document.querySelector(".textOutput").value = cipherText;
document.querySelector(".inputText").value;
textOutput.style.background = "none";
}
var button1 = document.querySelector("#encrypt"); button1.onclick = encrypt;
function decrypt (){
var text = document.querySelector("#inputText").value;
var cipherText = text
.replace(/enter/g, "e")
.replace(/imes/g, "i")
.replace(/ai/g, "a")
.replace(/ober/g, "o")
.replace(/ufat/g, "u");
document.querySelector(".textOutput").value = cipherText;
document.querySelector(".inputText").value;
}
var button2 = document.querySelector("#decrypt"); button2.onclick = decrypt;
/*
_ _ _ _ _ _
| | | | (_) | | (_| |
_ __ ___ __ _ __| | ___ | |__ _ _ ___ _ _ __| | ___ _ __ ___ __ _ _| | __
| '_ ` _ \ / _` |/ _` |/ _ \ | '_ \| | | | / __| | '__| |/ _ | '_ ` _ \ / _` | | |/ /
| | | | | | (_| | (_| | __/ | |_) | |_| | \__ | | | | | __| | | | | | (_| | | |
|_| |_| |_|\__,_|\__,_|\___| |_.__/ \__, | |___|_|_| |_|\___|_| |_| |_|\__,_|_|_|\_\
__/ |
|___/
*/