-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
149 lines (131 loc) · 4.4 KB
/
index.html
File metadata and controls
149 lines (131 loc) · 4.4 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE html>
<html>
<head>
<title>Kuro Cipher</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css">
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
</style>
</head>
<body>
<div class="wrapper">
<main class="container py-5">
<div class="d-flex flex-row-reverse">
<div class="p-2">
<button type="button" id="clearTextAreas" class="btn btn-danger"><i class="bi-trash"></i> Clear</button>
</div>
</div>
<div class="row" data-masonry='{"percentPosition": true }'>
<div class="col-sm-12 col-lg-6 mb-4">
<div class="card">
<div class="card-body">
<h5 class="card-title">English Text</h5>
<textarea class="form-control" id="englishText" rows="10"></textarea>
</div>
</div>
</div>
<div class="col-sm-12 col-lg-6 mb-4">
<div class="card">
<div class="card-body">
<h5 class="card-title">Encoded Text</h5>
<textarea class="form-control" id="encodedText" rows="10" ></textarea>
</div>
</div>
</div>
</div>
</main>
<nav class="navbar fixed-bottom navbar-expand-sm navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">Kuro Cipher</a>
</div>
</nav>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js" integrity="sha384-LtrjvnR4Twt/qOuYxE721u19sVFLVSA4hf/rRt6PrZTmiPltdZcI7q7PXQBYTKyf" crossorigin="anonymous"></script>
<script type="text/javascript">
$( document ).ready(function() {
$("#englishText").keyup(function(e) {
let value = $("#englishText").val();
var result = encodeCipher(value);
$("#encodedText").val(result);
})
$("#encodedText").keyup(function(e) {
let value = $("#encodedText").val();
var result = decodeCipher(value);
$("#englishText").val(result);
})
$("#clearTextAreas").click(function(e) {
$("#encodedText").val('');
$("#englishText").val('');
})
let encodeCipher = (str) => {
//Deciphered reference letters
let encoded = {
a: '⅃', b: 'ⵡ', c: 'L',
d: 'コ', e: 'ロ', f: 'ⵎ',
g: 'ᒣ', h: 'П', i: 'ᒥ',
j: 'ᒲ ', k: '⨃', l: 'ᒷ',
m: 'ᑔ', n: '⚀', o: 'Ͼ',
p: 'ךּ', q: '⩀', r: '⟔',
s: 'ⴸ', t: 'く', u: 'ᨈ',
v: '>', w: 'ᨉ', x: 'ᑅ',
y: 'ᨊ', z: 'ᐷ'
}
//convert the string to lowercase
str = str.toLowerCase();
//encode the code
let cipher = '';
for(let i = 0 ; i < str.length; i++){
if (str[i] in encoded) {
cipher += encoded[str[i]];
} else {
cipher += str[i];
}
}
//return the output
return cipher;
}
let decodeCipher = (str) => {
//Deciphered reference letters
let decoded = {
'⅃': 'a', 'ⵡ': 'b', 'L': 'c',
'コ': 'd', 'ロ': 'e', 'ⵎ': 'f',
'ᒣ': 'g', 'П': 'h', 'ᒥ': 'i',
'ᒲ' : 'j', '⨃': 'k', 'ᒷ': 'l',
'ᑔ': 'm', '⚀': 'n', 'Ͼ': 'o',
'ךּ': 'p', '⩀': 'q', '⟔': 'r',
'ⴸ': 's', 'く': 't', 'ᨈ': 'u',
'>': 'v', 'ᨉ': 'w', 'ᑅ': 'x',
'ᨊ': 'y', 'ᐷ': 'z'
}
//convert the string to lowercase
str = str.toLowerCase();
//encode the code
let decipher = '';
for(let i = 0 ; i < str.length; i++){
if (str[i] in decoded) {
decipher += decoded[str[i]];
} else {
decipher += str[i];
}
}
//return the output
return decipher;
}
});
</script>
</body>
</html>