From c516ce98e9b8c74417d0828558a5497fcca1a9fa Mon Sep 17 00:00:00 2001 From: Jessica McKellar Date: Thu, 28 Feb 2013 15:35:06 -0500 Subject: [PATCH] Calculate neighbors for replying-to messages fades based on window height. (imported from commit 522025f16655fc1aa9776f08e991aab05a407ad4) --- zephyr/static/js/compose.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zephyr/static/js/compose.js b/zephyr/static/js/compose.js index 36d49c53a5..fffb963aca 100644 --- a/zephyr/static/js/compose.js +++ b/zephyr/static/js/compose.js @@ -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);