Completely replace perfect-scrollbar with SimpleBar.

perfect-scrollbar replaces both the appearance and the behavior of the
scrollbar, and its emulated behavior will never feel native on most
platforms.  SimpleBar customizes the appearance while preserving the
native behavior.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg
2019-02-28 16:40:05 -08:00
committed by Tim Abbott
parent 491589579a
commit 141088586b
35 changed files with 111 additions and 134 deletions

View File

@@ -230,11 +230,12 @@ exports.add_sub_to_table = function (sub) {
var html = templates.render('subscription', sub);
var settings_html = templates.render('subscription_settings', sub);
if (stream_create.get_name() === sub.name) {
$(".streams-list").prepend(html).scrollTop(0);
ui.get_content_element($(".streams-list")).prepend(html);
ui.reset_scrollbar($(".streams-list"));
} else {
$(".streams-list").append(html);
ui.get_content_element($(".streams-list")).append(html);
}
$(".subscriptions .settings").append($(settings_html));
ui.get_content_element($(".subscriptions .settings")).append($(settings_html));
if (stream_create.get_name() === sub.name) {
// This `stream_create.get_name()` check tells us whether the
@@ -393,7 +394,7 @@ exports.populate_stream_settings_left_panel = function () {
subscriptions: sub_rows,
};
var html = templates.render('subscriptions', template_data);
$('#subscriptions_table .streams-list').html(html);
ui.get_content_element($('#subscriptions_table .streams-list')).html(html);
};
// query is now an object rather than a string.
@@ -402,7 +403,7 @@ exports.filter_table = function (query) {
exports.show_active_stream_in_left_panel();
var widgets = {};
var streams_list_scrolltop = $(".streams-list").scrollTop();
var streams_list_scrolltop = ui.get_scroll_element($(".streams-list")).scrollTop();
var stream_ids = [];
_.each($("#subscriptions_table .stream-row"), function (row) {
@@ -443,13 +444,13 @@ exports.filter_table = function (query) {
);
_.each(all_stream_ids, function (stream_id) {
$('#subscriptions_table .streams-list').append(widgets[stream_id]);
ui.get_content_element($('#subscriptions_table .streams-list')).append(widgets[stream_id]);
});
exports.maybe_reset_right_panel();
// this puts the scrollTop back to what it was before the list was updated again.
$(".streams-list").scrollTop(streams_list_scrolltop);
ui.get_scroll_element($(".streams-list")).scrollTop(streams_list_scrolltop);
};
var subscribed_only = true;