From 8dd09d2c29eb9329a2fec64d16cf66c58d669133 Mon Sep 17 00:00:00 2001 From: Paul Wieland
Date: Wed, 13 Nov 2024 04:43:00 -0500 Subject: [PATCH] display diagram --- static/index.html | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/static/index.html b/static/index.html index 3d6ec5c..968eb95 100644 --- a/static/index.html +++ b/static/index.html @@ -296,14 +296,11 @@ var diagram_protocol = protocol.replace("v1","").replace("v2",""); var img = new Image(); - img.src = `wiring_diagrams/${hardware}_${diagram_protocol}.png`; - if(img.height !== 0){ - console.log(`diagram: ${img.src}`); - document.querySelector("#wiring_diagram").src = img.src; - }else{ - console.log(`img not found: ${img.src}`); + img.onerror = function() { + console.log(`img not found: ${this.src}`); document.querySelector("#wiring_diagram").src = "wiring_diagrams/v25iboard_secplus.png"; } + img.src = `wiring_diagrams/${hardware}_${diagram_protocol}.png`; if(protocol !== "secplusv2" && (hardware === "v2board_esp8266_d1_mini" || hardware === "v2board_esp32_d1_mini")){ alert("ratgdo version 2.0 only works with Security + 2.0");