added cancel selection option
This commit is contained in:
+11
-1
@@ -485,7 +485,7 @@ function dayClick(dk) {
|
||||
if (!isSelecting) {
|
||||
selectionStart = dk;
|
||||
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);
|
||||
} else {
|
||||
const start = selectionStart < dk ? selectionStart : dk;
|
||||
@@ -613,6 +613,16 @@ function escapeHtml(t) {
|
||||
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
|
||||
checkAuth();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user