var topic_list = (function () { var exports = {}; // Once we are ready to clean up CSS for some of the features // hidden by this flag, we should just revert the whole commit // here (do `git blame` on this line). waiting_on_css_polish_for_more_topics = true; // 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(); active_widget = undefined; } }; exports.close = function () { zoomed = false; exports.remove_expanded_topics(); }; exports.zoom_out = function () { zoomed = false; exports.rebuild(active_widget.get_parent(), active_widget.get_stream_id()); }; 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_id, topic, count) { if (active_widget && active_widget.is_for_stream(stream_id)) { active_widget.set_count(topic, count); } }; exports.widget = function (parent_elem, my_stream_id) { var self = {}; self.build_list = function () { self.topic_items = new Dict({fold_case: true}); var max_topics = 5; var topic_names = topic_data.get_recent_names(my_stream_id); var my_stream_name = stream_data.get_sub_by_id(my_stream_id).name; var ul = $('