} else {\r
panel.close();\r
}\r
- },\r
-\r
- next: function () {\r
- var next = this.$tab_container.find('.active').next();\r
- if (!next.length) next = $('li:first', this.$tab_container);\r
-\r
- next.click();\r
- },\r
- prev: function () {\r
- var prev = this.$tab_container.find('.active').prev();\r
- if (!prev.length) prev = $('li:last', this.$tab_container);\r
-\r
- prev.click();\r
}\r
});\r
\r
break;\r
\r
case (ev.keyCode === 219 && meta): // [ + meta\r
- _kiwi.app.panels.view.prev();\r
+ // Find all the tab elements and get the index of the active tab\r
+ var $tabs = $('#kiwi #tabs').find('li[class!=connection]');\r
+ var cur_tab_ind = (function() {\r
+ for (var idx=0; idx<$tabs.length; idx++){\r
+ if ($($tabs[idx]).hasClass('active'))\r
+ return idx;\r
+ }\r
+ })();\r
+\r
+ // Work out the previous tab along. Wrap around if needed\r
+ if (cur_tab_ind === 0) {\r
+ $prev_tab = $($tabs[$tabs.length - 1]);\r
+ } else {\r
+ $prev_tab = $($tabs[cur_tab_ind - 1]);\r
+ }\r
+\r
+ $prev_tab.click();\r
return false;\r
\r
case (ev.keyCode === 221 && meta): // ] + meta\r
- _kiwi.app.panels.view.next();\r
+ // Find all the tab elements and get the index of the active tab\r
+ var $tabs = $('#kiwi #tabs').find('li[class!=connection]');\r
+ var cur_tab_ind = (function() {\r
+ for (var idx=0; idx<$tabs.length; idx++){\r
+ if ($($tabs[idx]).hasClass('active'))\r
+ return idx;\r
+ }\r
+ })();\r
+\r
+ // Work out the next tab along. Wrap around if needed\r
+ if (cur_tab_ind === $tabs.length - 1) {\r
+ $next_tab = $($tabs[0]);\r
+ } else {\r
+ $next_tab = $($tabs[cur_tab_ind + 1]);\r
+ }\r
+\r
+ $next_tab.click();\r
return false;\r
\r
case (ev.keyCode === 9): // tab\r