pages/fox-lang/index.html
Freeplay f29de7b7b0 AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
2023-01-09 19:26:13 -05:00

224 lines
6.5 KiB
HTML

<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Fox 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: #ea5800;
color: #eee;
overflow-x: hidden;
font-family: helvetica system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
main {
display: flex;
flex-wrap: wrap;
min-height: 100vh;
animation-name: fadeIn;
animation-duration: .7s;
}
section {
min-height: calc(50vh - 80px);
display: flex;
width: 0;
flex-grow: 1;
padding: 40px;
justify-content: center;
align-items: flex-end;
max-width: 100%;
}
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;
font-weight: 600;
white-space: pre-wrap;
word-break: break-word;
}
a {
color: white;
text-decoration: none;
background-color: #ff8b25;
padding: 8px 16px;
border-radius: 100px;
margin: 16px 0;
z-index: 5;
transition: transform .2s;
cursor: pointer;
font-weight: 600;
}
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: #ff7a2a; box-shadow: #ff8300 0px 0px 50px, rgb(226, 74, 0) 0px -50px 0px 50px; --darkreader-inline-bgcolor: #83229c; --darkreader-inline-boxshadow: #83229c 0px 0px 50px, #83229c 0px -50px 0px 50px;">
<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="width: 100%; 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 fox-lang! (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 'b':
case 'c':
case 'd':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
case 'B':
case 'C':
case 'D':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
return "Fox";
case 'F':
case 'f':
return "FOX";
case 'e':
case 'E':
return "EEEEEE";
case 'a':
case 'A':
return "AAAAAA"
}
}
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>