diff options
| author | Aurélien Bompard <aurelien@bompard.org> | 2013-05-14 13:44:42 +0200 |
|---|---|---|
| committer | Aurélien Bompard <aurelien@bompard.org> | 2013-05-14 13:44:42 +0200 |
| commit | fb6423fd8d2e0068c9c5b5bb8a643ea991e59739 (patch) | |
| tree | 5b8e07532ca7763052017e3027eb8db8affa06e6 /hyperkitty/templates/thread.html | |
| parent | 4b1df7bbdb0f0fa35cf738235aff8170a37b7d04 (diff) | |
| download | hyperkitty-fb6423fd8d2e0068c9c5b5bb8a643ea991e59739.tar.gz hyperkitty-fb6423fd8d2e0068c9c5b5bb8a643ea991e59739.tar.xz hyperkitty-fb6423fd8d2e0068c9c5b5bb8a643ea991e59739.zip | |
Speed up page loading on long threads
Speed up page loading on threads with many replies by loading the
replies asynchronously.
Preserve search engine indexation by detecting bots and serving the
usual page in one go.
Diffstat (limited to 'hyperkitty/templates/thread.html')
| -rw-r--r-- | hyperkitty/templates/thread.html | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/hyperkitty/templates/thread.html b/hyperkitty/templates/thread.html index 9de03b1..a198014 100644 --- a/hyperkitty/templates/thread.html +++ b/hyperkitty/templates/thread.html @@ -50,14 +50,11 @@ </p> <div class="replies"> - {% for email in replies %} - <div class="{% cycle 'even' 'odd' %}" - {% if email.level %}style="margin-left:{{ email.level|multiply:"2" }}em;"{% endif %}> - <!-- Start email --> - {% include 'messages/message.html' %} - <!-- End of email --> - </div> - {% endfor %} + {% if is_bot %} + {% include 'threads/replies.html' %} + {% else %} + <img alt="Loading..." class="ajaxloader" src="{{ STATIC_URL }}img/ajax-loader.gif" /> + {% endif %} </div> </section> @@ -80,14 +77,10 @@ <script type="text/javascript"> $(document).ready(function() { - // hide quotes by default in the thread view - $('div.email-body .quoted-text').each(function() { - var linescount = $(this).text().split("\n").length; - if (linescount > 3) { - // hide if the quote is more than 3 lines long - $(this).hide(); - } - }); + // Hide quotes by default in the thread view + fold_quotes() + // Load the replies + update_thread_replies("{% url 'thread_replies' threadid=threadid mlist_fqdn=mlist.name %}?sort={{sort_mode}}"); }); </script> |
