better Enter key handling
This commit is contained in:
parent
df0c517b16
commit
cfa2c54235
|
@ -53,9 +53,6 @@
|
||||||
case 32 : // Space
|
case 32 : // Space
|
||||||
current += e.shiftKey ? -1 : 1;
|
current += e.shiftKey ? -1 : 1;
|
||||||
break;
|
break;
|
||||||
case 13 : // Enter
|
|
||||||
if(!current+1) enterFull();
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
prevent = false;
|
prevent = false;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +76,13 @@
|
||||||
updateProgress();
|
updateProgress();
|
||||||
if(!isFull()) history.pushState(null, null, url.pathname + '?full' + url.hash);
|
if(!isFull()) history.pushState(null, null, url.pathname + '?full' + url.hash);
|
||||||
window.addEventListener('resize', resizeFull, false);
|
window.addEventListener('resize', resizeFull, false);
|
||||||
document.addEventListener('keydown', exitFullEsc, false);
|
document.addEventListener('keyup', exitFullKey, false);
|
||||||
|
document.removeEventListener('keydown', enterFullKey, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function enterFullKey(e) {
|
||||||
|
if(e.which != 13) return;
|
||||||
|
enterFull();
|
||||||
}
|
}
|
||||||
|
|
||||||
function exitFull() {
|
function exitFull() {
|
||||||
|
@ -89,10 +92,11 @@
|
||||||
history.pushState(null, null, url.pathname.replace('?full', ''));
|
history.pushState(null, null, url.pathname.replace('?full', ''));
|
||||||
url.hash = hash;
|
url.hash = hash;
|
||||||
window.removeEventListener('resize', resizeFull, false);
|
window.removeEventListener('resize', resizeFull, false);
|
||||||
document.removeEventListener('keydown', exitFullEsc, false);
|
document.removeEventListener('keyup', exitFullKey, false);
|
||||||
|
document.addEventListener('keydown', enterFullKey, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function exitFullEsc(e) {
|
function exitFullKey(e) {
|
||||||
if(e.which != 27) return;
|
if(e.which != 27) return;
|
||||||
exitFull();
|
exitFull();
|
||||||
}
|
}
|
||||||
|
@ -110,5 +114,6 @@
|
||||||
if(isFull()) enterFull();
|
if(isFull()) enterFull();
|
||||||
}, false);
|
}, false);
|
||||||
document.addEventListener('keydown', turnSlide, false);
|
document.addEventListener('keydown', turnSlide, false);
|
||||||
|
document.addEventListener('keydown', enterFullKey, false);
|
||||||
|
|
||||||
})();
|
})();
|
Loading…
Reference in New Issue