pages/rejish/index.html
2020-09-30 22:55:34 +02:00

266 lines
7.1 KiB
HTML

<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Rejish Translator</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<style media="screen">
@keyframes fadeIn {
from {transform: scale(.98) rotate(1deg); filter: opacity(0);}
to {transform: scale(1); filter: opacity(1) ;}
}
html {
scrollbar-color: #2f363d #24292e;
scrollbar-width: none;
}
body::-webkit-scrollbar {
display: none;
}
body {
margin: 0;
background-color: #633173;
color: #eee;
overflow-x: hidden;
font-family: helvetica;
}
main {
display: flex;
flex-wrap: wrap;
min-height: 100vh;
animation-name: fadeIn;
animation-duration: .7s;
}
section {
min-height: calc(50vh - 80px);
display: flex;
width: 100%;
padding: 40px;
justify-content: center;
align-items: flex-end;
}
textarea {
width: 100%;
max-width: calc(100vw - 80px);
height: 100%;
padding: 40px;
margin: -40px;
border: none !important;
border-radius: 0 !important;
color: #eee;
resize: horizontal;
background-color: transparent;
font-family: sans-serif;
scrollbar-color: #24292e #2f363d;
position: sticky;
top: 0;
max-height: calc(100vh - 80px);
outline: none !important;
resize: none;
text-align: center;
vertical-align: text-bottom;
font-size: 16px;
}
p {
margin: 0;
display: block;
width: 100%;
text-align: center;
}
a {
color: white;
text-decoration: none;
background-color: #ac69c2;
padding: 8px 16px;
border-radius: 100px;
margin: 16px 0;
z-index: 5;
transition: transform .2s;
cursor: pointer;
}
a:hover {
transition: transform .1s ease;
transform: scale(1.12) !important;
}
a:active {
transition: transform .1s ease;
transform: scale(.8) !important;
}
button {
background-color: #ac69c2;
border-radius: 100px;
height: 60px;
width: 60px;
border: none;
margin: -30px;
z-index: 100;
position: relative;
font-size: 18px;
}
</style>
</head>
<body>
<main>
<section style="flex: 1 1 600px; background-color: #a42bc3; box-shadow: 0 0 50px #a42bc3, 0 -50px 0 50px #a42bc3">
<p id="output">If nothing is happening, please enable JavaScript. <br> <br> <a href="https://pages.codeberg.org/freeplay/">Created by Freeplay</a></p>
</section>
<section style="align-items: center; max-height: 0; min-height: 0; padding: 0;">
<a id="copyButton">Copy</a>
</section>
<section>
<textarea id="input" oninput="update()" name="input" placeholder="Input the text you want to be translated into Rejish! (and vice versa)" autofocus></textarea>
</section>
</main>
<script type="text/javascript">
function copyToClipboard() {
const str = document.getElementById('output').innerText;
const el = document.createElement('textarea');
const button = document.getElementById("copyButton");
el.value = str;
el.setAttribute('readonly', '');
el.style.position = 'absolute';
el.style.left = '-9999px';
document.body.appendChild(el);
el.select();
el.setSelectionRange(0, 99999);
document.execCommand('copy');
document.body.removeChild(el);
document.getElementById("input").focus();
button.innerText = "Copied!";
button.width = "100px";
button.transform = "scale(1.1) !important"
setTimeout(() => { button.innerText = "Copy"; button.width = "70px"; button.transform = "scale(1)" }, 1000)
}
function replace (match, offset, string) {
switch (match) {
default:
return match;
case 'a':
return 'z';
case 'b':
return 'x';
case 'c':
return 's';
case 'd':
return 'p';
case 'e':
return 'u';
case 'f':
return 'v';
case 'g':
return 'm';
case 'h':
return 'q';
case 'i':
return 'w';
case 'j':
return 'o';
case 'k':
return 'r';
case 'l':
return 't';
case 'm':
return 'g';
case 'n':
return 'y';
case 'o':
return 'j';
case 'p':
return 'd';
case 'q':
return 'h';
case 'r':
return 'k';
case 's':
return 'c';
case 't':
return 'l';
case 'u':
return 'e';
case 'v':
return 'f';
case 'w':
return 'i';
case 'x':
return 'b';
case 'y':
return 'n';
case 'z':
return 'a';
case 'A':
return 'Z';
case 'B':
return 'X';
case 'C':
return 'S';
case 'D':
return 'P';
case 'E':
return 'U';
case 'F':
return 'V';
case 'G':
return 'M';
case 'H':
return 'Q';
case 'I':
return 'W';
case 'J':
return 'O';
case 'K':
return 'R';
case 'L':
return 'T';
case 'M':
return 'G';
case 'N':
return 'Y';
case 'O':
return 'J';
case 'P':
return 'D';
case 'Q':
return 'H';
case 'R':
return 'K';
case 'S':
return 'C';
case 'T':
return 'L';
case 'U':
return 'E';
case 'V':
return 'F';
case 'W':
return 'I';
case 'X':
return 'B';
case 'Y':
return 'N';
case 'Z':
return 'A';
}
}
function update() {
var input = document.getElementById('input').value;
var output = document.getElementById('output');
var copyButton = document.getElementById('copyButton');
if (input === "") {
output.innerHTML = "If nothing is happening, please enable JavaScript. <br> <br> <a href='https://pages.codeberg.org/freeplay/'>Created by Freeplay</a>";
copyButton.style.transform = "scale(0)";
} else {
output.innerHTML = input.replace(/[\s\S]/g, replace).replace(/\r?\n/g, '<br />');
copyButton.style.transform = "scale(1)";
}
}
update();
document.getElementById("copyButton").onclick = function() {copyToClipboard()};
</script>
</body>
</html>