Added r shortcut and ctrl+ equivalents for shortcuts

This commit is contained in:
Tobias Reich 2014-03-29 20:28:18 +01:00
parent 4a74e992d4
commit 31d2bbfe28
2 changed files with 28 additions and 27 deletions

File diff suppressed because one or more lines are too long

View File

@ -70,17 +70,22 @@ $(document).ready(function(){
/* Keyboard */ /* Keyboard */
Mousetrap Mousetrap
.bind('u', function() { $("#upload_files").click() })
.bind('s', function() { if (visible.photo()) $("#button_star").click() })
.bind('left', function() { if (visible.photo()) $("#imageview a#previous").click() }) .bind('left', function() { if (visible.photo()) $("#imageview a#previous").click() })
.bind('right', function() { if (visible.photo()) $("#imageview a#next").click() }) .bind('right', function() { if (visible.photo()) $("#imageview a#next").click() })
.bind('command+backspace', function() { .bind(['u', 'ctrl+u'], function() { $("#upload_files").click() })
if (visible.photo()&&!visible.message()) photo.delete([photo.getID()]); .bind(['s', 'ctrl+s'], function() { if (visible.photo()) $("#button_star").click() })
else if (visible.album()&&!visible.message()) album.delete([album.getID()]); .bind(['r', 'ctrl+r'], function(e) {
e.preventDefault();
if (visible.album()) album.setTitle(album.getID());
else if (visible.photo()) photo.setTitle(photo.getID());
}) })
.bind('i', function() { .bind(['i', 'ctrl+i'], function() {
if (visible.infobox()) view.infobox.hide(); if (visible.infobox()) view.infobox.hide();
else if (!visible.albums()) view.infobox.show(); else if (!visible.albums()) view.infobox.show();
})
.bind(['command+backspace', 'ctrl+backspace'], function() {
if (visible.photo()&&!visible.message()) photo.delete([photo.getID()]);
else if (visible.album()&&!visible.message()) album.delete([album.getID()]);
}); });
Mousetrap.bindGlobal('enter', function() { Mousetrap.bindGlobal('enter', function() {
@ -97,28 +102,24 @@ $(document).ready(function(){
else if (visible.albums()&&$("#search").val().length!==0) search.reset(); else if (visible.albums()&&$("#search").val().length!==0) search.reset();
}); });
/* Fullscreen on mobile */
if (mobileBrowser()) { if (mobileBrowser()) {
$(document).on("touchend", "#image", function(e) {
$(document)
/* Fullscreen on mobile */
.on('touchend', '#image', function(e) {
if (swipe.obj===null||(swipe.offset>=-5&&swipe.offset<=5)) { if (swipe.obj===null||(swipe.offset>=-5&&swipe.offset<=5)) {
if (visible.controls()) view.header.hide(e, 0); if (visible.controls()) view.header.hide(e, 0);
else view.header.show(); else view.header.show();
} }
}); })
}
/* Swipe on mobile */ /* Swipe on mobile */
if (mobileBrowser()) { .swipe().on('swipeStart', function() { swipe.start($("#image")) })
$(document).swipe() .swipe().on('swipeMove', function(e) { swipe.move(e.swipe) })
.on("swipeStart", function(e) { .swipe().on('swipeEnd', function(e) { swipe.stop(e.swipe, photo.previous, photo.next) });
swipe.start($("#image"));
})
.on('swipeMove', function(e) {
swipe.move(e.swipe);
})
.on('swipeEnd', function(e) {
swipe.stop(e.swipe, photo.previous, photo.next);
});
} }
/* Document */ /* Document */