Compare commits

...

4 Commits

4 changed files with 123 additions and 64 deletions

View File

@ -1,40 +1,43 @@
{% ELDEF main JSON pres JSON userinfo %} {% ELDEF main JSON pres JSON userinfo %}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="ru"> <html lang="ru">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Веб-Чат</title> <title>Веб-Чат</title>
<link rel="stylesheet" href="/assets/css/chat.css"> <link rel="stylesheet" href="/assets/css/chat.css">
</head> </head>
<body> <body>
<div class="chat-container"> <div class="chat-container">
<div class="chat-header"> <div class="chat-header">
<span class="room-name">Веб чат</span> <span class="room-name" id="room-name">Веб чат</span>
<button class="members" onclick="openMembersList()">Показать участников</button> <button class="members" onclick="openMembersList()">Показать участников</button>
</div> <button class="edit-chat" onclick="editChat()">Редактировать чат</button>
<div class="chat-messages" id="chat-messages"> <button class="exit-chat" onclick="exitChat()">Выйти</button>
<!-- Сообщения чата будут здесь -->
</div> </div>
<div class="chat-footer"> <div class="chat-messages" id="chat-messages">
<input type="text" class="chat-input" id="chat-input" placeholder="Введите сообщение..."> <!-- Сообщения чата будут здесь -->
<button class="chat-send-button" onclick="sendMessage()">Отправить</button> </div>
</div> <div class="chat-footer">
</div> <input type="text" class="chat-input" id="chat-input" placeholder="Введите сообщение...">
<div class="overlay" id="overlay"> <button class="chat-send-button" onclick="sendMessage()">Отправить</button>
<div class="members-list" id="members-list"> </div>
<div class="members-list-header"> </div>
<span class="close" onclick="closeMembersList()">&times;</span> <div class="overlay" id="overlay">
<h2 class="all-members">Все участники</h2> <div class="members-list" id="members-list">
</div> <div class="members-list-header">
<div class="members-list-body"> <span class="close" onclick="closeMembersList()">&times;</span>
<ul id="members-list-body"> <h2 class="all-members">Все участники</h2>
<!-- Список участников будет добавлен динамически --> </div>
</ul> <div class="members-list-body">
</div> <ul id="members-list-body">
</div> <!-- Список участников будет добавлен динамически -->
</div> </ul>
<script src="/assets/js/chat.js"></script> </div>
</body> </div>
</html> </div>
{% ENDELDEF %} <script src="/assets/js/chat.js"></script>
</body>
</html>
{% ENDELDEF %}

View File

@ -199,4 +199,42 @@ body {
} }
.chat-send-button:hover { .chat-send-button:hover {
background-color: #007bb5; background-color: #007bb5;
} }
.room-name {
position: absolute;
left: 40%;
font-size: 24px;
}
.edit-chat {
border: none;
position: absolute;
left: 70%;
border-radius: 10px;
cursor: pointer;
width: 150px;
background-color: #f7f7f7;
height: 25px;
transition: background-color 0.3s ease;
}
.edit-chat:hover {
background-color: #ffcc00;
}
.exit-chat {
border: none;
position: absolute;
left: 90%;
border-radius: 10px;
cursor: pointer;
width: 150px;
background-color: #f7f7f7;
height: 25px;
transition: background-color 0.3s ease;
}
.exit-chat:hover {
background-color: #dc3545;
}

View File

@ -1,62 +1,67 @@
dy { body {
font-family: Arial, sans-serif; font-family: Arial, sans-serif;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 100vh; height: 100vh;
margin: 0; margin: 0;
background-color: #e5e5e5; background-color: #ffffff;
} }
.form-container { .form-container {
width: 100%; width: 100%;
max-width: 400px; max-width: 450px;
background-color: white; background-color: #0c39ce;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
border-radius: 8px; border-radius: 12px;
padding: 40px; padding: 50px;
text-align: center; text-align: center;
color: white;
transform: translateY(-40px);
} }
h1 { h1 {
margin-bottom: 20px; margin-bottom: 20px;
color: #2F4F4F; color: white;
} }
input { input {
width: 100%; width: calc(100% - 50px);
background: #f7f7f7; background: #f0f0f0;
font-size: 16px; font-size: 16px;
padding: 10px; padding: 12px;
border: 1px solid #ddd; border: 1px solid #ccc;
border-radius: 20px; border-radius: 20px;
margin-bottom: 15px; margin-bottom: 20px;
outline: none; outline: none;
color: black;
margin-left: 25px;
} }
button { button {
width: 100%; width: calc(100% - 50px);
padding: 15px; padding: 15px;
border: none; border: none;
background-color: #0088cc; background-color: #024a7e;
color: white; color: white;
border-radius: 20px; border-radius: 20px;
cursor: pointer; cursor: pointer;
outline: none; outline: none;
font-size: 16px; font-size: 18px;
font-weight: bold; font-weight: bold;
transition: background-color 0.3s; transition: background-color 0.3s;
margin-left: 25px;
} }
button:hover, button:hover,
button:focus-visible { button:focus-visible {
background-color: #007bb5; background-color: #28a745;
} }
.hide-cursor::placeholder { .hide-cursor::placeholder {
color: #000; color: #777;
} }
.hide-cursor { .hide-cursor {
@ -64,13 +69,13 @@ button:focus-visible {
} }
.no-select { .no-select {
-webkit-user-select: none; /* Для Safari */ -webkit-user-select: none;
-moz-user-select: none; /* Для Firefox */ -moz-user-select: none;
user-select: none; /* Для всех остальных браузеров */ user-select: none;
} }
div { div {
color: red; color: rgba(255, 0, 0, 0.911);
font-size: 15px; font-size: 15px;
margin-top: 10px; margin-top: 10px;
display: none; display: none;

View File

@ -68,7 +68,7 @@ async function sendMessage() {
const usernameElement = document.createElement('div'); const usernameElement = document.createElement('div');
usernameElement.classList.add('username'); usernameElement.classList.add('username');
usernameElement.textContent = await getUserName(); usernameElement.textContent = await getUserName(); // Отображение имени пользователя
const textElement = document.createElement('div'); const textElement = document.createElement('div');
textElement.classList.add('text'); textElement.classList.add('text');
@ -88,6 +88,7 @@ async function sendMessage() {
} }
} }
function openMembersList() { function openMembersList() {
renderMembersList(); renderMembersList();
document.getElementById("members-list").style.display = "block"; document.getElementById("members-list").style.display = "block";
@ -157,6 +158,18 @@ async function editMessage(new_message) {
currentHistoryId = response.update[0].HistoryId; currentHistoryId = response.update[0].HistoryId;
} }
} }
function editChat() {
const newName = prompt("Введите новое имя комнаты:");
if (newName) {
document.getElementById('room-name').textContent = newName;
}
}
function exitChat() {
window.location.href = 'list-rooms.nytl.html';
}
document.addEventListener("DOMContentLoaded", async function() { document.addEventListener("DOMContentLoaded", async function() {
currentChatID = await getChatID(); currentChatID = await getChatID();
}); });