diff --git a/index.html b/index.html index 97f5568..3c0aa28 100644 --- a/index.html +++ b/index.html @@ -194,7 +194,7 @@ Hostname - + Use HTTPS diff --git a/web-ui.js b/web-ui.js index 2176339..dc7b71e 100644 --- a/web-ui.js +++ b/web-ui.js @@ -52,6 +52,7 @@ function initCamera() { document.getElementById("connectionErrorSpan").innerHTML = "Error "+error.code+": "+error.name+" (Your hostname is probably incorrect, hover for more details)"; } + unsavedChanges = unsavedChanges.filter((e) => {return e !== "Hostname"}); } // =============================== UI Updater ================================== @@ -64,7 +65,9 @@ function updateUIAll() { // ========== Hostname ========== - document.getElementById("hostnameInput").value = cameras[ci].hostname; + if (!unsavedChanges.includes("Hostname")) { + document.getElementById("hostnameInput").value = cameras[ci].hostname; + } // ========== Format ========== @@ -471,6 +474,18 @@ function presetInputHandler() { unsavedChanges = unsavedChanges.filter((e) => {return e !== "presets"}); } +function hostnameInputHandler() { + let newHostname = document.getElementById("hostnameInput").value; + + if (event.key === 'Enter') { + event.preventDefault; + unsavedChanges = unsavedChanges.filter((e) => {return e !== "Hostname"}); + initCamera(); + } else { + unsavedChanges.push('Hostname'); + } +} + function AEmodeInputHandler() { let AEmode = document.getElementById("AEmodeDropDown").value; let AEtype = document.getElementById("AEtypeDropDown").value;