mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 16:37:23 +00:00
copy_and_paste.js: Extract method for constructing recipient header.
This commit is contained in:
@@ -35,15 +35,20 @@ function find_boundary_tr(initial_tr, iterate_row) {
|
|||||||
return [rows.id(tr), skip_same_td_check];
|
return [rows.id(tr), skip_same_td_check];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function construct_recipient_header(message_row) {
|
||||||
|
var message_header_content = rows.get_message_recipient_header(message_row)
|
||||||
|
.text()
|
||||||
|
.replace(/\s+/g, " ")
|
||||||
|
.replace(/^\s/, "").replace(/\s$/, "");
|
||||||
|
return $('<p>').append($('<strong>').text(message_header_content));
|
||||||
|
}
|
||||||
|
|
||||||
function construct_copy_div(div, start_id, end_id) {
|
function construct_copy_div(div, start_id, end_id) {
|
||||||
for (var row = current_msg_list.get_row(start_id);
|
for (var row = current_msg_list.get_row(start_id);
|
||||||
rows.id(row) <= end_id;
|
rows.id(row) <= end_id;
|
||||||
row = rows.next_visible(row)) {
|
row = rows.next_visible(row)) {
|
||||||
if (row.prev().hasClass("message_header")) {
|
if (row.prev().hasClass("message_header")) {
|
||||||
var content = $('<div>').text(row.prev().text()
|
div.append(construct_recipient_header(row));
|
||||||
.replace(/\s+/g, " ")
|
|
||||||
.replace(/^\s/, "").replace(/\s$/, ""));
|
|
||||||
div.append($('<p>').append($('<strong>').text(content.text())));
|
|
||||||
}
|
}
|
||||||
var message = current_msg_list.get(rows.id(row));
|
var message = current_msg_list.get(rows.id(row));
|
||||||
var message_firstp = $(message.content).slice(0, 1);
|
var message_firstp = $(message.content).slice(0, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user