Calculate neighbors for replying-to messages fades based on window height.

(imported from commit 522025f16655fc1aa9776f08e991aab05a407ad4)
This commit is contained in:
Jessica McKellar 2013-02-28 15:35:06 -05:00
parent 06a44077aa
commit c516ce98e9
1 changed files with 6 additions and 1 deletions

View File

@ -72,7 +72,12 @@ function neighbors(target_message) {
var message_tr = $(rows.get(target_message.id, table));
var message_neighbors = $();
var candidates = $.merge(message_tr.prevAll("*:lt(20)"), message_tr.nextAll("*:lt(20)"));
// Being simplistic about this, the smallest message is 30 px high. This
// gives you a screen's worth of fade on either side of the target message
// message at worst.
var num_neighbors = Math.floor(viewport.height() / 30);
var candidates = $.merge(message_tr.prevAll(":not('.bookend_tr'):lt(" + num_neighbors + ")"),
message_tr.nextAll(":not('.bookend_tr'):lt(" + num_neighbors + ")"));
$.each(candidates, function () {
var row = $(this);