added tls fallback and auto pause in log window

This commit is contained in:
2026-03-12 00:14:32 +01:00
parent dc8ff7a406
commit eaa0c2bcbe
3 changed files with 48 additions and 8 deletions
+31 -3
View File
@@ -32,8 +32,12 @@
.btn.secondary { background: #1E1E2E; border: 1px solid #333; }
.btn.secondary:hover { background: #2A2A3E; }
.log-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.log-header h2 { margin-bottom: 0; }
.pause-hint { font-size: 11px; color: #FFD60A; display: none; }
.pause-hint.visible { display: inline; }
.log-box { background: #080810; border: 1px solid #1E1E2E; border-radius: 6px;
height: 300px; overflow-y: auto; padding: 8px; font-size: 11px; line-height: 1.6; }
height: 300px; overflow-y: auto; padding: 8px; font-size: 11px; line-height: 1.6; position: relative; }
.log-entry { white-space: pre-wrap; word-break: break-all; }
.log-entry.error { color: #FF6B6B; }
.log-entry.warn { color: #FFD60A; }
@@ -94,14 +98,38 @@
<!-- Verbindungslog -->
<div class="card" style="margin-top:12px">
<h2>Verbindungslog</h2>
<div class="log-header">
<h2>Verbindungslog</h2>
<span>
<span class="pause-hint" id="pause-hint">Autoscroll pausiert</span>
<button class="btn secondary" id="btn-scroll" onclick="resumeScroll()" style="display:none;padding:4px 10px;font-size:11px">Nach unten</button>
</span>
</div>
<div class="log-box" id="log-box"></div>
</div>
<script>
const logBox = document.getElementById('log-box');
const chatBox = document.getElementById('chat-box');
const pauseHint = document.getElementById('pause-hint');
const btnScroll = document.getElementById('btn-scroll');
let ws;
let logAutoScroll = true;
// Autoscroll pausiert wenn User hochscrollt
logBox.addEventListener('scroll', () => {
const atBottom = logBox.scrollHeight - logBox.scrollTop - logBox.clientHeight < 30;
logAutoScroll = atBottom;
pauseHint.classList.toggle('visible', !atBottom);
btnScroll.style.display = atBottom ? 'none' : 'inline';
});
function resumeScroll() {
logAutoScroll = true;
logBox.scrollTop = logBox.scrollHeight;
pauseHint.classList.remove('visible');
btnScroll.style.display = 'none';
}
const STATUS_LABELS = {
connected: 'Verbunden',
@@ -202,7 +230,7 @@
el.className = `log-entry ${level}`;
el.textContent = `${time} [${source}] ${message}`;
logBox.appendChild(el);
logBox.scrollTop = logBox.scrollHeight;
if (logAutoScroll) logBox.scrollTop = logBox.scrollHeight;
}
function addChat(type, text, meta) {