2018-09-10 14:52:58 +02:00
|
|
|
var topic_zoom = (function () {
|
|
|
|
|
|
|
|
var exports = {};
|
|
|
|
|
2018-09-10 23:26:12 +02:00
|
|
|
var zoomed_in = false;
|
|
|
|
|
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() {
|
|
|
|
var stream_id = topic_list.active_stream_id();
|
|
|
|
|
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 () {
|
2018-09-10 14:52:58 +02:00
|
|
|
var stream_li = topic_list.get_stream_li();
|
|
|
|
|
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 () {
|
2018-09-10 23:45:31 +02:00
|
|
|
var stream_li = topic_list.get_stream_li();
|
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
return exports;
|
|
|
|
}());
|
|
|
|
if (typeof module !== 'undefined') {
|
|
|
|
module.exports = topic_zoom;
|
|
|
|
}
|
|
|
|
window.topic_zoom = topic_zoom;
|