Files
zulip/static/js/navigate.js
Steve Howell 4ad78ade68 Don't widen bottom whitespace on down-arrow.
We had a feature that if you hit the down arrow key when you
were at the last message, it would recenter you.  Waseem has bought
into temporarily removing this feature.  Justifications:

  1) We can always put it back.
  2) Autoscrolling makes it less relevant.
  3) The feature complicated the code a bit.
  4) The feature worked different for End than down arrow, due to
     a FIXME.
  5) It might have been a misfeature for users that want more
     control over their own scrolling.
  6) You can achieve the same essential effect by using PgDn
     or space.

(imported from commit fa6874bb5d29d7057bb1601f0b6d577bac1272c7)
2013-08-02 18:18:04 -04:00

65 lines
1.7 KiB
JavaScript

var navigate = (function () {
var exports = {};
function go_to_row(row) {
current_msg_list.select_id(rows.id(row),
{then_scroll: true,
from_scroll: true});
}
exports.up = function () {
last_viewport_movement_direction = -1;
var next_row = rows.prev_visible(current_msg_list.selected_row());
if (next_row.length !== 0) {
go_to_row(next_row);
}
};
exports.down = function () {
last_viewport_movement_direction = 1;
var next_row = rows.next_visible(current_msg_list.selected_row());
if (next_row.length !== 0) {
go_to_row(next_row);
}
};
exports.to_home = function () {
last_viewport_movement_direction = -1;
var next_row = rows.first_visible(current_msg_list.selected_row());
if (next_row.length !== 0) {
go_to_row(next_row);
}
};
exports.to_end = function () {
var next_id = current_msg_list.last().id;
last_viewport_movement_direction = 1;
current_msg_list.select_id(next_id, {then_scroll: true,
from_scroll: true});
mark_current_list_as_read();
};
exports.page_up = function () {
if (viewport.at_top() && !current_msg_list.empty()) {
current_msg_list.select_id(current_msg_list.first().id, {then_scroll: false});
}
else {
ui.page_up_the_right_amount();
}
};
exports.page_down = function () {
if (viewport.at_bottom() && !current_msg_list.empty()) {
current_msg_list.select_id(current_msg_list.last().id, {then_scroll: false});
mark_current_list_as_read();
}
else {
ui.page_down_the_right_amount();
}
};
return exports;
}());