html Copy code
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Stories Deluxe</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #eef2f6;
color: #2c3e50;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
}
#language-switch {
position: absolute;
top: 20px;
right: 20px;
display: flex;
gap: 10px;
}
#language-switch button {
padding: 5px 15px;
cursor: pointer;
background-color: #3498db;
color: white;
border: none;
border-radius: 5px;
transition: background-color 0.3s;
}
#language-switch button:hover {
background-color: #2980b9;
}
h1 {
font-size: 4em;
margin: 0.5em 0;
color: #34495e;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}
#text-input {
width: 80%;
max-width: 600px;
height: 200px;
padding: 15px;
font-size: 1.2em;
margin: 20px 0;
border: 2px solid #bdc3c7;
border-radius: 5px;
resize: none;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
#generate-button {
padding: 15px 30px;
font-size: 1.5em;
cursor: pointer;
background-color: #2ecc71;
color: white;
border: none;
border-radius: 5px;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
transition: background-color 0.3s, transform 0.3s;
}
#generate-button:hover {
background-color: #27ae60;
transform: translateY(-2px);
}
</style>
</head>
<body>
<div id="language-switch">
<button id="switch-to-ru">RU</button>
<button id="switch-to-en">EN</button>
</div>
<h1 id="title">AI Stories Deluxe</h1>
<textarea id="text-input" placeholder="Введите текст тут..."></textarea>
<button id="generate-button">Придумать историю</button>
<script>
const translations = {
'ru': {
title: 'AI Истории Deluxe',
placeholder: 'Введите текст тут...',
button: 'Придумать историю'
},
'en': {
title: 'AI Stories Deluxe',
placeholder: 'Enter text here...',
button: 'Generate Story'
}
};
let currentLanguage = 'ru';
const titleElem = document.getElementById('title');
const textInputElem = document.getElementById('text-input');
const generateButtonElem = document.getElementById('generate-button');
document.getElementById('switch-to-ru').addEventListener('click', () => switchLanguage('ru'));
document.getElementById('switch-to-en').addEventListener('click', () => switchLanguage('en'));
function switchLanguage(lang) {
if (currentLanguage !== lang) {
currentLanguage = lang;
titleElem.innerText = translations[lang].title;
textInputElem.placeholder = translations[lang].placeholder;
generateButtonElem.innerText = translations[lang].button;
}
}
</script>
</body>
</html>