Merge pull request #1 from Lyxminxx/Sarah

Sarah
This commit is contained in:
Sarahtonin authored and GitHub committed 2025-03-22 18:15:13 +01:00
commit 051a3812b2
5 files changed
+259

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
root {
--Darkest: 40,40,40;
--Dark: 60,60,60;
--Medium: 80,80,80;
--Light: 100,100,100;
--Bright: 123,123,123;
}
main {
background-color: rgb(var(--Dark));
}
+25
View File
@@ -0,0 +1,25 @@
<html>
<head>
<title>Binarian</title>
<link rel="stylesheet" href="Binarian.css">
</head>
<body>
<header>
</header>
<main>
<input type="text" placeholder="Type input here.." id="UnbinarianInput">
<button onclick="ToBinarian(UnbinarianInput.value)">Convert</button>
<p id="BinarianOutput">This is where the converted data will arrive.</p>
</main>
<footer>
<p>Binarian made by Maddie and Sarah!</p>
</footer>
</body>
<script src="Binarian.js"></script>
</html>
+86
View File
@@ -0,0 +1,86 @@
const BinarianLetters =
{
a:"(00001)",
b:"(00010)",
c:"(00011)",
d:"(00100)",
e:"(00101)",
f:"(00110)",
g:"(00111)",
h:"(01000)",
i:"(01001)",
j:"(01010)",
k:"(01011)",
l:"(01100)",
m:"(01101)",
n:"(01110)",
o:"(01111)",
p:"(10000)",
q:"(10001)",
r:"(10010)",
s:"(10011)",
t:"(10100)",
u:"(10101)",
v:"(10110)",
w:"(10111)",
x:"(11000)",
y:"(11001)",
z:"(11010)",
æ:"(11011)",
ø:"(11100)",
å:"(11101)"
}
const Specials = /[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
function ToBinarian(Data) {
const LowerData = Data.toLowerCase();
let ArrayData = []
let TempDigits = ""
for (let Count = 0; Count < LowerData.length; Count++) {
const Character = LowerData[Count];
if (/\d/.test(Character)) {
TempDigits += Character;
}
else {
if (TempDigits) {
ArrayData.push(TempDigits);
TempDigits = ""
}
ArrayData.push(Character);
}
}
if (TempDigits) {
ArrayData.push(TempDigits);
}
let BinarianData = '';
console.log(ArrayData);
for (Count = 0; Count < ArrayData.length; Count++) {
if (/\d/.test(ArrayData[Count])) {
console.log(ArrayData[Count] + " twas a number.");
BinarianData += "[" + (((Number(ArrayData[Count]) >>> 0).toString(2)).padStart(8, '0')) + "]";
}
else {
if (Specials.test(ArrayData[Count])) {
console.log(ArrayData[Count] + " twas special.");
BinarianData += ArrayData[Count];
}
else {
console.log(ArrayData[Count] + " twas a string.");
BinarianData += BinarianLetters[ArrayData[Count]];
}
}
}
BinarianOutput.innerHTML = BinarianData;
return BinarianData;
}
+25
View File
@@ -0,0 +1,25 @@
<html>
<head>
<title>Binarian</title>
<link rel="stylesheet" href="Binarian.css">
</head>
<body>
<header>
</header>
<main>
<input type="text" placeholder="Type input here.." id="UnbinarianInput">
<button onclick="ToBinarian(UnbinarianInput.value)">Convert</button>
<p id="BinarianOutput">This is where the converted data will arrive.</p>
</main>
<footer>
<p>Binarian made by Maddie and Sarah!</p>
</footer>
</body>
<script src="Binarian.js"></script>
</html>
+112
View File
@@ -0,0 +1,112 @@
<html>
<head>
<title>Binarian</title>
<link rel="stylesheet" href="Binarian.css">
</head>
<body>
<header>
</header>
<main>
<input type="text" placeholder="Type input here.." id="UnbinarianInput">
<button onclick="ToBinarian(UnbinarianInput.value)">Convert</button>
<p id="BinarianOutput">This is where the converted data will arrive.</p>
</main>
<footer>
<p>Binarian made by Maddie and Sarah!</p>
</footer>
</body>
<script>
const BinarianLetters =
{
a:"(00001)",
b:"(00010)",
c:"(00011)",
d:"(00100)",
e:"(00101)",
f:"(00110)",
g:"(00111)",
h:"(01000)",
i:"(01001)",
j:"(01010)",
k:"(01011)",
l:"(01100)",
m:"(01101)",
n:"(01110)",
o:"(01111)",
p:"(10000)",
q:"(10001)",
r:"(10010)",
s:"(10011)",
t:"(10100)",
u:"(10101)",
v:"(10110)",
w:"(10111)",
x:"(11000)",
y:"(11001)",
z:"(11010)",
æ:"(11011)",
ø:"(11100)",
å:"(11101)"
}
const Specials = /[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
function ToBinarian(Data) {
const LowerData = Data.toLowerCase();
let ArrayData = []
let TempDigits = ""
for (let Count = 0; Count < LowerData.length; Count++) {
const Character = LowerData[Count];
if (/\d/.test(Character)) {
TempDigits += Character;
}
else {
if (TempDigits) {
ArrayData.push(TempDigits);
TempDigits = ""
}
ArrayData.push(Character);
}
}
if (TempDigits) {
ArrayData.push(TempDigits);
}
let BinarianData = '';
console.log(ArrayData);
for (Count = 0; Count < ArrayData.length; Count++) {
if (/\d/.test(ArrayData[Count])) {
console.log(ArrayData[Count] + " twas a number.");
BinarianData += "[" + (((Number(ArrayData[Count]) >>> 0).toString(2)).padStart(8, '0')) + "]";
}
else {
if (Specials.test(ArrayData[Count])) {
console.log(ArrayData[Count] + " twas special.");
BinarianData += ArrayData[Count];
}
else {
console.log(ArrayData[Count] + " twas a string.");
BinarianData += BinarianLetters[ArrayData[Count]];
}
}
}
BinarianOutput.innerHTML = BinarianData;
return BinarianData;
}
</script>
</html>