-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add comms to config page and small code refactor #153
Conversation
html/config.html
Outdated
</tr> | ||
|
||
<tr> | ||
<td>Bluetooth Enablued</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*Bluetooth Enabled
though kind of funny to leave as EnaBLUEd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, should probably fix it..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor things to fix, have approved 👍
html/config.html
Outdated
<td><input type="text" id="input-comms-protect-species"></td> | ||
</tr> | ||
<tr> | ||
<td>Protect Species</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*Protect Duration
static/js/config.js
Outdated
"bluetooth": document.querySelector("#input-comms-bluetooth").checked, | ||
"power-output": document.querySelector("#input-comms-power-output").value || undefined, | ||
"power-up-duration": document.querySelector("#input-comms-power-up-duration").value || undefined, | ||
"trap-species": JSON.parse(document.querySelector("#input-comms-trap-species").value) || undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fine, but careful of parsing JSON as it will throw instead of defaulting to undefined if it's invalid
try {
protectSpecies = JSON.parse(document.querySelector("#input-comms-protect-species").value);
} catch (e) {
console.error("Invalid JSON for Protect Species:", e);
protectSpecies = undefined;
alert("Please enter valid JSON for Protect Species.");
}
No description provided.