From 1b1bff7934f6493ab9efd3adb4ed466c3220c15c Mon Sep 17 00:00:00 2001 From: richonguzman Date: Thu, 3 Oct 2024 20:54:47 -0300 Subject: [PATCH] cleaned --- data_embed/script.js | 135 ------------------------------------------- 1 file changed, 135 deletions(-) diff --git a/data_embed/script.js b/data_embed/script.js index 6f343d0..e95525c 100644 --- a/data_embed/script.js +++ b/data_embed/script.js @@ -376,115 +376,6 @@ buzzerActiveCheckbox.addEventListener("change", function () { }); */ -/*document.querySelector(".new button").addEventListener("click", function () { - const trackersContainer = document.querySelector(".list-tracker"); - - let trackerCount = document.querySelectorAll(".network").length; - - const trackerElement = document.createElement("div"); - - trackerElement.classList.add("row", "network", "border-bottom", "py-2"); - - // Increment the name, id, and for attributes - const attributeName = `beacons.${trackerCount}`; - trackerElement.innerHTML = ` -
- - -
-
- - -
-
-
- -
-
- `; - trackersContainer.appendChild(trackerElement); - - trackerCount++; - - // Add the new network element to the end of the document - document.querySelector(".new").before(trackerElement); -});*/ - -/*document - .getElementById("action.symbol") - .addEventListener("change", function () { - const value = document.getElementById("action.symbol").value; - - document.getElementById("beacon.overlay").value = value[0]; - document.getElementById("beacon.symbol").value = value[1]; - });*/ - -/*const speedStandards = { - 300: [125, 5, 12], - 244: [125, 6, 12], - 209: [125, 7, 12], - 183: [125, 8, 12], - 610: [125, 8, 10], - 1200: [125, 7, 9], -}; - -function refreshSpeedStandard() { - const bw = Number(document.getElementById("lora.signalBandwidth").value); - const cr4 = Number(document.getElementById("lora.codingRate4").value); - const sf = Number(document.getElementById("lora.spreadingFactor").value); - - let found = false; - - for (const speed in speedStandards) { - const standard = speedStandards[speed]; - - if (standard[0] !== bw / 1000) continue; - if (standard[1] !== cr4) continue; - if (standard[2] !== sf) continue; - - document.getElementById("action.speed").value = speed; - found = true; - - break; - } - - if (!found) { - document.getElementById("action.speed").value = ""; - } -}*/ - -/*document.getElementById("lora.signalBandwidth").addEventListener("focusout", refreshSpeedStandard); -document.getElementById("lora.codingRate4").addEventListener("focusout", refreshSpeedStandard); -document.getElementById("lora.spreadingFactor").addEventListener("focusout", refreshSpeedStandard); - -document.getElementById("action.speed").addEventListener("change", function () { - const speed = document.getElementById("action.speed").value; - - if (speed !== "") { - const value = speedStandards[Number(speed)]; - - const bw = value[0]; - const cr4 = value[1]; - const sf = value[2]; - - document.getElementById("lora.signalBandwidth").value = bw * 1000; - document.getElementById("lora.codingRate4").value = cr4; - document.getElementById("lora.spreadingFactor").value = sf; - } -});*/ - - - - - - - - - - - const form = document.querySelector("form"); const saveModal = new bootstrap.Modal(document.getElementById("saveModal"), { @@ -522,8 +413,6 @@ function checkConnection() { form.addEventListener("submit", async (event) => { event.preventDefault(); - //document.getElementById("beacons").value = document.querySelectorAll(".beacons").length; - fetch(form.action, { method: form.method, body: new FormData(form), @@ -532,30 +421,6 @@ form.addEventListener("submit", async (event) => { setTimeout(checkConnection, 2000); }); -/*form.addEventListener("submit", async (event) => { - event.preventDefault(); - - // Optional: update the beacons count - // document.getElementById("beacons").value = document.querySelectorAll(".beacons").length; - - try { - const response = await fetch(form.action, { - method: form.method, - body: new FormData(form), - }); - - if (!response.ok) { - throw new Error('Form submission failed'); - } - saveModal.show(); - setTimeout(checkConnection, 2000); - - } catch (error) { - console.error(error); - // Optionally handle errors (e.g., show error modal/message) - } -});*/ - fetchSettings();