Compare commits
8 Commits
4a88a5c810
...
message_bo
| Author | SHA1 | Date | |
|---|---|---|---|
| f4e06bc29a | |||
| a47d56b8c8 | |||
|
|
36787704d7 | ||
|
|
5f51e4930d | ||
| 4c3acfa2d0 | |||
|
|
231c2160d6 | ||
| 73354440c7 | |||
|
|
226deb4df3 |
@@ -5,19 +5,23 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Message Board</title>
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="logos/favicon/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="logos/favicon/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="logos/favicon/favicon-16x16.png">
|
||||
<script src="https://cdn.jsdelivr.net/npm/pocketbase/dist/pocketbase.umd.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Message Board</h1>
|
||||
<form id="messageForm">
|
||||
<input type="text" id="name" placeholder="Your Name" required>
|
||||
<textarea id="message" placeholder="Your Message" maxlength="100" required></textarea>
|
||||
<div id="charCount">0 / 100</div>
|
||||
<button type="submit">Send</button>
|
||||
</form>
|
||||
<div id="messages">
|
||||
<!-- Nachrichten werden hier dynamisch geladen -->
|
||||
</div>
|
||||
<form id="messageForm">
|
||||
<input type="text" id="name" placeholder="Your Name" required>
|
||||
<textarea id="message" placeholder="Your Message" required></textarea>
|
||||
<button type="submit">Send</button>
|
||||
</form>
|
||||
</div>
|
||||
<script src="message-board.js"></script>
|
||||
</body>
|
||||
|
||||
@@ -4,7 +4,7 @@ const messageForm = document.getElementById('messageForm');
|
||||
|
||||
// Funktion, um die letzten 10 Nachrichten zu laden
|
||||
async function loadMessages() {
|
||||
const result = await pb.collection('message_board').getList(1, 10, {
|
||||
const result = await pb.collection('message_board').getList(1, 8, {
|
||||
sort: '-created', // Sortiert nach Erstellungsdatum absteigend
|
||||
});
|
||||
|
||||
@@ -40,3 +40,12 @@ messageForm.addEventListener('submit', async (e) => {
|
||||
|
||||
// Nachrichten beim Laden der Seite anzeigen
|
||||
loadMessages();
|
||||
|
||||
const messageInput = document.getElementById('message');
|
||||
const charCount = document.getElementById('charCount');
|
||||
|
||||
// Event-Listener für Eingaben im Textfeld
|
||||
messageInput.addEventListener('input', () => {
|
||||
const currentLength = messageInput.value.length;
|
||||
charCount.textContent = `${currentLength} / 100`;
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ body {
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center; /* Zentriert die Links im Container */
|
||||
align-items: center; /* Zentriert die Inhalte im Container */
|
||||
}
|
||||
|
||||
h1 {
|
||||
@@ -50,3 +50,68 @@ h1 {
|
||||
height: 20px; /* Höhe des Logos */
|
||||
margin-right: 8px; /* Abstand zwischen Logo und Text */
|
||||
}
|
||||
|
||||
.message {
|
||||
background: #f9f9f9;
|
||||
padding: 10px;
|
||||
margin: 10px 0;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.message strong {
|
||||
font-size: 16px;
|
||||
color: #007BFF;
|
||||
}
|
||||
|
||||
.message p {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.message small {
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center; /* Zentriert die Form-Inhalte horizontal */
|
||||
gap: 10px;
|
||||
width: 100%; /* Maximale Breite der Form */
|
||||
}
|
||||
|
||||
form input, form textarea {
|
||||
width: 90%; /* Eingabefelder nehmen 90% der Breite ein */
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
box-sizing: border-box; /* Verhindert, dass Padding die Größe beeinflusst */
|
||||
}
|
||||
|
||||
form textarea {
|
||||
height: 100px; /* Größeres Textfeld */
|
||||
resize: none; /* Deaktiviert Größenänderungen durch den Benutzer */
|
||||
}
|
||||
|
||||
form button {
|
||||
width: 50%; /* Sende-Knopf nimmt 50% der Form-Breite ein */
|
||||
padding: 10px;
|
||||
background: #007BFF;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s;
|
||||
}
|
||||
|
||||
form button:hover {
|
||||
background: #0056b3;
|
||||
}
|
||||
|
||||
#charCount {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
text-align: right; /* Rechtsbündig unter dem Textfeld */
|
||||
width: 90%;
|
||||
}
|
||||
Reference in New Issue
Block a user