<commit_before>NEWSBLUR.Views.FeedList = Backbone.View.extend({
    
    tagName: 'ul',
    
    className: 'folder NB-feedlist',
    
    options: {
        sorting: false
    },
    
    initialize: function() {
        this.$s = NEWSBLUR.reader.$s;
        
        if (!this.$el.length) return;
        if (this.options.feed_chooser) {
            this.$el.addClass('NB-feedchooser');
            this.$el.addClass('unread_view_positive');
            this.$el.attr('id', 'NB-feedchooser-feeds');
            return;
        }
        
        $('.NB-callout-ftux .NB-callout-text').text('Loading feeds...');
        this.$s.$feed_link_loader.css({'display': 'block'});
        NEWSBLUR.assets.feeds.bind('reset', _.bind(function() {
            this.make_feeds();
    
            // TODO: Refactor this to load after both feeds and social feeds load.
            this.load_router();
            this.update_dashboard_count();
            this.scroll_to_selected();
        }, this));
        NEWSBLUR.assets.social_feeds.bind('reset', _.bind(function() {
            this.make_social_feeds();
        }, this));
        NEWSBLUR.assets.starred_feeds.bind('reset', _.bind(function(models, options) {
            this.make_starred_tags(options);
        }, this));
        NEWSBLUR.assets.social_feeds.bind('change:selected', this.scroll_to_selected, this);
        NEWSBLUR.assets.feeds.bind('change:selected', this.scroll_to_selected, this);
        NEWSBLUR.assets.starred_feeds.bind('change:selected', this.scroll_to_selected, this);
        if (!NEWSBLUR.assets.folders.size()) {
            NEWSBLUR.assets.load_feeds();
        }
        NEWSBLUR.assets.feeds.bind('add', this.update_dashboard_count, this);
        NEWSBLUR.assets.feeds.bind('remove', this.update_dashboard_count, this);
    },
    
    make_feeds: function(options) {
        options = options || {};
        var self = this;
        var folders = NEWSBLUR.assets.folders;
        var feeds = NEWSBLUR.assets.feeds;
        
        this.$el.empty();
        this.$s.$story_taskbar.css({'display': 'block'});
        var $feeds = new NEWSBLUR.Views.Folder({
            collection: folders, 
            root: true,
            feed_chooser: this.options.feed_chooser
        }).render().el;
        this.$el.css({
            'display': 'block', 
            'opacity': 0
        });
        this.$el.html($feeds);
        this.$el.animate({'opacity': 1}, {'duration': 700});
        // this.count_collapsed_unread_stories();
        this.$s.$feed_link_loader.fadeOut(250, _.bind(function() {
            this.$s.$feed_link_loader.css({'display': 'none'});
        }, this));

        if (!this.options.feed_chooser && 
            NEWSBLUR.Globals.is_authenticated && 
            NEWSBLUR.assets.flags['has_chosen_feeds']) {
            _.delay(function() {
                NEWSBLUR.reader.start_count_unreads_after_import();
            }, 1000);
            NEWSBLUR.reader.flags['refresh_inline_feed_delay'] = true;
            NEWSBLUR.reader.force_feeds_refresh(function() {
                NEWSBLUR.reader.finish_count_unreads_after_import();
            }, true, null, function() {
                NEWSBLUR.reader.finish_count_unreads_after_import({error: true});
            });
        }
        
        if (folders.length && !this.options.feed_chooser) {
            $('.NB-task-manage').removeClass('NB-disabled');
            $('.NB-callout-ftux').fadeOut(500);
            // this.load_sortable_feeds();
            _.delay(_.bind(NEWSBLUR.reader.update_starred_count, NEWSBLUR.reader), 250);
            NEWSBLUR.reader.check_hide_getting_started();
            $('.NB-feeds-header-river-sites-container').css({
                'display': 'block',
                'opacity': 0
            }).animate({'opacity': 1}, {'duration': 700});
        }
        $('.NB-feeds-header-river-global-container').css({
            'display': 'block',
            'opacity': 0
        }).animate({'opacity': 1}, {'duration': 700});
        
        if (!this.options.feed_chooser &&
            (NEWSBLUR.reader.flags['showing_feed_in_tryfeed_view'] ||
             NEWSBLUR.reader.flags['showing_social_feed_in_tryfeed_view'])) {
            NEWSBLUR.reader.hide_tryfeed_view();
            NEWSBLUR.reader.force_feed_refresh();
        }
        
        if (!this.options.feed_chooser) {
            _.defer(_.bind(function() {
                NEWSBLUR.reader.open_dialog_after_feeds_loaded();
                NEWSBLUR.reader.toggle_focus_in_slider();
                this.scroll_to_selected();
                if (NEWSBLUR.reader.socket) {
                    NEWSBLUR.reader.send_socket_active_feeds();
                } else {
                    var force_socket = NEWSBLUR.Globals.is_admin;
                    NEWSBLUR.reader.setup_socket_realtime_unread_counts(force_socket);
                }
            }, this));
        }
        
        return this;
    },
    
    make_social_feeds: function() {
        var $social_feeds = $('.NB-socialfeeds', this.$s.$social_feeds);
        var profile = NEWSBLUR.assets.user_profile;
        var $feeds = NEWSBLUR.assets.social_feeds.map(function(feed) {
            var feed_view = new NEWSBLUR.Views.FeedTitleView({
                model: feed, 
                type: 'feed', 
                depth: 0
            }).render();
            feed.views.push(feed_view);
            return feed_view.el;
        });

        $social_feeds.empty().css({
            'display': 'block', 
            'opacity': 0
        });            
        $social_feeds.html($feeds);
        if (NEWSBLUR.assets.social_feeds.length) {
            $('.NB-feeds-header-river-blurblogs-container').css({
                'display': 'block',
                'opacity': 0
            }).animate({'opacity': 1}, {'duration': 700});
        }

        var collapsed = NEWSBLUR.app.sidebar.check_river_blurblog_collapsed({skip_animation: true});
        $social_feeds.animate({'opacity': 1}, {'duration': collapsed ? 0 : 700});

        // if (this.socket) {
        //     this.send_socket_active_feeds();
        // }
        
        $('.NB-module-stats-count-shared-stories .NB-module-stats-count-number').text(profile.get('shared_stories_count'));
        $('.NB-module-stats-count-followers .NB-module-stats-count-number').text(profile.get('follower_count'));
        $('.NB-module-stats-count-following .NB-module-stats-count-number').text(profile.get('following_count'));
    },
    
    make_starred_tags: function(options) {
        options = options || {};
        var $starred_feeds = $('.NB-starred-feeds', this.$s.$starred_feeds);
        var $feeds = NEWSBLUR.assets.starred_feeds.map(function(feed) {
            var feed_view = new NEWSBLUR.Views.FeedTitleView({
                model: feed, 
                type: 'feed', 
                depth: 0
            }).render();
            feed.views.push(feed_view);
            return feed_view.el;
        });

        $starred_feeds.empty().css({
            'display': 'block', 
            'opacity': options.update ? 1 : 0
        });            
        $starred_feeds.html($feeds);
        if (NEWSBLUR.assets.starred_feeds.length) {
            $('.NB-feeds-header-starred-container').css({
                'display': 'block',
                'opacity': 0
            }).animate({'opacity': 1}, {'duration': options.update ? 0 : 700});
        }
<commit_msg>Removing empty saved tag in front-end. Can always remove the backend if necessary.<commit_after>NEWSBLUR.Views.FeedList = Backbone.View.extend({
    
    tagName: 'ul',
    
    className: 'folder NB-feedlist',
    
    options: {
        sorting: false
    },
    
    initialize: function() {
        this.$s = NEWSBLUR.reader.$s;
        
        if (!this.$el.length) return;
        if (this.options.feed_chooser) {
            this.$el.addClass('NB-feedchooser');
            this.$el.addClass('unread_view_positive');
            this.$el.attr('id', 'NB-feedchooser-feeds');
            return;
        }
        
        $('.NB-callout-ftux .NB-callout-text').text('Loading feeds...');
        this.$s.$feed_link_loader.css({'display': 'block'});
        NEWSBLUR.assets.feeds.bind('reset', _.bind(function() {
            this.make_feeds();
    
            // TODO: Refactor this to load after both feeds and social feeds load.
            this.load_router();
            this.update_dashboard_count();
            this.scroll_to_selected();
        }, this));
        NEWSBLUR.assets.social_feeds.bind('reset', _.bind(function() {
            this.make_social_feeds();
        }, this));
        NEWSBLUR.assets.starred_feeds.bind('reset', _.bind(function(models, options) {
            this.make_starred_tags(options);
        }, this));
        NEWSBLUR.assets.social_feeds.bind('change:selected', this.scroll_to_selected, this);
        NEWSBLUR.assets.feeds.bind('change:selected', this.scroll_to_selected, this);
        NEWSBLUR.assets.starred_feeds.bind('change:selected', this.scroll_to_selected, this);
        if (!NEWSBLUR.assets.folders.size()) {
            NEWSBLUR.assets.load_feeds();
        }
        NEWSBLUR.assets.feeds.bind('add', this.update_dashboard_count, this);
        NEWSBLUR.assets.feeds.bind('remove', this.update_dashboard_count, this);
    },
    
    make_feeds: function(options) {
        options = options || {};
        var self = this;
        var folders = NEWSBLUR.assets.folders;
        var feeds = NEWSBLUR.assets.feeds;
        
        this.$el.empty();
        this.$s.$story_taskbar.css({'display': 'block'});
        var $feeds = new NEWSBLUR.Views.Folder({
            collection: folders, 
            root: true,
            feed_chooser: this.options.feed_chooser
        }).render().el;
        this.$el.css({
            'display': 'block', 
            'opacity': 0
        });
        this.$el.html($feeds);
        this.$el.animate({'opacity': 1}, {'duration': 700});
        // this.count_collapsed_unread_stories();
        this.$s.$feed_link_loader.fadeOut(250, _.bind(function() {
            this.$s.$feed_link_loader.css({'display': 'none'});
        }, this));

        if (!this.options.feed_chooser && 
            NEWSBLUR.Globals.is_authenticated && 
            NEWSBLUR.assets.flags['has_chosen_feeds']) {
            _.delay(function() {
                NEWSBLUR.reader.start_count_unreads_after_import();
            }, 1000);
            NEWSBLUR.reader.flags['refresh_inline_feed_delay'] = true;
            NEWSBLUR.reader.force_feeds_refresh(function() {
                NEWSBLUR.reader.finish_count_unreads_after_import();
            }, true, null, function() {
                NEWSBLUR.reader.finish_count_unreads_after_import({error: true});
            });
        }
        
        if (folders.length && !this.options.feed_chooser) {
            $('.NB-task-manage').removeClass('NB-disabled');
            $('.NB-callout-ftux').fadeOut(500);
            // this.load_sortable_feeds();
            _.delay(_.bind(NEWSBLUR.reader.update_starred_count, NEWSBLUR.reader), 250);
            NEWSBLUR.reader.check_hide_getting_started();
            $('.NB-feeds-header-river-sites-container').css({
                'display': 'block',
                'opacity': 0
            }).animate({'opacity': 1}, {'duration': 700});
        }
        $('.NB-feeds-header-river-global-container').css({
            'display': 'block',
            'opacity': 0
        }).animate({'opacity': 1}, {'duration': 700});
        
        if (!this.options.feed_chooser &&
            (NEWSBLUR.reader.flags['showing_feed_in_tryfeed_view'] ||
             NEWSBLUR.reader.flags['showing_social_feed_in_tryfeed_view'])) {
            NEWSBLUR.reader.hide_tryfeed_view();
            NEWSBLUR.reader.force_feed_refresh();
        }
        
        if (!this.options.feed_chooser) {
            _.defer(_.bind(function() {
                NEWSBLUR.reader.open_dialog_after_feeds_loaded();
                NEWSBLUR.reader.toggle_focus_in_slider();
                this.scroll_to_selected();
                if (NEWSBLUR.reader.socket) {
                    NEWSBLUR.reader.send_socket_active_feeds();
                } else {
                    var force_socket = NEWSBLUR.Globals.is_admin;
                    NEWSBLUR.reader.setup_socket_realtime_unread_counts(force_socket);
                }
            }, this));
        }
        
        return this;
    },
    
    make_social_feeds: function() {
        var $social_feeds = $('.NB-socialfeeds', this.$s.$social_feeds);
        var profile = NEWSBLUR.assets.user_profile;
        var $feeds = NEWSBLUR.assets.social_feeds.map(function(feed) {
            var feed_view = new NEWSBLUR.Views.FeedTitleView({
                model: feed, 
                type: 'feed', 
                depth: 0
            }).render();
            feed.views.push(feed_view);
            return feed_view.el;
        });

        $social_feeds.empty().css({
            'display': 'block', 
            'opacity': 0
        });            
        $social_feeds.html($feeds);
        if (NEWSBLUR.assets.social_feeds.length) {
            $('.NB-feeds-header-river-blurblogs-container').css({
                'display': 'block',
                'opacity': 0
            }).animate({'opacity': 1}, {'duration': 700});
        }

        var collapsed = NEWSBLUR.app.sidebar.check_river_blurblog_collapsed({skip_animation: true});
        $social_feeds.animate({'opacity': 1}, {'duration': collapsed ? 0 : 700});

        // if (this.socket) {
        //     this.send_socket_active_feeds();
        // }
        
        $('.NB-module-stats-count-shared-stories .NB-module-stats-count-number').text(profile.get('shared_stories_count'));
        $('.NB-module-stats-count-followers .NB-module-stats-count-number').text(profile.get('follower_count'));
        $('.NB-module-stats-count-following .NB-module-stats-count-number').text(profile.get('following_count'));
    },
    
    make_starred_tags: function(options) {
        options = options || {};
        var $starred_feeds = $('.NB-starred-feeds', this.$s.$starred_feeds);
        var $feeds = _.compact(NEWSBLUR.assets.starred_feeds.map(function(feed) {
            if (feed.get('tag') == "") return;
            var feed_view = new NEWSBLUR.Views.FeedTitleView({
                model: feed, 
                type: 'feed', 
                depth: 0
            }).render();
            feed.views.push(feed_view);
            return feed_view.el;
        }));

        $starred_feeds.empty().css({
            'display': 'block', 
            'opacity': options.update ? 1 : 0
        });            
        $starred_feeds.html($feeds);
        if (NEWSBLUR.assets.starred_feeds.length) {
            $('.NB-feeds-header-starred-container').css({
                'display': 'block',
                'opacity': 0
            }).animate({'opacity': 1}, {'duration': options.update ? 0 : 700});
        }

{'fraction_non_alphanumeric': 0.14794593514881152, 'fraction_numerical': 0.0065250682468872764, 'mean_word_length': 1.9341668294588787, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2966602', 'n_tokens_mistral': 4779, 'n_tokens_neox': 4503, 'n_words': 601}