2019-11-02 00:06:25 +01:00
|
|
|
let zoomed_in = false;
|
2018-09-10 23:26:12 +02:00
|
|
|
|
2018-09-11 13:04:57 +02:00
|
|
|
exports.is_zoomed_in = function () {
|
|
|
|
return zoomed_in;
|
|
|
|
};
|
|
|
|
|
2018-09-10 14:52:58 +02:00
|
|
|
function zoom_in() {
|
2019-11-02 00:06:25 +01:00
|
|
|
const stream_id = topic_list.active_stream_id();
|
2018-09-10 14:52:58 +02:00
|
|
|
|
2019-07-10 01:54:39 +02:00
|
|
|
popovers.hide_all_except_sidebars();
|
2018-09-10 14:52:58 +02:00
|
|
|
topic_list.zoom_in();
|
|
|
|
stream_list.zoom_in_topics({
|
|
|
|
stream_id: stream_id,
|
|
|
|
});
|
2018-09-10 23:26:12 +02:00
|
|
|
|
|
|
|
zoomed_in = true;
|
2018-09-10 14:52:58 +02:00
|
|
|
}
|
|
|
|
|
2018-09-11 13:04:57 +02:00
|
|
|
exports.zoom_out = function () {
|
2019-11-02 00:06:25 +01:00
|
|
|
const stream_li = topic_list.get_stream_li();
|
2018-09-10 14:52:58 +02:00
|
|
|
|
2019-07-10 01:54:39 +02:00
|
|
|
popovers.hide_all_except_sidebars();
|
2018-09-10 14:52:58 +02:00
|
|
|
topic_list.zoom_out();
|
|
|
|
stream_list.zoom_out_topics();
|
|
|
|
|
|
|
|
if (stream_li) {
|
|
|
|
stream_list.scroll_stream_into_view(stream_li);
|
|
|
|
}
|
2018-09-10 23:26:12 +02:00
|
|
|
|
|
|
|
zoomed_in = false;
|
2018-09-11 13:04:57 +02:00
|
|
|
};
|
2018-09-10 14:52:58 +02:00
|
|
|
|
2018-09-10 23:15:55 +02:00
|
|
|
exports.clear_topics = function () {
|
2019-11-02 00:06:25 +01:00
|
|
|
const stream_li = topic_list.get_stream_li();
|
2018-09-10 23:45:31 +02:00
|
|
|
|
2018-09-10 23:15:55 +02:00
|
|
|
topic_list.close();
|
2018-09-10 23:26:12 +02:00
|
|
|
|
|
|
|
if (zoomed_in) {
|
|
|
|
stream_list.zoom_out_topics();
|
2018-09-10 23:45:31 +02:00
|
|
|
|
|
|
|
if (stream_li) {
|
|
|
|
stream_list.scroll_stream_into_view(stream_li);
|
|
|
|
}
|
2018-09-10 23:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
zoomed_in = false;
|
2018-09-10 23:15:55 +02:00
|
|
|
};
|
|
|
|
|
2018-09-10 14:52:58 +02:00
|
|
|
exports.initialize = function () {
|
|
|
|
$('#stream_filters').on('click', '.show-more-topics', function (e) {
|
|
|
|
zoom_in();
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.show-all-streams').on('click', function (e) {
|
2018-09-11 13:04:57 +02:00
|
|
|
exports.zoom_out();
|
2018-09-10 14:52:58 +02:00
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2019-10-25 09:45:13 +02:00
|
|
|
window.topic_zoom = exports;
|