From cc9464082feaf1988f28845f689cbb15a0fca7f3 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 13 Oct 2015 09:10:48 +0100 Subject: [PATCH] use shift-[1-0] to switch between item views, fixes #2837 --- static/js/mainMenu.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/static/js/mainMenu.js b/static/js/mainMenu.js index 22b4d99f4..eb38a32eb 100644 --- a/static/js/mainMenu.js +++ b/static/js/mainMenu.js @@ -4,6 +4,7 @@ pandora.ui.mainMenu = function() { var isGuest = pandora.user.level == 'guest', + itemViewKey = 1, ui = pandora.user.ui, findState = pandora.getFindState(ui.find), fromMenu = false, @@ -113,6 +114,9 @@ pandora.ui.mainMenu = function() { return Ox.extend({ checked: ui.itemView == view.id }, view, { + keyboard: itemViewKey <= 10 + ? 'shift ' + (itemViewKey++%10) + : void 0, title: Ox._(view.title) }); }) }, @@ -861,6 +865,14 @@ pandora.ui.mainMenu = function() { } }); + pandora.site.itemViews.forEach(function(view, i) { + if (i < 10) { + Ox.Event.bind('key_shift_' + (i + 1) % 10, function() { + pandora.UI.set({itemView: view.id}); + }); + } + }); + pandora.clipboard.bindEvent(function(data, event) { if (Ox.contains(['add', 'copy', 'clear'], event)) { that.replaceMenu('itemMenu', getItemMenu());