-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
132 lines (108 loc) · 4.54 KB
/
index.html
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Encriptador de Texto</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://necolas.github.io/normalize.css/8.0.0/normalize.css">
<link href="https://fonts.googleapis.com/css?family=Krub:400,700" rel="stylesheet">
</head>
<body>
<header class="header">
</header>
<div class="caja"></div>
<h1><img src="imagenes/logo.png" alt="logo"></h1>
<div class="nav-bg">
<nav class="navegacion contenedor">
<a href="index.html">Inicio</a>
<a href="contacto.html">Contacto</a>
</nav>
</div>
<main>
<div class="panel">
<div class="encriptar">
<label for="input-text"></label>
<textarea type="text1" placeholder="Ingresa el Texto Aqui: " id="input-text" name="input-text" ></textarea>
<button id="encrypt-btn" style="color: white;background-color: #0A3871;">Encriptar</button>
<button id="decrypt-btn">Desencriptar</button>
</div>
<div class="desencriptar">
<label for="output-text"></label>
<textarea type="text2" placeholder="" alt="Placeholder Image" id="output-text" name="output-text" required></textarea>
<button id="copy-btn">Copiar</button>
</div>
</div>
</main>
<script>
const encryptBtn = document.getElementById('encrypt-btn');
const decryptBtn = document.getElementById('decrypt-btn');
const outputText = document.getElementById('output-text');
const inputText = document.getElementById('input-text');
const copyBtn = document.getElementById('copy-btn');
function encryptText() {
const text = inputText.value.toLowerCase();
let encryptedText = '';
for (let i = 0; i < text.length; i++) {
switch (text[i]) {
case 'e':
encryptedText += 'enter';
break;
case 'i':
encryptedText += 'imes';
break;
case 'a':
encryptedText += 'ai';
break;
case 'o':
encryptedText += 'ober';
break;
case 'u':
encryptedText += 'ufat';
break;
default:
encryptedText += text[i];
}
}
outputText.value = encryptedText;
}
function decryptText() {
const text = inputText.value.toLowerCase();
let decryptedText = '';
let i = 0;
while (i < text.length) {
if (text[i] === 'e' && text[i + 1] === 'n' && text[i + 2] === 't' && text[i + 3] === 'e' && text[i + 4] === 'r') {
decryptedText += 'e';
i += 5;
} else if (text[i] === 'i' && text[i + 1] === 'm' && text[i + 2] === 'e' && text[i + 3] === 's') {
decryptedText += 'i';
i += 4;
} else if (text[i] === 'a' && text[i + 1] === 'i') {
decryptedText += 'a';
i += 2;
} else if (text[i] === 'o' && text[i + 1] === 'b' && text[i + 2] === 'e' && text[i + 3] === 'r') {
decryptedText += 'o';
i += 4;
} else if (text[i] === 'u' && text[i + 1] === 'f' && text[i + 2] === 'a' && text[i + 3] === 't') {
decryptedText += 'u';
i += 4;
} else {
decryptedText += text[i];
i++;
}
}
outputText.value = decryptedText;
}
encryptBtn.addEventListener('click', encryptText);
decryptBtn.addEventListener('click', decryptText);
copyBtn.addEventListener('click', () => {
outputText.select();
document.execCommand('copy');
});
</script>
<footer class="footer">
<p> Designed by Alura Developed by Kwaltas © 2023 </p>
</footer>
</body>
</html>