fixed first-run contextmenu

master
and94x 2 years ago
parent 659068abee
commit 09e788a37e

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

Loading…
Cancel
Save