mirror of
https://github.com/lucaspalomodevelop/Party.git
synced 2026-03-13 00:07:21 +00:00
get chat messages
This commit is contained in:
parent
314e2edc85
commit
a5477a56a8
@ -347,13 +347,11 @@ cursor: pointer;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
#chat-container {
|
||||
max-height: 80%;
|
||||
}
|
||||
/* Chat */
|
||||
|
||||
#chatBox {
|
||||
max-height: 600px;
|
||||
border: 1px solid white;
|
||||
border-top:
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.chat-message {
|
||||
|
||||
@ -85,3 +85,8 @@ socket.on('chat-message', (data) => {
|
||||
chatBox.appendChild(message);
|
||||
chatBox.scrollTop = chatBox.scrollHeight;
|
||||
});
|
||||
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
getNChatMessages(socket, 100, 0);
|
||||
});
|
||||
|
||||
@ -1,81 +1,9 @@
|
||||
const socket = io();
|
||||
|
||||
window.addEventListener('DOMContentLoaded', function() {
|
||||
var name = sessionStorage.getItem('name'); // Den Namen aus dem SessionStorage abrufen
|
||||
|
||||
if (name) {
|
||||
document.getElementById('peter').textContent = name; // Den Namen bei dem Element mit der ID "peter" ausgeben
|
||||
}
|
||||
});
|
||||
|
||||
var divs = document.querySelectorAll('.hidden-div');
|
||||
var activeButtonIndex = null;
|
||||
|
||||
// Beim Laden der Seite den Zustand wiederherstellen
|
||||
window.addEventListener('DOMContentLoaded', function() {
|
||||
var storedIndex = sessionStorage.getItem('position');
|
||||
if (storedIndex) {
|
||||
activeButtonIndex = parseInt(storedIndex);
|
||||
toggleDiv(activeButtonIndex);
|
||||
}
|
||||
});
|
||||
|
||||
function toggleDiv(index) {
|
||||
updateButtonStatus(index);
|
||||
hideAllDivs();
|
||||
|
||||
var selectedIndex = index - 1;
|
||||
handleSwitchDiv(index);
|
||||
|
||||
divs[selectedIndex].style.display = 'block';
|
||||
|
||||
// Index im Session Storage speichern
|
||||
sessionStorage.setItem('position', index);
|
||||
}
|
||||
|
||||
function hideAllDivs() {
|
||||
for (var i = 0; i < divs.length; i++) {
|
||||
divs[i].style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
function updateButtonStatus(index) {
|
||||
for (var i = 0; i < divs.length; i++) {
|
||||
var button = document.getElementsByClassName('seitenbutton')[i];
|
||||
button.classList.remove('active-button');
|
||||
}
|
||||
|
||||
var activeButton = document.getElementsByClassName('seitenbutton')[index - 1];
|
||||
activeButton.classList.add('active-button');
|
||||
}
|
||||
|
||||
function togglePopup() {
|
||||
var popup = document.getElementById("popup");
|
||||
popup.style.display = (popup.style.display === "none") ? "block" : "none";
|
||||
}
|
||||
|
||||
function handleSwitchDiv(index) {
|
||||
// reset divs
|
||||
// 1. reset mate div
|
||||
var mate_kiste = document.getElementById('mate_kiste');
|
||||
mate_kiste.innerHTML = '';
|
||||
|
||||
switch (index) {
|
||||
case 4:
|
||||
// get previous messages
|
||||
getNChatMessages(socket, 100, 0);
|
||||
break;
|
||||
case 6: // Mate
|
||||
getMateStatus(socket);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function skipSong() {}
|
||||
function lastSong() {}
|
||||
function pausePlaySong() {}
|
||||
|
||||
|
||||
function updateClock() {
|
||||
var now = new Date();
|
||||
var hours = now.getHours();
|
||||
@ -95,16 +23,3 @@ function updateClock() {
|
||||
}
|
||||
|
||||
setInterval(updateClock, 1000);
|
||||
|
||||
function showDiv(divId) {
|
||||
const divToShow = document.getElementById(divId);
|
||||
const divs = document.querySelectorAll('div');
|
||||
|
||||
for (const div of divs) {
|
||||
div.classList.add('hidden');
|
||||
}
|
||||
|
||||
divToShow.classList.remove('hidden');
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user