mirror of https://github.com/zulip/zulip.git
Move the message display code out of get_updates().
(imported from commit 9de20dbd11156cd98a11c736991945cba12b8118)
This commit is contained in:
parent
9625c17473
commit
74219b5e08
|
@ -135,11 +135,7 @@ $(function() {
|
||||||
setInterval(get_updates, 1000);
|
setInterval(get_updates, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
function get_updates() {
|
function add_message(index, zephyr) {
|
||||||
var last_received = $("tr:last").attr("id");
|
|
||||||
$.post("get_updates", {last_received: last_received},
|
|
||||||
function(data) {
|
|
||||||
$.each(data, function(index, zephyr) {
|
|
||||||
var new_str = "<tr id=" + zephyr.id + "> \
|
var new_str = "<tr id=" + zephyr.id + "> \
|
||||||
<td class='pointer'><p></p></td> \
|
<td class='pointer'><p></p></td> \
|
||||||
<td class='zephyr'> \
|
<td class='zephyr'> \
|
||||||
|
@ -149,7 +145,13 @@ zephyr.content +
|
||||||
"</p></td> \
|
"</p></td> \
|
||||||
</tr>"
|
</tr>"
|
||||||
$("#table tr:last").after(new_str);
|
$("#table tr:last").after(new_str);
|
||||||
});
|
}
|
||||||
|
|
||||||
|
function get_updates() {
|
||||||
|
var last_received = $("tr:last").attr("id");
|
||||||
|
$.post("get_updates", {last_received: last_received},
|
||||||
|
function(data) {
|
||||||
|
$.each(data, add_message);
|
||||||
}, "json");
|
}, "json");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue