mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-25 06:48:03 +01:00
test2
This commit is contained in:
parent
7f9933ae16
commit
c91b1423a4
1 changed files with 208 additions and 149 deletions
|
@ -18,6 +18,7 @@
|
|||
-->
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>PokeTranslate</title>
|
||||
<link rel="icon" href="/static/yt-ukraine.svg">
|
||||
|
@ -30,116 +31,158 @@
|
|||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<link rel="stylesheet" href="/static/calendar-page-style.css">
|
||||
<style>
|
||||
body {
|
||||
background-color: #212529;
|
||||
color: #f8f9fa;
|
||||
font-family: sans-serif;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
width: 100%;
|
||||
padding: 1em;
|
||||
background-color: #1a1a1a;
|
||||
border-radius: 1em;
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
header {
|
||||
text-align: center;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
form {
|
||||
display: grid;
|
||||
gap: 1.5em;
|
||||
}
|
||||
|
||||
.languages {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 1em;
|
||||
}
|
||||
|
||||
select {
|
||||
border-radius: 1em;
|
||||
padding: 10px;
|
||||
background-color: #131618;
|
||||
color: #f8f9fa;
|
||||
border: 2px solid #495057;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
resize: vertical;
|
||||
padding: 1em;
|
||||
font-size: 1rem;
|
||||
border-radius: 1em;
|
||||
border: 2px solid #495057;
|
||||
background-color: #131618;
|
||||
color: #f8f9fa;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 10px 20px;
|
||||
font-size: 1rem;
|
||||
border: 2px solid #888888;
|
||||
.wrap {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.wrap.languages {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.item {
|
||||
width: 100%;
|
||||
height: 150px;
|
||||
border-radius: 0.5em;
|
||||
}
|
||||
|
||||
.item-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 450px;
|
||||
margin: 5px 10px;
|
||||
}
|
||||
|
||||
button,
|
||||
select,
|
||||
input,
|
||||
textarea {
|
||||
border-radius: 1em;
|
||||
padding: 10px;
|
||||
background-color: #131618;
|
||||
border: 2px solid #495057;
|
||||
color: #f8f9fa;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #478061;
|
||||
body {
|
||||
justify-content: center;
|
||||
font-family: sans-serif;
|
||||
background-color: #2c2f33;
|
||||
color: #f8f9fa;
|
||||
}
|
||||
|
||||
#translation-form {
|
||||
background-color: #1f2023;
|
||||
border-radius: 1em;
|
||||
padding: 20px;
|
||||
width: 90%;
|
||||
max-width: 800px;
|
||||
margin: auto;
|
||||
box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #5bc0de;
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
#definitions_and_translations {
|
||||
display: grid;
|
||||
width: 100%;
|
||||
grid-template-areas: "definitions translations";
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1200px) {
|
||||
#definitions_and_translations {
|
||||
display: grid;
|
||||
grid-template-areas:
|
||||
"definitions definitions"
|
||||
"translations translations";
|
||||
}
|
||||
}
|
||||
|
||||
div.definitions,
|
||||
div.translations {
|
||||
padding: 10px;
|
||||
background-color: #3a3f44;
|
||||
border-radius: 0.5em;
|
||||
}
|
||||
|
||||
textarea:focus,
|
||||
input:focus,
|
||||
button:focus {
|
||||
border-color: #478061;
|
||||
color: #ffffff;
|
||||
outline: 1px solid #478061;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #599bf6;
|
||||
}
|
||||
|
||||
/* Additional styles to match the calendar page */
|
||||
header {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#switchbutton {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
button {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.center button {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
/* Responsive design */
|
||||
@media screen and (max-width: 768px) {
|
||||
.container {
|
||||
padding: 1em;
|
||||
#translation-form {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.languages {
|
||||
.wrap {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
button {
|
||||
.item-wrapper {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<% if (isMobile) { %>
|
||||
<style>
|
||||
body {
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
<% } %>
|
||||
|
||||
<% if (!isMobile) { %>
|
||||
<style>
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
<% } %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<header>
|
||||
<div id="translation-form">
|
||||
<header class="center">
|
||||
<h1>PokeTranslate</h1>
|
||||
</header>
|
||||
|
||||
|
||||
<% const languageOptions = [
|
||||
{ code: 'autodetect', name: 'Autodetect' },
|
||||
{ code: 'af', name: 'Afrikaans' },
|
||||
|
@ -203,7 +246,7 @@
|
|||
{ code: 'km', name: 'Khmer' },
|
||||
{ code: 'rw', name: 'Kinyarwanda' },
|
||||
{ code: 'kok', name: 'Konkani' },
|
||||
{ code: 'ko', name: 'Korean' },
|
||||
{ code: 'ko', name: 'Korean (PROK)' },
|
||||
{ code: 'kri', name: 'Krio' },
|
||||
{ code: 'ku', name: 'Kurdish (Kurmanji)' },
|
||||
{ code: 'sd', name: 'Sindhi' },
|
||||
|
@ -236,45 +279,56 @@
|
|||
{ code: 'yo', name: 'Yoruba' },
|
||||
{ code: 'zu', name: 'Zulu' }
|
||||
]; %>
|
||||
|
||||
|
||||
<form action="/translate" method="GET" id="translation-form">
|
||||
<div class="languages">
|
||||
<!-- Source language select -->
|
||||
<select name="from_language" id="from_language" aria-label="Source language">
|
||||
<!-- from and to language -->
|
||||
<div class="wrap languages">
|
||||
<div class="language">
|
||||
<select name="from_language" id="from_language">
|
||||
<% languageOptions.forEach(language => { %>
|
||||
<option value="<%= language.code %>" <%= language.code === (from_language || 'autodetect') ? 'selected' : '' %>><%= language.name %></option>
|
||||
<option value="<%= language.code %>" <%= language.code === (from_language || 'autodetect') ? 'selected' : '' %>>
|
||||
<%= language.name %>
|
||||
</option>
|
||||
<% }); %>
|
||||
</select>
|
||||
|
||||
<!-- Target language select -->
|
||||
<select name="to_language" id="to_language" aria-label="Target language">
|
||||
<select name="to_language" id="to_language">
|
||||
<% languageOptions.slice(1).forEach(language => { %>
|
||||
<option value="<%= language.code %>" <%= language.code === to_language ? 'selected' : '' %>><%= language.name %></option>
|
||||
<option value="<%= language.code %>" <%= language.code === to_language ? 'selected' : '' %>>
|
||||
<%= language.name %>
|
||||
</option>
|
||||
<% }); %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<textarea autofocus class="item" id="input" name="input" dir="auto" placeholder="<%- text %>"><%- text %></textarea>
|
||||
<!-- text boxes -->
|
||||
<div class="wrap">
|
||||
<div class="item-wrapper">
|
||||
<textarea autofocus class="item" id="input" name="input" dir="auto" placeholder="<%- text %>">
|
||||
<%- text %>
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
<textarea id="output" class="translation item" dir="auto" placeholder="Translation" readonly><%- translation %></textarea>
|
||||
<div class="item-wrapper">
|
||||
<textarea id="output" class="translation item" dir="auto" placeholder="Translation" readonly>
|
||||
<%- translation %>
|
||||
</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="center">
|
||||
<!-- translate button -->
|
||||
<button type="submit">Translate :3</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Submit the translation form when pressing Ctrl/Meta+Enter while focused on the input text field
|
||||
document.getElementById("input").addEventListener("keydown", function (event) {
|
||||
if (event.keyCode === 13 && (event.metaKey || event.ctrlKey)) {
|
||||
document.getElementById("translation-form").submit();
|
||||
}
|
||||
});
|
||||
|
||||
// Auto resize textarea to fit words inside it without the need to scroll
|
||||
var input = document.getElementById("input");
|
||||
var output = document.getElementById("output");
|
||||
input.setAttribute("style", "height:" + output.scrollHeight + "px;overflow-y:scroll;");
|
||||
|
@ -286,4 +340,9 @@
|
|||
</script>
|
||||
<script src="/static/custom-css.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue