Clean up comments
parent
cb7204d700
commit
d10d625cef
|
|
@ -285,17 +285,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function attachButtonHandlers() {
|
function attachButtonHandlers() {
|
||||||
// Handle "Move up" buttons
|
|
||||||
document.querySelectorAll('.btn-move-up').forEach((button, index) => {
|
document.querySelectorAll('.btn-move-up').forEach((button, index) => {
|
||||||
button.addEventListener('click', () => moveTimerUp(index + 1));
|
button.addEventListener('click', () => moveTimerUp(index + 1));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle "Move down" buttons
|
|
||||||
document.querySelectorAll('.btn-move-down').forEach((button, index) => {
|
document.querySelectorAll('.btn-move-down').forEach((button, index) => {
|
||||||
button.addEventListener('click', () => moveTimerDown(index));
|
button.addEventListener('click', () => moveTimerDown(index));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle "Delete" buttons
|
|
||||||
document.querySelectorAll('.btn-delete').forEach((button, index) => {
|
document.querySelectorAll('.btn-delete').forEach((button, index) => {
|
||||||
button.addEventListener('click', () => deleteTimer(index));
|
button.addEventListener('click', () => deleteTimer(index));
|
||||||
});
|
});
|
||||||
|
|
@ -309,8 +304,6 @@
|
||||||
|
|
||||||
if (type === 'name') {
|
if (type === 'name') {
|
||||||
userTimers[index].name = value;
|
userTimers[index].name = value;
|
||||||
|
|
||||||
// Update only the At End dropdowns
|
|
||||||
updateAtEndDropdowns();
|
updateAtEndDropdowns();
|
||||||
} else if (type === 'hours' || type === 'minutes' || type === 'seconds') {
|
} else if (type === 'hours' || type === 'minutes' || type === 'seconds') {
|
||||||
let hInput = document.getElementById(`hours-${index}`);
|
let hInput = document.getElementById(`hours-${index}`);
|
||||||
|
|
@ -342,10 +335,8 @@
|
||||||
|
|
||||||
function moveTimerUp(index) {
|
function moveTimerUp(index) {
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
// Swap the timers
|
|
||||||
[userTimers[index - 1], userTimers[index]] = [userTimers[index], userTimers[index - 1]];
|
[userTimers[index - 1], userTimers[index]] = [userTimers[index], userTimers[index - 1]];
|
||||||
|
|
||||||
// Re-render the table
|
|
||||||
updateTimerBlocks();
|
updateTimerBlocks();
|
||||||
|
|
||||||
// Move focus to the new position of the "Move up" button
|
// Move focus to the new position of the "Move up" button
|
||||||
|
|
@ -358,10 +349,8 @@
|
||||||
|
|
||||||
function moveTimerDown(index) {
|
function moveTimerDown(index) {
|
||||||
if (index < userTimers.length - 1) {
|
if (index < userTimers.length - 1) {
|
||||||
// Swap the timers
|
|
||||||
[userTimers[index], userTimers[index + 1]] = [userTimers[index + 1], userTimers[index]];
|
[userTimers[index], userTimers[index + 1]] = [userTimers[index + 1], userTimers[index]];
|
||||||
|
|
||||||
// Re-render the table
|
|
||||||
updateTimerBlocks();
|
updateTimerBlocks();
|
||||||
|
|
||||||
// Move focus to the new position of the "Move down" button
|
// Move focus to the new position of the "Move down" button
|
||||||
|
|
@ -424,8 +413,8 @@
|
||||||
|
|
||||||
function saveTimers() {
|
function saveTimers() {
|
||||||
if (userTimers.length) {
|
if (userTimers.length) {
|
||||||
// (Guard in case the user manages to click Save before
|
// Guard in case the user manages to click Save before
|
||||||
// the timers are loaded, or something like that)
|
// the timers are loaded, or something like that
|
||||||
Util.writeStorage(TIMERS_FILE, JSON.stringify(userTimers), () => {
|
Util.writeStorage(TIMERS_FILE, JSON.stringify(userTimers), () => {
|
||||||
alert('Timers saved successfully.');
|
alert('Timers saved successfully.');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue