Fixing single story mode.

This commit is contained in:
Samuel Clay 2013-04-26 15:09:51 -07:00
parent 325a4e677b
commit 3ad469a1c1
2 changed files with 23 additions and 5 deletions

View file

@ -334,6 +334,10 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
scroll_offset: -50,
scroll_to_comments: true
});
} else if (NEWSBLUR.assets.preference('feed_view_single_story')) {
NEWSBLUR.app.story_list.scroll_to_selected_story(model, {
'scroll_to_top': true
});
} else if (selected &&
!options.selected_by_scrolling &&
(NEWSBLUR.reader.story_view == 'feed' ||
@ -444,9 +448,6 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
// = Actions =
// ===========
select_story: function() {
},
preserve_classifier_color: function(classifier_type, value, score) {
var $tag;
this.$('.NB-feed-story-'+classifier_type).each(function() {

View file

@ -9,6 +9,7 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
this.collection.bind('add', this.add, this);
this.collection.bind('add', this.reset_story_positions, this);
this.collection.bind('no_more_stories', this.show_no_more_stories, this);
this.collection.bind('change:selected', this.show_only_selected_story, this);
this.$el.bind('mousemove', _.bind(this.handle_mousemove_feed_view, this));
this.$el.scroll(_.bind(this.handle_scroll_feed_view, this));
this.reset_flags();
@ -90,7 +91,9 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
if (!story || !story.story_view) return;
var $story = story.story_view.$el;
if (NEWSBLUR.assets.preference('feed_view_single_story')) return;
if (NEWSBLUR.assets.preference('feed_view_single_story')) {
options.immediate = true;
}
if (!NEWSBLUR.assets.preference('animations')) options.immediate = true;
if (options.scroll_to_comments) {
$story = $('.NB-feed-story-comments', $story);
@ -103,7 +106,8 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
clearTimeout(NEWSBLUR.reader.locks.scrolling);
NEWSBLUR.reader.flags.scrolling_by_selecting_story_title = true;
this.$el.scrollable().stop();
this.$el.scrollTo($story, {
var scroll_to = options.scroll_to_top ? 0 : $story;
this.$el.scrollTo(scroll_to, {
duration: options.immediate ? 0 : 340,
axis: 'y',
easing: 'easeInOutQuint',
@ -117,6 +121,19 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
});
},
show_only_selected_story: function() {
if (!NEWSBLUR.assets.preference('feed_view_single_story')) return;
this.collection.each(function(story) {
if (story.get('selected')) {
story.story_view.$el.show();
} else {
story.story_view.$el.hide();
}
});
},
show_no_more_stories: function() {
this.$('.NB-feed-story-endbar').remove();
var $end_stories_line = $.make('div', {