NEWSBLUR.Views.FeedList = Backbone.View.extend({ initialize: function() { this.$s = NEWSBLUR.reader.$s; if (!$('#feed_list').length) return; $('.NB-callout-ftux .NB-callout-text').text('Loading feeds...'); this.$s.$feed_link_loader.css({'display': 'block'}); NEWSBLUR.reader.flags['favicons_downloaded'] = false; NEWSBLUR.assets.feeds.bind('reset', _.bind(function() { this.make_feeds(); this.load_router(); }, this)); NEWSBLUR.assets.social_feeds.bind('reset', _.bind(function() { this.make_social_feeds(); }, this)); NEWSBLUR.assets.load_feeds(); }, make_feeds: function() { var self = this; var $feed_list = this.$s.$feed_list; var folders = NEWSBLUR.assets.folders; var feeds = NEWSBLUR.assets.feeds; $feed_list.empty(); this.$s.$story_taskbar.css({'display': 'block'}); var $feeds = new NEWSBLUR.Views.Folder({collection: folders, root: true}).render().el; $feed_list.css({ 'display': 'block', 'opacity': 0 }); $feed_list.html($feeds); $feed_list.animate({'opacity': 1}, {'duration': 700}); // this.count_collapsed_unread_stories(); // this.hover_over_feed_titles(); this.$s.$feed_link_loader.fadeOut(250); NEWSBLUR.reader.open_dialog_after_feeds_loaded(); if (NEWSBLUR.Globals.is_authenticated && NEWSBLUR.assets.flags['has_chosen_feeds']) { _.delay(_.bind(this.start_count_unreads_after_import, this), 1000); this.flags['refresh_inline_feed_delay'] = true; this.force_feeds_refresh($.rescope(this.finish_count_unreads_after_import, this), true); } if (folders.length) { $('.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(); } // if (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(); // } // _.defer(_.bind(function() { // NEWSBLUR.reader.make_feed_favicons(); // // NEWSBLUR.assets.load_feed_favicons($.rescope(this.make_feed_favicons, this), this.flags['favicons_downloaded'], NEWSBLUR.assets.flags['has_chosen_feeds']); // 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); // } // }, NEWSBLUR.reader)); }, make_social_feeds: function() { var $social_feeds = this.$s.$social_feeds; var profile = NEWSBLUR.assets.user_profile; var $feeds = NEWSBLUR.assets.social_feeds.map(function(feed) { return new NEWSBLUR.Views.Feed({model: feed, type: 'feed', depth: 0}).render().el; }); $social_feeds.empty().css({ 'display': 'block', 'opacity': 0 }); $social_feeds.html($feeds); $social_feeds.animate({'opacity': 1}, {'duration': 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')); }, load_router: function() { if (!NEWSBLUR.router) { NEWSBLUR.router = new NEWSBLUR.Router; var route_found = Backbone.history.start({pushState: true}); this.load_url_next_param(route_found); } }, load_url_next_param: function(route_found) { var next = $.getQueryString('next'); if (next == 'optout') { NEWSBLUR.reader.open_account_modal({'animate_email': true}); } else if (next == 'goodies') { NEWSBLUR.reader.open_goodies_modal(); } else if (next == 'password') { NEWSBLUR.reader.open_account_modal({'change_password': true}); } var url = $.getQueryString('url'); if (url) { NEWSBLUR.reader.open_add_feed_modal({url: url}); } if (!route_found && window.history.replaceState) { // In case this needs to be found again: window.location.href = BACKBONE window.history.replaceState({}, null, '/'); } } });