correct syntax error
This commit is contained in:
parent
707e085fe7
commit
3ffd34190f
21
script.js
21
script.js
|
@ -29,22 +29,23 @@ const form = document.getElementById('merge-form');
|
|||
const linkGroupName = document.getElementById('link-group-name').value;
|
||||
const calendarsData = [];
|
||||
let valid = true; // Flag to track URL validity
|
||||
|
||||
|
||||
for (let i = 0; i < calendarIndex; i++) {
|
||||
const prefix = document.getElementById(`prefix-${i}`);
|
||||
const override = document.getElementById(`override-${i}`);
|
||||
const url = document.getElementById(`url-${i}`);
|
||||
if (prefix && override && url) {
|
||||
// Validate the URL
|
||||
if (!isValidUrl(url.value)) {
|
||||
valid = false; // Set flag to false if any URL is invalid
|
||||
alert(`Invalid URL format for calendar ${i + 1}: ${url.value}`);
|
||||
} else {
|
||||
calendarsData.push({
|
||||
prefix: prefix.value,
|
||||
override: override.checked,
|
||||
url: url.value
|
||||
});
|
||||
if (!isValidUrl(url.value)) {
|
||||
valid = false; // Set flag to false if any URL is invalid
|
||||
alert(`Invalid URL format for calendar ${i + 1}: ${url.value}`);
|
||||
} else {
|
||||
calendarsData.push({
|
||||
prefix: prefix.value,
|
||||
override: override.checked,
|
||||
url: url.value
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
fetch('/merge', {
|
||||
|
|
Loading…
Reference in New Issue