diff --git a/zephyr/jstemplates/zephyr.html b/zephyr/jstemplates/zephyr.html
index 7644d089e7..fc1f59aded 100644
--- a/zephyr/jstemplates/zephyr.html
+++ b/zephyr/jstemplates/zephyr.html
@@ -32,7 +32,7 @@
|
+ onmousedown="zephyr_mousedown();" onmousemove="zephyr_mousemove();">
{{#include_sender}}
1) {
+ // If you are already holding down another key, none of these
+ // actions apply.
+ return false;
+ }
+
switch (code) {
case 33: // Page Up
window_to_scroll.scrollTop(window_to_scroll.scrollTop() - window_to_scroll.height());
@@ -96,6 +102,24 @@ function process_compose_hotkey(code) {
}
}
+var pressed_keys = {};
+
+function num_pressed_keys() {
+ var size = 0, key;
+ for (key in pressed_keys) {
+ if (pressed_keys.hasOwnProperty(key)) size++;
+ }
+ return size;
+};
+
+$(document).keydown(function (e) {
+ pressed_keys[e.which] = true;
+});
+
+$(document).keyup(function (e) {
+ pressed_keys = {};
+});
+
/* The current handler function for keydown events.
It should return a new handler, or 'false' to
decline to handle the event. */
diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js
index d4d9f7c752..ef3176cf2f 100644
--- a/zephyr/static/js/zephyr.js
+++ b/zephyr/static/js/zephyr.js
@@ -31,6 +31,18 @@ function register_huddle_onclick(zephyr_row, sender) {
});
}
+function register_onclick(zephyr_row, zephyr_id) {
+ zephyr_row.find(".messagebox").click(function (e) {
+ if (!(clicking && mouse_moved)) {
+ // Was a click (not a click-and-drag).
+ select_zephyr_by_id(zephyr_id);
+ respond_to_zephyr();
+ }
+ mouse_moved = false;
+ clicking = false;
+ });
+}
+
var zephyr_array = [];
var zephyr_dict = {};
var instance_list = [];
@@ -427,6 +439,20 @@ function select_zephyr_by_id(zephyr_id) {
select_zephyr(get_zephyr_row(zephyr_id), false);
}
+var clicking = false;
+var mouse_moved = false;
+
+function zephyr_mousedown() {
+ mouse_moved = false;
+ clicking = true;
+}
+
+function zephyr_mousemove() {
+ if (clicking) {
+ mouse_moved = true;
+ }
+}
+
// Called on page load and when we [un]narrow.
// Forces a call to select_zephyr even if the id has not changed,
// because the visible table might have.
@@ -715,7 +741,9 @@ function add_to_table(zephyrs, table_name, filter_function) {
table.append(templates.zephyr({'zephyrs': zephyrs_to_render}));
$.each(zephyrs_to_render, function (index, zephyr) {
- register_huddle_onclick(get_zephyr_row(zephyr.id), zephyr.sender_email);
+ var row = get_zephyr_row(zephyr.id);
+ register_huddle_onclick(row, zephyr.sender_email);
+ register_onclick(row, zephyr.id);
});
$.each(ids_where_next_is_same_sender, function (index, id) {
|