Festival Schedule Generator
Festival Schedule
Edit Performers
Add New Performer
Current Performer List
Stage & Time Configuration
Enter one item per line.
No performers added yet.
"; return; } performers.forEach((p, index) => { const item = document.createElement("div"); item.className = "fsg-performer-item"; item.innerHTML = `
${p.name}
${p.genre}
`;
performerList.appendChild(item);
});
}
/**
* Adds a new performer from the input fields.
*/
function addPerformer() {
if (!performerNameInput || !performerGenreInput) return;
const name = performerNameInput.value.trim();
const genre = performerGenreInput.value.trim() || "Unknown Genre";
if (!name) {
alert("Please enter a performer name.");
return;
}
performers.push({ name, genre });
populatePerformerList();
performerNameInput.value = "";
performerGenreInput.value = "";
}
/**
* Handles clicks within the performer list (for removal).
* @param {Event} e - The click event.
*/
function handlePerformerListClick(e) {
if (e.target.classList.contains("fsg-remove-btn")) {
const index = parseInt(e.target.dataset.index, 10);
performers.splice(index, 1);
populatePerformerList();
}
}
/**
* Shuffles an array in place (Fisher-Yates).
* @param {Array} array - The array to shuffle.
*/
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}
/**
* Generates the schedule table in Tab 1.
*/
function generateSchedule() {
if (!scheduleHead || !scheduleBody) return;
// Clear existing schedule
scheduleHead.innerHTML = "";
scheduleBody.innerHTML = "";
if (
performers.length === 0 ||
stages.length === 0 ||
timeSlots.length === 0
) {
scheduleBody.innerHTML =
'${p.genre}
${p.genre}
