Fetching story positions when expanding a story's comments.

This commit is contained in:
Samuel Clay 2012-06-19 14:21:43 -07:00
parent ef6ba48dc3
commit f59ad8b967
6 changed files with 27 additions and 13 deletions

View file

@ -216,8 +216,10 @@ NEWSBLUR.Views.OriginalTabView = Backbone.View.extend({
var stories = NEWSBLUR.assets.stories;
var $iframe = this.$el.contents();
var prefetch_tries_left = 3;
this.cache['prefetch_iteration'] += 1;
if (!this.flags['iframe_loaded']) return;
this.cache['prefetch_iteration'] += 1;
NEWSBLUR.log(['Prefetching Original', !this.flags['iframe_fetching_story_locations'], !this.flags['iframe_story_locations_fetched']]);
if (!this.flags['iframe_fetching_story_locations']
&& !this.flags['iframe_story_locations_fetched']) {
@ -357,6 +359,7 @@ NEWSBLUR.Views.OriginalTabView = Backbone.View.extend({
});
$.extend(this.flags, {
'iframe_loaded': false,
'iframe_scroll_snapback_check': false,
'iframe_view_not_busting': false,
'iframe_fetching_story_locations': false,
@ -376,6 +379,8 @@ NEWSBLUR.Views.OriginalTabView = Backbone.View.extend({
this.unload_feed_iframe();
this.flags['iframe_loaded'] = true;
var page_url = '/reader/page/'+feed_id;
if (NEWSBLUR.reader.flags['social_view']) {
var feed = NEWSBLUR.assets.get_feed(feed_id);

View file

@ -101,7 +101,8 @@ NEWSBLUR.Views.StoryComment = Backbone.View.extend({
this.remove_social_comment_reply_form();
}, this));
$('input', $form).focus();
// this.fetch_story_locations_in_feed_view();
NEWSBLUR.app.story_list.fetch_story_locations_in_feed_view();
},
remove_social_comment_reply_form: function() {
@ -118,7 +119,7 @@ NEWSBLUR.Views.StoryComment = Backbone.View.extend({
if (!comment_reply || comment_reply.length <= 1) {
this.remove_social_comment_reply_form();
// this.fetch_story_locations_in_feed_view();
NEWSBLUR.app.story_list.fetch_story_locations_in_feed_view();
return;
}
@ -133,7 +134,7 @@ NEWSBLUR.Views.StoryComment = Backbone.View.extend({
_.bind(function(data) {
this.model.set(data.comment);
this.render();
// this.fetch_story_locations_in_feed_view();
NEWSBLUR.app.story_list.fetch_story_locations_in_feed_view();
}, this), _.bind(function(data) {
var message = data && data.message || "Sorry, this reply could not be posted. Probably a bug.";
if (!NEWSBLUR.Globals.is_authenticated) {
@ -143,7 +144,7 @@ NEWSBLUR.Views.StoryComment = Backbone.View.extend({
$submit.removeClass('NB-disabled').text('Post');
$form.find('.NB-error').remove();
$form.append($error);
// this.fetch_story_locations_in_feed_view();
NEWSBLUR.app.story_list.fetch_story_locations_in_feed_view();
}, this));
}

View file

@ -111,7 +111,7 @@ NEWSBLUR.Views.StoryCommentsView = Backbone.View.extend({
}, this));
this.$('.NB-story-comments-public-teaser-wrapper').replaceWith($comments);
// this.fetch_story_locations_in_feed_view();
NEWSBLUR.app.story_list.fetch_story_locations_in_feed_view();
}, this));
}

View file

@ -364,6 +364,7 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
}
$button.css('opacity', 1).fadeOut(400);
$button.tipsy('hide').tipsy('disable');
NEWSBLUR.app.story_list.fetch_story_locations_in_feed_view();
},
open_feed: function() {

View file

@ -236,7 +236,7 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
}, this));
this.flags['feed_view_positions_calculated'] = true;
NEWSBLUR.log(['Feed view entirely loaded', NEWSBLUR.assets.stories.length + " stories", this.counts['feed_view_positions_timer']/1000 + " sec delay"]);
// NEWSBLUR.log(['Feed view entirely loaded', NEWSBLUR.assets.stories.length + " stories", this.counts['feed_view_positions_timer']/1000 + " sec delay"]);
this.counts['feed_view_positions_timer'] = Math.max(this.counts['feed_view_positions_timer']*2, 1000);
clearTimeout(this.flags['next_fetch']);

View file

@ -59,8 +59,10 @@ NEWSBLUR.Views.StoryShareView = Backbone.View.extend({
}, {
'duration': 300,
'easing': 'easeInOutQuint',
'queue': false
// 'complete': _.bind(this.fetch_story_locations_in_feed_view, this, {'reset_timer': true})
'queue': false,
'complete': function() {
NEWSBLUR.app.story_list.fetch_story_locations_in_feed_view();
}
});
$story_content.removeData('original_height');
}
@ -100,8 +102,10 @@ NEWSBLUR.Views.StoryShareView = Backbone.View.extend({
}, {
'duration': 350,
'easing': 'easeInOutQuint',
'queue': false
// 'complete': _.bind(this.fetch_story_locations_in_feed_view, this, {'reset_timer': true})
'queue': false,
'complete': function() {
NEWSBLUR.app.story_list.fetch_story_locations_in_feed_view();
}
}).data('original_height', original_height);
}
this.update_share_button_label();
@ -109,7 +113,10 @@ NEWSBLUR.Views.StoryShareView = Backbone.View.extend({
e.preventDefault();
this.mark_story_as_shared({'source': 'sideoption'});
}, this);
$('.NB-sideoption-share-comments', $share).bind('keydown', 'ctrl+return,meta+return', share);
var $comments = $('.NB-sideoption-share-comments', $share);
$comments.unbind('keydown')
.bind('keydown', 'ctrl+return', share)
.bind('keydown', 'meta+return', share);
}
},
@ -157,7 +164,7 @@ NEWSBLUR.Views.StoryShareView = Backbone.View.extend({
tipsy.disable();
}
}, 850);
// this.fetch_story_locations_in_feed_view({'reset_timer': true});
NEWSBLUR.app.story_list.fetch_story_locations_in_feed_view();
}, this), _.bind(function(data) {
var message = data && data.message || "Sorry, this story could not be shared. Probably a bug.";
if (!NEWSBLUR.Globals.is_authenticated) {