Add F5 hotkey

This commit is contained in:
Evgeny Zhlobo 2012-12-08 15:45:00 +03:00
parent 4f62967b2b
commit 26b6b855d5
1 changed files with 25 additions and 1 deletions

View File

@ -483,7 +483,7 @@ window.shower = (function(window, document, undefined) {
}, false);
document.addEventListener('keydown', function (e) {
// Shortcut for alt, shift and meta keys
// Shortcut for alt, ctrl and meta keys
if (e.altKey || e.ctrlKey || e.metaKey) { return; }
var currentSlideNumber = shower.getCurrentSlideNumber(),
@ -491,6 +491,30 @@ window.shower = (function(window, document, undefined) {
switch (e.which) {
case 116: // F5
e.preventDefault();
if (shower.isListMode()) {
var slideNumber = e.shiftKey ? currentSlideNumber : 0;
shower.go(slideNumber);
if (isHistoryApiSupported) {
history.pushState(null, null, url.pathname + '?full' + shower.getSlideHash(slideNumber));
}
shower.enterSlideMode();
shower.updateProgress(slideNumber);
shower.updateCurrentAndPassedSlides(slideNumber);
shower.runSlideshowIfPresented(slideNumber);
} else {
if (isHistoryApiSupported) {
history.pushState(null, null, url.pathname + shower.getSlideHash(currentSlideNumber));
}
shower.enterListMode();
shower.scrollToSlide(currentSlideNumber);
}
break;
case 13: // Enter
if (shower.isListMode() && -1 !== currentSlideNumber) {
e.preventDefault();