added cancel selection option
This commit is contained in:
+11
-1
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user