From 4c70d7be8f5330a09f8e2e9ede44ee8a228b0e86 Mon Sep 17 00:00:00 2001 From: chk <79915315+ChKendel@users.noreply.github.com> Date: Sun, 14 Jun 2026 14:05:28 +0200 Subject: [PATCH] neue json Struktur --- public/WebService.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/public/WebService.js b/public/WebService.js index c6580c7..216ee6b 100755 --- a/public/WebService.js +++ b/public/WebService.js @@ -152,6 +152,22 @@ console.log("FShow content received, length", content.length); const el = document.querySelector("textarea#GCodeWindow.editor-look"); if (el) el.value = content; + } else if (data.startsWith("{")) { + try { + const json = JSON.parse(data); + if (json.programId === "log" && Array.isArray(json.lines)) { + console.log("FShow JSON received, lines:", json.lines.length, "cursor:", json.cursor); + const el = document.getElementById("GCodeWindow"); + if (el) { + el.value = json.lines.join("\n"); + // Scroll to cursor line + const lineHeight = el.scrollHeight / json.lines.length; + el.scrollTop = Math.max(0, (json.cursor - 5)) * lineHeight; + } + } + } catch (e) { + console.log("DATA:", Date.now() - startTime, data); + } } else { console.log("DATA:", Date.now() - startTime, data); }