Have the pointer follow the mouse.

(imported from commit cfd6bcd7ba506c440f74bd7e40eaacadc06b10c8)
This commit is contained in:
Jessica McKellar 2012-09-13 10:58:29 -04:00
parent 08904cae43
commit 09bb68e52c
2 changed files with 20 additions and 8 deletions

View File

@ -24,7 +24,7 @@
{{/is_class}}
<br />
</td>
<td class="messagebox" onclick="select_zephyr({{id}});">
<td class="messagebox" onclick="select_zephyr({{id}});" onmouseover="update_pointer_by_id({{id}});">
<img class="profile_picture" src="http://www.gravatar.com/avatar/{{gravatar_hash}}?d=identicon"/>
<span class="zephyr_label_clickable zephyr_sender" onclick="prepare_huddle('{{sender}}')">
<span class="zephyr_sender_name">{{sender_name}}</span> <span class="zephyr_sender_email">{{sender_email}}</span>

View File

@ -166,6 +166,10 @@ function get_id(zephyr_row) {
return zephyr_row.attr('id');
}
function get_zephyr(zephyr_id) {
return $("#" + zephyr_id);
}
function scroll_to_selected() {
var main_div = $('#main_div');
main_div.scrollTop(0);
@ -211,6 +215,20 @@ function respond_to_zephyr() {
}
}
function update_pointer(zephyr) {
selected_zephyr_id = get_id(zephyr);
// Clear the previous arrow.
$("#selected").closest("td").empty().removeClass('selected_message_indicator');
zephyr.children("td:first").html('<p id="selected"></p>').addClass('selected_message_indicator');
$.post("update", { pointer: selected_zephyr_id });
}
function update_pointer_by_id(zephyr_id) {
update_pointer(get_zephyr(zephyr_id));
}
function select_zephyr(zephyr_id) {
var next_zephyr = $('#' + zephyr_id);
var main_div = $("#main_div");
@ -225,13 +243,7 @@ function select_zephyr(zephyr_id) {
next_zephyr = $('tr:not(:hidden):first');
}
selected_zephyr_id = get_id(next_zephyr);
// Clear the previous arrow.
$("#selected").closest("td").empty().removeClass('selected_message_indicator');
next_zephyr.children("td:first").html('<p id="selected"></p>').addClass('selected_message_indicator');
$.post("update", { pointer: selected_zephyr_id });
update_pointer(next_zephyr);
if ((next_zephyr.offset().top < main_div.offset().top) ||
(next_zephyr.offset().top + next_zephyr.height() >