diff --git a/airsonic-main/src/main/webapp/WEB-INF/jsp/head.jsp b/airsonic-main/src/main/webapp/WEB-INF/jsp/head.jsp index e2d8caf9..c0c2c711 100644 --- a/airsonic-main/src/main/webapp/WEB-INF/jsp/head.jsp +++ b/airsonic-main/src/main/webapp/WEB-INF/jsp/head.jsp @@ -16,39 +16,10 @@ " type="text/css"> Airsonic - - - - - - + + diff --git a/airsonic-main/src/main/webapp/script/keyboard_shortcuts.js b/airsonic-main/src/main/webapp/script/keyboard_shortcuts.js new file mode 100644 index 00000000..35e73dab --- /dev/null +++ b/airsonic-main/src/main/webapp/script/keyboard_shortcuts.js @@ -0,0 +1,30 @@ +function isKeyboardShortcutsEnabled() { + if (window === parent.frames.top) { + var config = JSON.parse(document.getElementById('preferencesConfig').textContent) + return config['keyboardShortcutsEnabled']; + } else { + return parent.frames.top.isKeyboardShortcutsEnabled(); + } +} + +if (isKeyboardShortcutsEnabled()) { + Mousetrap.bind('space', function() { parent.frames.playQueue.onToggleStartStop(); return false; }); + Mousetrap.bind('left', function() { parent.frames.playQueue.onPrevious(); }); + Mousetrap.bind('right', function() { parent.frames.playQueue.onNext(); }); + Mousetrap.bind('*', function() { parent.frames.playQueue.onStarCurrent(); }); + Mousetrap.bind('plus', function() { parent.frames.playQueue.onGainAdd(+5); }); + Mousetrap.bind('-', function() { parent.frames.playQueue.onGainAdd(-5); }); + Mousetrap.bind('q', function() { parent.frames.playQueue.onTogglePlayQueue(); }); + + Mousetrap.bind('/', function() { parent.frames.upper.$("#query").focus(); }); + Mousetrap.bind('m', function() { parent.frames.upper.toggleLeftFrameVisible(); }); + + Mousetrap.bind('g h', function() { parent.frames.main.location.href = "home.view?"; }); + Mousetrap.bind('g p', function() { parent.frames.main.location.href = "playlists.view?"; }); + Mousetrap.bind('g o', function() { parent.frames.main.location.href = "podcastChannels.view?"; }); + Mousetrap.bind('g s', function() { parent.frames.main.location.href = "settings.view?"; }); + Mousetrap.bind('g t', function() { parent.frames.main.location.href = "starred.view?"; }); + Mousetrap.bind('g r', function() { parent.frames.main.location.href = "more.view?"; }); + Mousetrap.bind('g a', function() { parent.frames.main.location.href = "help.view?"; }); + Mousetrap.bind('?', function() { parent.frames.main.location.href = "more.view#shortcuts"; }); +}