From 8056fbdb716eb9bff26eb2c63cb2ddac0f8e066a Mon Sep 17 00:00:00 2001 From: naielv <109038805+naielv@users.noreply.github.com> Date: Fri, 13 Jun 2025 16:09:16 +0200 Subject: [PATCH] added image prefetch --- index.html | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++--- sw.js | 2 +- 2 files changed, 150 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index a345469..db6ad15 100644 --- a/index.html +++ b/index.html @@ -318,7 +318,92 @@ } - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -697,7 +782,6 @@ gun.get(TABLE).get("heartbeat"), "heartbeat-" + CurrentISOTime() ); - // console.log("Beep") gun.get(TABLE).get("heartbeat").load(console.debug); }, 5000); gun.get(TABLE).on((data) => {var e = true}) @@ -708,6 +792,66 @@ } catch { console.log("ScreenLock Failed") } + function setLayeredImages(comanda, key) { + // Base paths for each layer type (adjust paths as needed) + const basePaths = { + Selección: "static/ico/layered1/", + Café: "static/ico/layered1/", + Endulzante: "static/ico/layered1/", + Cafeina: "static/ico/layered1/", + Leche: "static/ico/layered1/", + }; + + // Map for Selección to filenames + const selectionMap = { + "ColaCao con leche": "Selección-ColaCao.png", + "Infusión": "Selección-Infusion.png", + "Café con leche": "Selección-CaféLeche.png", + "Solo Leche": "Selección-Leche.png", + "Solo café (sin leche)": "Selección-CaféSolo.png", + }; + + // Start div with relative positioning for layering + let html = `
`; + + // Layer 1: Selección image + const selection = comanda["Selección"]; + if (selectionMap[selection]) { + html += ``; + } + + // Layer 2: Café + if (comanda.Café) { + html += ``; + } + + // Layer 3: Endulzante + if (comanda.Endulzante) { + html += ``; + } + + // Layer 4: Cafeina + if (comanda.Cafeina) { + html += ``; + } + // Layer 5: Leche + if (comanda.Leche) { + html += ``; + } + // Layer 6: Temperatura + if (comanda.Temperatura) { + html += ``; + } + // Layer 7: Tamaño + if (comanda.Tamaño) { + html += ``; + } + + // Close div + html += "
"; + + return html; + } function addCategory( parent, name, @@ -1815,7 +1959,6 @@ resizeInputImage( file, function (url) { - console.log(url); document.getElementById(render_foto).src = url; resized = url; }, @@ -2201,7 +2344,9 @@


-
${SC_parse(JSON.parse(data.Comanda)) +
+                        
+                          ${setLayeredImages(JSON.parse(data.Comanda), data._key)}
+                          
${SC_parse(JSON.parse(data.Comanda)) +
                   "
" + data.Notas }
@@ -2349,12 +2494,10 @@ function add_row(data, key) { if (data != null) { data["_key"] = key; - console.log(old[key], data.Estado) if (old[key] == undefined) { old[key] = ""; } if (old[key] != data.Estado) { - console.log("SC:Updated:", data) if (tts && document.getElementById(tts_check).checked) { var msg = `Comanda de ${SC_Personas[data.Persona].Region}. - ${JSON.parse(data.Comanda)["Selección"]}. - ${SC_Personas[data.Persona].Nombre}. - ${data.Estado}` console.log("TTS: " + msg) @@ -2367,7 +2510,6 @@ rows2[key] = data; old[key] = data.Estado; } else { - // console.log("delete", key); delete rows2[key]; delete old[key]; } diff --git a/sw.js b/sw.js index be42bcf..1d67954 100644 --- a/sw.js +++ b/sw.js @@ -1,4 +1,4 @@ -var cacheName = 'telesec_2025-06-13_3'; +var cacheName = 'telesec_2025-06-13_5'; self.addEventListener('install', event => { event.waitUntil(