Grotti 3.2.0: Jetzt-Liste, Filament-Pause, Strom-Torte, UI-Polish.
Jetzt/Topbar und Material-Routing, Pause bei Filament-Ende, Druckbericht mit Stromanteilen, Design- und Kamera-Stream-Polish; Bedarf-Alert-Spam und Platte-belegt-Bugs behoben.
This commit is contained in:
1 parent
6e59df22e5
commit
4ddffbbeb1
68 files changed
+4348
-1215
No files matched your search
+31
-2
@@ -79,6 +79,34 @@ function withToken(url) {
|
||||
return url;
|
||||
}
|
||||
|
||||
const CAMERA_MODE_KEY = "grotti-camera";
|
||||
|
||||
function cameraMode() {
|
||||
try {
|
||||
return localStorage.getItem(CAMERA_MODE_KEY) === "stream" ? "stream" : "snapshot";
|
||||
} catch (error) {
|
||||
return "snapshot";
|
||||
}
|
||||
}
|
||||
|
||||
function setCameraMode(mode) {
|
||||
const value = mode === "stream" ? "stream" : "snapshot";
|
||||
try { localStorage.setItem(CAMERA_MODE_KEY, value); } catch (error) {}
|
||||
window.dispatchEvent(new CustomEvent("grotti-camera-mode", { detail: value }));
|
||||
return value;
|
||||
}
|
||||
|
||||
/** Snapshot oder Stream-URL je nach Browser-Einstellung. bustMs nur für Snapshot. */
|
||||
function cameraUrl(printer, bustMs) {
|
||||
if (!printer || !printer.camera) return "";
|
||||
if (cameraMode() === "stream" && printer.camera_stream) {
|
||||
return withToken(printer.camera_stream);
|
||||
}
|
||||
let url = withToken(printer.camera);
|
||||
if (bustMs) url += "&t=" + Math.floor(Date.now() / bustMs);
|
||||
return url;
|
||||
}
|
||||
|
||||
function euro(value) {
|
||||
return Number(value || 0).toLocaleString("de-DE", { style: "currency", currency: "EUR" });
|
||||
}
|
||||
@@ -247,9 +275,10 @@ function icon(name, cls) {
|
||||
return `<svg class="ico${cls ? " " + cls : ""}" aria-hidden="true"><use href="#i-${name}"/></svg>`;
|
||||
}
|
||||
|
||||
function chipHtml(state, label, small) {
|
||||
function chipHtml(state, label, small, iconName) {
|
||||
const text = label || STATE_LABELS[state] || state || "";
|
||||
return `<span class="chip ${escapeHtml(state || "")}${small ? " sm" : ""}">${escapeHtml(text)}</span>`;
|
||||
const ico = iconName ? icon(iconName, "chip-ico") : "";
|
||||
return `<span class="chip ${escapeHtml(state || "")}${small ? " sm" : ""}">${ico}${escapeHtml(text)}</span>`;
|
||||
}
|
||||
|
||||
function shownState(printer) {
|
||||
|
||||
Reference in new issue
Block a user