Разделение на файлы
This commit is contained in:
parent
0da4d94479
commit
e5f3bfb03d
103
assets/css/chat.css
Normal file
103
assets/css/chat.css
Normal file
@ -0,0 +1,103 @@
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
background-color: #e5e5e5;
|
||||
}
|
||||
|
||||
.chat-container {
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
height: 90vh;
|
||||
background-color: white;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.chat-header {
|
||||
background-color: #0088cc;
|
||||
color: white;
|
||||
padding: 15px;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.chat-messages {
|
||||
flex: 1;
|
||||
padding: 15px;
|
||||
overflow-y: auto;
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
|
||||
.chat-message {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.chat-message .avatar {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.chat-message .avatar img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.chat-message .message-content {
|
||||
max-width: 70%;
|
||||
background-color: white;
|
||||
padding: 10px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.chat-message .message-content .username {
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.chat-message .message-content .text {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.chat-footer {
|
||||
display: flex;
|
||||
padding: 15px;
|
||||
padding-left: 50px;
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.chat-input {
|
||||
flex: 1;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 20px;
|
||||
margin-right: 10px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.chat-send-button {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
background-color: #0088cc;
|
||||
color: white;
|
||||
border-radius: 20px;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.chat-send-button:hover {
|
||||
background-color: #007bb5;
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
.aaa {font-size: 50px}
|
||||
|
||||
.ccc .aaa {
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.ccc #bbb {
|
||||
color: green;
|
||||
}
|
@ -4,98 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Веб-Чат</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
background-color: #e5e5e5;
|
||||
}
|
||||
.chat-container {
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
height: 90vh;
|
||||
background-color: white;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.chat-header {
|
||||
background-color: #0088cc;
|
||||
color: white;
|
||||
padding: 15px;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
}
|
||||
.chat-messages {
|
||||
flex: 1;
|
||||
padding: 15px;
|
||||
overflow-y: auto;
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
.chat-message {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.chat-message .avatar {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.chat-message .avatar img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
.chat-message .message-content {
|
||||
max-width: 70%;
|
||||
background-color: white;
|
||||
padding: 10px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.chat-message .message-content .username {
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.chat-message .message-content .text {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.chat-footer {
|
||||
display: flex;
|
||||
padding: 15px;
|
||||
padding-left: 50px;
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
.chat-input {
|
||||
flex: 1;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 20px;
|
||||
margin-right: 10px;
|
||||
outline: none;
|
||||
}
|
||||
.chat-send-button {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
background-color: #0088cc;
|
||||
color: white;
|
||||
border-radius: 20px;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
}
|
||||
.chat-send-button:hover {
|
||||
background-color: #007bb5;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../css/chat.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="chat-container">
|
||||
@ -111,51 +20,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function sendMessage() {
|
||||
const chatMessages = document.getElementById('chat-messages');
|
||||
const chatInput = document.getElementById('chat-input');
|
||||
const message = chatInput.value;
|
||||
if (message.trim() !== '') {
|
||||
const messageElement = document.createElement('div');
|
||||
messageElement.classList.add('chat-message');
|
||||
|
||||
const avatarElement = document.createElement('div');
|
||||
avatarElement.classList.add('avatar');
|
||||
|
||||
const avatarImage = document.createElement('img');
|
||||
avatarImage.src = 'https://sun9-59.userapi.com/impg/t8GhZ7FkynVifY1FQCnaf31tGprbV_rfauZzgg/fSq4lyc6V0U.jpg?size=1280x1280&quality=96&sign=e3c309a125cb570d2e18465eba65f940&type=album';
|
||||
avatarElement.appendChild(avatarImage);
|
||||
|
||||
const messageContentElement = document.createElement('div');
|
||||
messageContentElement.classList.add('message-content');
|
||||
|
||||
const usernameElement = document.createElement('div');
|
||||
usernameElement.classList.add('username');
|
||||
usernameElement.textContent = 'Адель';
|
||||
|
||||
const textElement = document.createElement('div');
|
||||
textElement.classList.add('text');
|
||||
textElement.textContent = message;
|
||||
|
||||
messageContentElement.appendChild(usernameElement);
|
||||
messageContentElement.appendChild(textElement);
|
||||
|
||||
messageElement.appendChild(avatarElement);
|
||||
messageElement.appendChild(messageContentElement);
|
||||
|
||||
chatMessages.appendChild(messageElement);
|
||||
|
||||
chatInput.value = '';
|
||||
chatMessages.scrollTop = chatMessages.scrollHeight;
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('chat-input').addEventListener('keydown', function(event) {
|
||||
if (event.key === 'Enter') {
|
||||
sendMessage();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script src="../js/chat.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,60 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>This is a test</title>
|
||||
<link rel="stylesheet" href="/assets/css/test.css" >
|
||||
</head>
|
||||
<body>
|
||||
<h1> Test Test Test</h1>
|
||||
<p class="aaa"> Test Test asdasdsa Test</p>
|
||||
<div class="ccc">
|
||||
<p class="aaa"> Inside aaaa </p>
|
||||
<p id="bbb"> Iside bbbb </p>
|
||||
</div>
|
||||
|
||||
<form method="POST" action="/output" enctype="multipart/form-data">
|
||||
<label for="inp1"> Bla-bla-bla </label>
|
||||
<input type="text" name="Cool input 1+" id="inp1" class="text-input" value="Ouuups">
|
||||
|
||||
<label for="inp2"> Goot got </label>
|
||||
<input type="text" name="Cool input 2 " id="inp2" class="text-input" value="Did it for you">
|
||||
<hr>
|
||||
<label for="r-1-1">Boba</label>
|
||||
<input type="radio" id="r-1-1" name="r-1" value="First">
|
||||
<label for="r-1-2">Biba</label>
|
||||
<input type="radio" id="r-1-2" name="r-1" value="Second">
|
||||
|
||||
<label for="r-2-1">Buba</label>
|
||||
<input type="radio" id="r-2-1" name="r-2" value="Third">
|
||||
<label for="r-2-2">Duba</label>
|
||||
<input type="radio" id="r-2-2" name="r-2" value="Fourth">
|
||||
<hr>
|
||||
|
||||
<label for="chb1"> Check this </label>
|
||||
<input type="checkbox" name="Cool input 3" id="chb1" value="AAAVVVV1VVV">
|
||||
<label for="chb2"> More checkbozsdfsdsess </label>
|
||||
<input type="checkbox" name="Cool input 4" id="chb2" value="___@@@222">
|
||||
<label for="chb3"> Lmao i cbnat type stuff ia hva ee an insu=sslt </label>
|
||||
<input type="checkbox" name="Cool input 5" id="chb3" value="_down_TO">
|
||||
<hr>
|
||||
<p> Lmao, get ready to handle file input:</p>
|
||||
<input type="file" name="BEBRA" id="tututu">
|
||||
<hr>
|
||||
<input type="submit" value="SubmitButton">
|
||||
|
||||
</form>
|
||||
|
||||
<p> Ok, ima try that again</p>
|
||||
<form method="post" action="/output" enctype="multipart/form-data">
|
||||
<div>
|
||||
<label for="file">Choose a file</label>
|
||||
<input type="file" id="file" name="myFile" />
|
||||
</div>
|
||||
<div>
|
||||
<button>Send the file</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
44
assets/js/chat.js
Normal file
44
assets/js/chat.js
Normal file
@ -0,0 +1,44 @@
|
||||
function sendMessage() {
|
||||
const chatMessages = document.getElementById('chat-messages');
|
||||
const chatInput = document.getElementById('chat-input');
|
||||
const message = chatInput.value;
|
||||
if (message.trim() !== '') {
|
||||
const messageElement = document.createElement('div');
|
||||
messageElement.classList.add('chat-message');
|
||||
|
||||
const avatarElement = document.createElement('div');
|
||||
avatarElement.classList.add('avatar');
|
||||
|
||||
const avatarImage = document.createElement('img');
|
||||
avatarImage.src = 'https://sun9-59.userapi.com/impg/t8GhZ7FkynVifY1FQCnaf31tGprbV_rfauZzgg/fSq4lyc6V0U.jpg?size=1280x1280&quality=96&sign=e3c309a125cb570d2e18465eba65f940&type=album';
|
||||
avatarElement.appendChild(avatarImage);
|
||||
|
||||
const messageContentElement = document.createElement('div');
|
||||
messageContentElement.classList.add('message-content');
|
||||
|
||||
const usernameElement = document.createElement('div');
|
||||
usernameElement.classList.add('username');
|
||||
usernameElement.textContent = 'Адель';
|
||||
|
||||
const textElement = document.createElement('div');
|
||||
textElement.classList.add('text');
|
||||
textElement.textContent = message;
|
||||
|
||||
messageContentElement.appendChild(usernameElement);
|
||||
messageContentElement.appendChild(textElement);
|
||||
|
||||
messageElement.appendChild(avatarElement);
|
||||
messageElement.appendChild(messageContentElement);
|
||||
|
||||
chatMessages.appendChild(messageElement);
|
||||
|
||||
chatInput.value = '';
|
||||
chatMessages.scrollTop = chatMessages.scrollHeight;
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('chat-input').addEventListener('keydown', function (event) {
|
||||
if (event.key === 'Enter') {
|
||||
sendMessage();
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user