fixed first-run contextmenu

This commit is contained in:
and94x 2022-08-17 19:34:17 +02:00
parent 659068abee
commit 09e788a37e

View File

@ -4,6 +4,7 @@ const saveButton = document.getElementById('save');
function validateAndSave() {
let valid = true;
//check stammTVBaseUrl
if (stammTVBaseUrl.value.startsWith('http://') || stammTVBaseUrl.value.startsWith('https://')) {
stammTVBaseUrl.classList.remove('is-invalid');
stammTVBaseUrl.classList.add('is-valid');
@ -14,6 +15,7 @@ function validateAndSave() {
valid = false;
}
//check stammTVWSSUrl
if (stammTVWSSUrl.value.startsWith('wss://')) {
stammTVWSSUrl.classList.remove('is-invalid');
stammTVWSSUrl.classList.add('is-valid');
@ -23,8 +25,10 @@ function validateAndSave() {
stammTVWSSUrl.classList.add('is-invalid');
valid = false;
}
if (valid) {
save();
init();
} else {
console.log('Failed to save settings - form validation was not successful.')
saveButton.classList.replace('btn-primary', 'btn-danger');