-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
60 lines (48 loc) · 1.52 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
58
59
60
function encrypt(text) {
return text
.replace("e","enter")
.replace("i","imes")
.replace("a","ai")
.replace("o","ober")
.replace("u","ufat");
}
function decrypt(text) {
return text
.replaceAll("ufat", "u")
.replaceAll("enter", "e")
.replaceAll("imes", "i")
.replaceAll("ai", "a")
.replaceAll("ober", "o");
}
function encryptAction() {
const input = document.getElementById("input-text");
const result = document.getElementById("result");
const resultText = document.getElementById("result-text")
const noResult = document.getElementById("no-result");
let text = input.value.trim();
if(text !== ''){
resultText.value = encrypt(text);
result.hidden = false;
result.style.display = 'flex';
result.style.flexDirection = 'column';
result.style.justifyContent = 'center';
result.style.alignItems = 'center';
result.style.justifyItems = 'center';
result.style.width = '100%';
result.style.height = '100%';
noResult.hidden = true;
}
}
function decryptAction() {
const input = document.getElementById("input-text");
const resultText = document.getElementById("result-text");
let text = resultText.value.trim();
if(text !== ''){
input.value = decrypt(text);
}
}
function copy() {
const resultText = document.getElementById("result-text");
let text = resultText.value;
navigator.clipboard.writeText(text);
}