mirror of https://github.com/zulip/zulip.git
Allow cycling between streams with shift+{A,D}
Closes trac #2273. (imported from commit 858ffd47aa6dbb372d426fe94b860dfe1c1cce34)
This commit is contained in:
parent
2ca0015c0a
commit
8075c6e5a8
|
@ -67,8 +67,12 @@ function get_event_name(e) {
|
|||
return 'search';
|
||||
case 63: // '?': Show keyboard shortcuts page
|
||||
return 'show_shortcuts';
|
||||
case 65: // 'A'
|
||||
return 'stream_cycle_backward';
|
||||
case 67: // 'C'
|
||||
return 'compose_private_message';
|
||||
case 68: // 'D'
|
||||
return 'stream_cycle_forward';
|
||||
case 74: // 'J'
|
||||
return 'page_down';
|
||||
case 75: // 'K'
|
||||
|
@ -271,6 +275,12 @@ function process_hotkey(e) {
|
|||
case 'show_shortcuts': // Show keyboard shortcuts page
|
||||
$('#keyboard-shortcuts').modal('show');
|
||||
return true;
|
||||
case 'stream_cycle_backward':
|
||||
navigate.cycle_stream('backward');
|
||||
return true;
|
||||
case 'stream_cycle_forward':
|
||||
navigate.cycle_stream('forward');
|
||||
return true;
|
||||
}
|
||||
|
||||
if (current_msg_list.empty()) {
|
||||
|
|
|
@ -70,5 +70,37 @@ exports.page_down = function () {
|
|||
}
|
||||
};
|
||||
|
||||
exports.cycle_stream = function (direction) {
|
||||
var currentStream, nextStream;
|
||||
if (narrow.stream() !== undefined) {
|
||||
currentStream = stream_list.get_stream_li(narrow.stream());
|
||||
}
|
||||
switch (direction) {
|
||||
case 'forward':
|
||||
if (narrow.stream() === undefined) {
|
||||
nextStream = $("#stream_filters").children().first();
|
||||
} else {
|
||||
nextStream = currentStream.next();
|
||||
if (nextStream.length === 0) {
|
||||
nextStream = $("#stream_filters").children().first();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'backward':
|
||||
if (narrow.stream() === undefined) {
|
||||
nextStream = $("#stream_filters").children().last();
|
||||
} else {
|
||||
nextStream = currentStream.prev();
|
||||
if (nextStream.length === 0) {
|
||||
nextStream = $("#stream_filters").children().last();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
blueslip.error("Invalid parameter to cycle_stream", {value: direction});
|
||||
}
|
||||
narrow.by('stream', nextStream.data('name'));
|
||||
};
|
||||
|
||||
return exports;
|
||||
}());
|
||||
|
|
|
@ -94,6 +94,10 @@
|
|||
<td class="hotkey">v</td>
|
||||
<td class="definition">Narrow to all private messages</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="hotkey">A or D</td>
|
||||
<td class="definition">Cycle between stream narrows</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="hotkey">Esc</td>
|
||||
<td class="definition">Return to home view</td>
|
||||
|
|
Loading…
Reference in New Issue