<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<title>AI Stories</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<style>
body {
font-family: 'Arial', sans-serif;
margin: 0;
display: flex;
flex-direction: column;
min-height: 100vh;
}
header {
background-color: #2c3e50;
color: #ecf0f1;
padding: 1rem;
text-align: center;
position: relative;
}
header .language-switch {
position: absolute;
right: 1rem;
top: 1rem;
}
main {
flex: 1;
padding: 1rem;
background-color: #ecf0f1;
display: flex;
flex-direction: column;
align-items: center;
}
#story-container {
width: 100%;
max-width: 600px;
background: #fff;
padding: 1rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
#user-input {
width: 100%;
margin-top: 1rem;
padding: 0.5rem;
font-size: 16px;
}
#submit-button {
margin-top: 1rem;
padding: 0.5rem 1rem;
background-color: #2980b9;
color: #fff;
border: none;
cursor: pointer;
font-size: 16px;
}
footer {
background-color: #2c3e50;
color: #ecf0f1;
text-align: center;
padding: 1rem;
}
@media (max-width: 600px) {
header, footer {
padding: 0.5rem;
}
}
</style>
</head>
<body>
<!-- HTML код приложения -->
<header>
<h1>AI Stories</h1>
<div class="language-switch">
<span id="switch-lang" lang="ru">EN</span>
</div>
</header>
<main>
<div id="story-container" data-lang="ru">
<p id="story-text">Здесь будет ваша история...</p>
<textarea id="user-input" placeholder="Введите ваш сюжетный поворот..."></textarea>
<button id="submit-button">Отправить</button>
</div>
</main>
<footer>
<p>© 2023 AI Stories</p>
</footer>
<script type="module">
// JavaScript код приложения с модульной структурой
import { renderStory, requestStory } from './storyModule.js';
import { handleLanguageSwitch } from './languageModule.js';
const storyContainer = document.getElementById('story-container');
const userInput = document.getElementById('user-input');
const submitButton = document.getElementById('submit-button');
const switchLangButton = document.getElementById('switch-lang');
function init() {
submitButton.addEventListener('click', () => requestStory(userInput.value));
switchLangButton.addEventListener('click', handleLanguageSwitch);
renderStory('Придумай краткое начало истории', 'ru');
}
init();
</script>
<script>
/*
Функция запроса к нейросети - определена и описана выше
Пожалуйста, скопируйте и вставьте сюда функцию requestAI
*/
</script>
</body>
</html>