hostname editable

This commit is contained in:
DylanSpeiser-BMD 2024-07-09 10:02:58 -07:00
parent 2e6676f50b
commit 4d5e48527b
2 changed files with 17 additions and 2 deletions

View file

@ -194,7 +194,7 @@
<tr>
<td>Hostname</td>
<td>
<input type="text" placeholder="Studio-Camera-6K-Pro.local" id="hostnameInput">
<input type="text" placeholder="Studio-Camera-6K-Pro.local" id="hostnameInput" onclick="hostnameInputHandler()" onkeydown="hostnameInputHandler()">
<button onclick="initCamera()">Connect</button>
<input type="checkbox" id="secureCheckbox">
<span id="secureCheckboxLabel">Use HTTPS</span>

View file

@ -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;