2012-10-27 02:01:18 +02:00
|
|
|
var rows = (function () {
|
|
|
|
|
2013-08-14 20:57:29 +02:00
|
|
|
var exports = {};
|
2012-10-03 20:49:58 +02:00
|
|
|
|
2013-08-14 20:57:29 +02:00
|
|
|
// We don't need an andSelf() here because we already know
|
|
|
|
// that our next element is *not* a message_row, so this
|
|
|
|
// isn't going to end up empty unless we're at the bottom or top.
|
|
|
|
exports.next_visible = function (message_row) {
|
|
|
|
if (message_row === undefined) {
|
|
|
|
return $();
|
|
|
|
}
|
|
|
|
var row = message_row.next('.selectable_row');
|
|
|
|
if (row.length !== 0) {
|
|
|
|
return row;
|
|
|
|
}
|
|
|
|
return message_row.nextUntil('.selectable_row').next('.selectable_row');
|
|
|
|
};
|
2012-10-03 20:49:58 +02:00
|
|
|
|
2013-08-14 20:57:29 +02:00
|
|
|
exports.prev_visible = function (message_row) {
|
|
|
|
if (message_row === undefined) {
|
|
|
|
return $();
|
|
|
|
}
|
|
|
|
var row = message_row.prev('.selectable_row');
|
|
|
|
if (row.length !== 0) {
|
|
|
|
return row;
|
|
|
|
}
|
|
|
|
return message_row.prevUntil('.selectable_row').prev('.selectable_row');
|
|
|
|
};
|
2012-10-03 20:49:58 +02:00
|
|
|
|
2013-08-14 20:57:29 +02:00
|
|
|
exports.first_visible = function () {
|
|
|
|
return $('.focused_table .selectable_row:first');
|
|
|
|
};
|
2012-10-03 20:49:58 +02:00
|
|
|
|
2013-08-14 20:57:29 +02:00
|
|
|
exports.last_visible = function () {
|
|
|
|
return $('.focused_table .selectable_row:last');
|
|
|
|
};
|
2012-10-03 20:49:58 +02:00
|
|
|
|
2013-08-14 20:57:29 +02:00
|
|
|
exports.id = function (message_row) {
|
2013-12-18 20:09:09 +01:00
|
|
|
return parseFloat(message_row.attr('zid'), 10);
|
2013-08-14 20:57:29 +02:00
|
|
|
};
|
2012-10-18 20:55:41 +02:00
|
|
|
|
2013-08-14 20:57:29 +02:00
|
|
|
var valid_table_names = {
|
|
|
|
zhome: true,
|
|
|
|
zfilt: true
|
|
|
|
};
|
2012-10-27 02:05:54 +02:00
|
|
|
|
2013-08-14 20:57:29 +02:00
|
|
|
exports.get_table = function (table_name) {
|
|
|
|
if (! valid_table_names.hasOwnProperty(table_name)) {
|
|
|
|
return $();
|
|
|
|
}
|
2012-10-27 03:03:06 +02:00
|
|
|
|
2013-08-14 20:57:29 +02:00
|
|
|
return $('#' + table_name);
|
|
|
|
};
|
2012-10-27 03:03:06 +02:00
|
|
|
|
2013-08-27 17:09:27 +02:00
|
|
|
exports.get_closest_row = function (element) {
|
|
|
|
// This gets the closest message row to an element, whether it's
|
|
|
|
// a summary bar, recipient bar, or message. With our current markup,
|
|
|
|
// this is the most reliable way to do it.
|
2013-12-20 01:13:48 +01:00
|
|
|
return $(element).closest("div.message_row, div.recipient_row");
|
2013-08-27 17:09:27 +02:00
|
|
|
};
|
|
|
|
|
2013-08-14 20:57:29 +02:00
|
|
|
return exports;
|
2012-10-27 02:01:18 +02:00
|
|
|
|
|
|
|
}());
|