-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
91 lines (84 loc) · 2.22 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Robber's Tongue</title>
<style>
body {
text-align: center;
}
hr {
margin-bottom: 50px;
}
textarea {
font-size: large;
width: 66%;
height: 200px;
min-width: 200px;
min-height: 200px;
max-width: 700px;
margin: 10px;
}
button {
font-size: large;
width: 33%;
min-width: min-content;
max-width: 350px;
margin: 5px 0;
}
@media (prefers-color-scheme: dark) {
body {
color: #c2bfbb;
background-color: #2d2e2f;
}
textarea {
color: #c2bfbb;
background-color: #3c4042;
}
button {
color: #c2bfbb;
background-color: #3c4042;
}
}
</style>
<noscript>
<h2>But you ain't got no scripts lieutenant Dan</h2>
<h2>But you ain't got no scripts lieutenant Dan</h2>
<h2>But you ain't got no scripts lieutenant Dan</h2>
</noscript>
<script>
let consonants = "bcdfghjklmnpqrstvwxyz";
consonants += consonants.toUpperCase();
function $ (e) {
return document.querySelector(e);
}
function encode () {
let text = $(".input").value;
for (let char of consonants) {
let regex = new RegExp(char, "gm");
text = text.replace(regex, `${char}o${char.toLowerCase()}`);
}
$(".output").value = text;
};
function decode () {
let text = $(".input").value;
for (let char of consonants) {
let regex = new RegExp(`${char}o${char.toLowerCase()}`, "gm");
text = text.replace(regex, char);
}
$(".output").value = text;
}
</script>
</head>
<body>
<h1>Robber's Tongue</h1>
<hr>
<textarea class="input" placeholder="Input here..."></textarea>
<br>
<button onclick="encode()">Encode</button>
<button onclick="decode()">Decode</button>
<br>
<textarea class="output" placeholder="Output will appear here..." readonly=""></textarea>
</body>
</html>