added cancel selection option

This commit is contained in:
2026-02-07 10:18:25 +01:00
parent 498c5caf71
commit 89cabeed60
+11 -1
View File
@@ -485,7 +485,7 @@ function dayClick(dk) {
if (!isSelecting) { if (!isSelecting) {
selectionStart = dk; selectionStart = dk;
isSelecting = true; isSelecting = true;
document.getElementById('sel-hint').textContent = '📍 Kattints a befejező dátumra'; document.getElementById('sel-hint').textContent = '📍 Kattints a befejező dátumra (ESC = mégse)';
highlightSelection(dk, dk); highlightSelection(dk, dk);
} else { } else {
const start = selectionStart < dk ? selectionStart : dk; const start = selectionStart < dk ? selectionStart : dk;
@@ -613,6 +613,16 @@ function escapeHtml(t) {
return d.innerHTML; return d.innerHTML;
} }
// Cancel selection with ESC
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape' && isSelecting) {
isSelecting = false;
selectionStart = null;
document.getElementById('sel-hint').textContent = 'Kattints a kezdő dátumra a naptárban ↓';
document.querySelectorAll('.cal-day').forEach(el => el.classList.remove('in-selection'));
}
});
// Start // Start
checkAuth(); checkAuth();
</script> </script>