diff --git a/app/Application.js b/app/Application.js index f7e18a44..c7b6e88c 100644 --- a/app/Application.js +++ b/app/Application.js @@ -42,9 +42,10 @@ Ext.define('Rambox.Application', { ,handler: function(key) { var tabPanel = Ext.cq1('app-main'); var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab()); - if ( tabPanel.items.items[activeIndex + 1] && tabPanel.items.items[activeIndex + 1].id === 'tbfill' ) activeIndex++; - if ( !tabPanel.items.items[activeIndex + 1] ) activeIndex = -1; - tabPanel.setActiveTab( activeIndex + 1 ); + var i = activeIndex + 1; + if ( i >= tabPanel.items.items.length - 1 ) i = 0; + while ( tabPanel.items.items[i].id === 'tbfill' ) i++; + tabPanel.setActiveTab( i ); } } ,{ @@ -55,10 +56,38 @@ Ext.define('Rambox.Application', { ,handler: function(key) { var tabPanel = Ext.cq1('app-main'); var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab()); - if ( tabPanel.items.items[activeIndex - 1] && tabPanel.items.items[activeIndex - 1].id === 'tbfill' ) activeIndex--; - if ( !tabPanel.items.items[activeIndex - 1] && tabPanel.items.items.length !== 2 ) activeIndex = tabPanel.items.items.length; - if ( tabPanel.items.items.length === 2 ) activeIndex = 1; - tabPanel.setActiveTab( activeIndex - 1 ); + var i = activeIndex - 1; + if ( i < 0 ) i = tabPanel.items.items.length - 1; + while ( tabPanel.items.items[i].id === 'tbfill' || i < 0 ) i--; + tabPanel.setActiveTab( i ); + } + } + ,{ + key: Ext.event.Event.PAGE_DOWN + ,ctrl: true + ,alt: false + ,shift: false + ,handler: function(key) { + var tabPanel = Ext.cq1('app-main'); + var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab()); + var i = activeIndex + 1; + if ( i >= tabPanel.items.items.length - 1 ) i = 0; + while ( tabPanel.items.items[i].id === 'tbfill' ) i++; + tabPanel.setActiveTab( i ); + } + } + ,{ + key: Ext.event.Event.PAGE_UP + ,ctrl: true + ,alt: false + ,shift: false + ,handler: function(key) { + var tabPanel = Ext.cq1('app-main'); + var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab()); + var i = activeIndex - 1; + if ( i < 0 ) i = tabPanel.items.items.length - 1; + while ( tabPanel.items.items[i].id === 'tbfill' ) i--; + tabPanel.setActiveTab( i ); } } ,{