var topic_list = (function () { var exports = {}; // We can only ever have one active widget. var active_widget; // We know whether we're zoomed or not. var zoomed = false; exports.remove_expanded_topics = function () { popovers.hide_topic_sidebar_popover(); if (active_widget) { active_widget.remove(); } }; function update_count_in_dom(count_span, value_span, count) { if (count === 0) { count_span.hide(); value_span.text(''); } else { count_span.removeClass("zero_count"); count_span.show(); value_span.text(count); } } exports.set_count = function (stream_name, topic, count) { if (active_widget && active_widget.is_for_stream(stream_name)) { active_widget.set_count(topic, count); } }; exports.build_widget = function (parent_elem, stream, active_topic, max_topics) { var self = {}; self.topic_items = new Dict({fold_case: true}); function build_list(stream, active_topic, max_topics) { var topics = stream_data.get_recent_topics(stream) || []; if (active_topic) { active_topic = active_topic.toLowerCase(); } var hiding_topics = false; var ul = $('