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 () { stream_popover.hide_topic_popover(); if (active_widget) { active_widget.remove(); } }; function update_unread_count(unread_count_elem, count) { // unread_count_elem is a jquery element...we expect DOM // to look like this: //
//
{{unread}}
//
var value_span = unread_count_elem.find('.value'); if (value_span.length === 0) { blueslip.error('malformed dom for unread count'); return; } if (count === 0) { unread_count_elem.hide(); value_span.text(''); } else { unread_count_elem.removeClass("zero_count"); unread_count_elem.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 = $('