add special event toggle (alt + click)

This commit is contained in:
ari melody 2026-07-20 22:24:00 +01:00
parent ac9393c2b3
commit 1897212f5b
Signed by: ari
GPG key ID: CF99829C92678188
2 changed files with 49 additions and 4 deletions

23
main.js
View file

@ -180,6 +180,8 @@ function createSchedule() {
container.id = `slot-${day}`;
if (!schedule.days[day].enabled)
container.classList.add('disabled');
if (schedule.days[day].special)
container.classList.add('special');
const timeslotDateContainer = document.createElement('div');
timeslotDateContainer.className = 'timeslot-date';
@ -214,7 +216,10 @@ function createSchedule() {
scheduleDOM.appendChild(container);
timeslotDay.addEventListener('click', () => {
timeslotDay.addEventListener('click', event => {
if (event.altKey)
return;
schedule.days[day].enabled = !schedule.days[day].enabled;
timeslotTitle.contentEditable = schedule.days[day].enabled;
@ -241,5 +246,21 @@ function createSchedule() {
timeslotTime.addEventListener('keyup', () => {
schedule.days[day].time = timeslotTime.innerText;
});
container.addEventListener('click', event => {
if (!event.altKey)
return;
event.preventDefault();
const slot = schedule.days[day];
slot.special = !slot.special;
if (slot.special) {
container.classList.add("special");
} else {
container.classList.remove("special");
}
});
}
}