summaryrefslogtreecommitdiffstats
path: root/hyperkitty/static
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2013-05-17 18:52:37 +0200
committerAurélien Bompard <aurelien@bompard.org>2013-05-17 18:52:37 +0200
commita6cc5ed7ac9e95a4e21c49f9159c66ff9a726600 (patch)
tree079a8bac20271a3c8f7cc852645f12f2317e11da /hyperkitty/static
parent3759498f4ecf5cae88eecf197b1f2cf075bc0565 (diff)
downloadhyperkitty-a6cc5ed7ac9e95a4e21c49f9159c66ff9a726600.tar.gz
hyperkitty-a6cc5ed7ac9e95a4e21c49f9159c66ff9a726600.tar.xz
hyperkitty-a6cc5ed7ac9e95a4e21c49f9159c66ff9a726600.zip
Load replies in chunks to avoid overloading the browser
Diffstat (limited to 'hyperkitty/static')
-rw-r--r--hyperkitty/static/js/hyperkitty.js46
1 files changed, 27 insertions, 19 deletions
diff --git a/hyperkitty/static/js/hyperkitty.js b/hyperkitty/static/js/hyperkitty.js
index 62bacf4..ee30c74 100644
--- a/hyperkitty/static/js/hyperkitty.js
+++ b/hyperkitty/static/js/hyperkitty.js
@@ -355,25 +355,33 @@ function activity_graph(elem_id, dates, counts, baseurl) {
* Thread replies list
*/
function update_thread_replies(url) {
- $.ajax({
- dataType: "json",
- url: url,
- success: function(data) {
- // replies
- var newcontent = $(data.replies_html);
- $(".replies").html(newcontent);
- // re-bind events
- setup_emails_list(newcontent);
- fold_quotes(newcontent);
- setup_disabled_tooltips(newcontent);
- setup_vote(newcontent);
- // participants list
- $("#participants").html(data.participants_html);
- },
- error: function(jqXHR, textStatus, errorThrown) {
- alert(jqXHR.responseText);
- }
- });
+ function load_more(current_url) {
+ $.ajax({
+ dataType: "json",
+ url: current_url,
+ success: function(data) {
+ // replies
+ var newcontent = $(data.replies_html);
+ $(".replies").append(newcontent)
+ .append($(".replies .ajaxloader"));
+ // re-bind events
+ setup_emails_list(newcontent);
+ fold_quotes(newcontent);
+ setup_disabled_tooltips(newcontent);
+ setup_vote(newcontent);
+ // load the rest if applicable
+ if (data.more_pending) {
+ load_more(url+"&offset="+data.next_offset);
+ } else {
+ $(".replies .ajaxloader").remove();
+ }
+ },
+ error: function(jqXHR, textStatus, errorThrown) {
+ alert(jqXHR.responseText);
+ }
+ });
+ }
+ load_more(url);
}