From 08496a228efc5b06dbd5143e953ab36ff9b2daf3 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 22 Oct 2015 12:22:43 +0100 Subject: [PATCH] also use shift 1 to shift 7 to switch between list views --- static/js/mainMenu.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/static/js/mainMenu.js b/static/js/mainMenu.js index acb0d8b2..cd718c4f 100644 --- a/static/js/mainMenu.js +++ b/static/js/mainMenu.js @@ -5,6 +5,7 @@ pandora.ui.mainMenu = function() { var isGuest = pandora.user.level == 'guest', itemViewKey = 1, + listViewKey = 1, ui = pandora.user.ui, findState = pandora.getFindState(ui.find), fromMenu = false, @@ -67,6 +68,9 @@ pandora.ui.mainMenu = function() { return Ox.extend({ checked: ui.listView == view.id }, view, { + keyboard: listViewKey <= 10 + ? 'shift ' + (listViewKey++%10) + : void 0, title: Ox._(view.title) }); }) }, @@ -868,15 +872,22 @@ pandora.ui.mainMenu = function() { } }); - pandora.site.itemViews.filter(function(view) { - return view.id != 'data' && view.id != 'media' || - pandora.site.capabilities.canSeeExtraItemViews[pandora.user.level]; - }).forEach(function(view, i) { - if (i < 10) { - Ox.Event.bind('key_shift_' + (i + 1) % 10, function() { - pandora.UI.set({itemView: view.id}); - }); - } + Ox.range(10).forEach(function(i) { + Ox.Event.bind('key_shift_' + (i + 1) % 10, function() { + var view; + if (ui.item) { + view = pandora.site.itemViews[i]; + if (view && (view.id != 'data' && view.id != 'media' || + pandora.site.capabilities.canSeeExtraItemViews[pandora.user.level])) { + pandora.UI.set({itemView: view.id}); + } + } else { + view = pandora.site.listViews[i]; + if (view) { + pandora.UI.set({listView: view.id}); + } + } + }); }); pandora.clipboard.bindEvent(function(data, event) {