diff --git a/static/js/archive.js b/static/js/archive.js index a4fc738f39..b5a81983d1 100644 --- a/static/js/archive.js +++ b/static/js/archive.js @@ -91,6 +91,8 @@ exports.initialize = function () { var all_senders = $(this).find('.message_sender').has('.inline_profile_picture'); prev_sender = all_senders.last(); }); + + $('.app').scrollTop($('.app').height()); all_message_timestamps_to_human_readable(); }; @@ -98,10 +100,44 @@ return exports; }()); +var current_msg_list = { + selected_row: function () { + return $('.message_row').last(); + }, +}; +var rows = { + get_message_recipient_row: function (message_row) { + return $(message_row).parent('.recipient_row'); + }, + first_message_in_group: function (message_group) { + return $('div.message_row:first', message_group); + }, + id: function (message_row) { + return parseFloat(message_row.attr('zid')); + }, +}; + if (typeof module !== 'undefined') { + module.exports.current_msg_list = current_msg_list; + module.exports.rows = rows; module.exports = archive; } +var scroll_timer; +function scroll_finish() { + clearTimeout(scroll_timer); + scroll_timer = setTimeout(floating_recipient_bar.update, 100); +} + $(function () { + $.fn.safeOuterHeight = function () { + return $(this).outerHeight.apply(this, arguments) || 0; + }; + $.fn.safeOuterWidth = function () { + return $(this).outerWidth.apply(this, arguments) || 0; + }; + $('.app').scroll($.throttle(50, function () { + scroll_finish(); + })); archive.initialize(); }); diff --git a/zproject/settings.py b/zproject/settings.py index 2e41a19130..b865d721a0 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -1170,11 +1170,16 @@ JS_SPECS = { 'archive': { 'source_filenames': [ 'js/archive.js', + 'js/colorspace.js', + 'js/floating_recipient_bar.js', 'js/timerender.js', 'node_modules/handlebars/dist/handlebars.runtime.js', 'js/templates.js', 'js/stream_color.js', + 'js/scroll_bar.js', 'node_modules/xdate/src/xdate.js', + 'node_modules/perfect-scrollbar/dist/perfect-scrollbar.js', + 'third/jquery-throttle-debounce/jquery.ba-throttle-debounce.js', 'templates/compiled.js', ], 'output_filename': 'min/archive.js'