Big change: stories now remember their own view (text/feed/story), so reading through a river switches between views. matches iOS.

This commit is contained in:
Samuel Clay 2016-12-08 16:32:59 -08:00
parent 1287511366
commit a3a402eab1
7 changed files with 123 additions and 47 deletions

View file

@ -6503,11 +6503,27 @@ form.opml_import_form input {
} }
.NB-module-premium .NB-module-item-intro { .NB-module-premium .NB-module-item-intro {
border: 1px solid #F7E7BC; border-radius: 3px;
background-color: #FFFCF3; border: 1px solid #ebc17c;
padding: 0 8px 4px 0px;
background-color: #FFED68;
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.16, #fff5cc),
color-stop(0.84, #fff7d4)
);
background-image: -moz-linear-gradient(
center bottom,
#fff5cc 16%,
#fff7d4 84%
);
-moz-box-shadow:0 2px 0px #ebc17c;
box-shadow:0 2px 0px #ebc17c;
margin-bottom: 2px;
padding: 12px; padding: 12px;
overflow: hidden; overflow: hidden;
border-radius: 4px;
font-size: 14px; font-size: 14px;
text-align: center; text-align: center;
} }
@ -6518,7 +6534,7 @@ form.opml_import_form input {
font-size: 12px; font-size: 12px;
text-transform: uppercase; text-transform: uppercase;
margin: 12px 0 0; margin: 12px 0 0;
color: #909090; color: #ebc17c;
} }
/* ================= */ /* ================= */
@ -9136,24 +9152,24 @@ form.opml_import_form input {
display: block; display: block;
} }
.NB-modal-feedchooser .NB-modal-submit.NB-modal-submit-paypal { .NB-modal-feedchooser .NB-modal-submit.NB-modal-submit-paypal {
border-radius: 12px; border-radius: 3px;
border: 1px solid #F6BD44; border: 1px solid #ebc17c;
padding: 0 8px 4px 0px; padding: 0 8px 4px 0px;
background-color: #FFED68; background-color: #FFED68;
background-image: -webkit-gradient( background-image: -webkit-gradient(
linear, linear,
left bottom, left bottom,
left top, left top,
color-stop(0.16, #FFED68), color-stop(0.16, #fff5cc),
color-stop(0.84, #FFF8B1) color-stop(0.84, #fff7d4)
); );
background-image: -moz-linear-gradient( background-image: -moz-linear-gradient(
center bottom, center bottom,
#FFED68 16%, #fff5cc 16%,
#FFF8B1 84% #fff7d4 84%
); );
-moz-box-shadow:0 2px 2px #CE972F; -moz-box-shadow:0 2px 0px #ebc17c;
box-shadow:0 2px 2px #CE972F; box-shadow:0 2px 0px #ebc17c;
} }
@ -9182,8 +9198,8 @@ form.opml_import_form input {
} }
.NB-modal-feedchooser .NB-feedchooser-stripe .NB-modal-submit-green { .NB-modal-feedchooser .NB-feedchooser-stripe .NB-modal-submit-green {
-moz-box-shadow:2px 2px 0 #E2D121; /* -moz-box-shadow:0 2px 0 #1a5e0e;*/
box-shadow:2px 2px 0 #E2D121; /* box-shadow:0 2px 0 #1a5e0e;*/
} }
.NB-modal-feedchooser .NB-creditcards img { .NB-modal-feedchooser .NB-creditcards img {
width: 32px; width: 32px;
@ -9197,7 +9213,8 @@ form.opml_import_form input {
} }
.NB-modal-feedchooser .NB-feedchooser-dollar-value { .NB-modal-feedchooser .NB-feedchooser-dollar-value {
padding: 4px 0 4px 36px; /* padding: 4px 0 4px 36px;*/
padding: 4px 0 4px 0px;
text-shadow: 1px 1px 0 #FFF8B1; text-shadow: 1px 1px 0 #FFF8B1;
clear: both; clear: both;
position: relative; position: relative;
@ -9218,6 +9235,7 @@ form.opml_import_form input {
} }
.NB-modal-feedchooser .NB-feedchooser-dollar-value .NB-feedchooser-dollar-image { .NB-modal-feedchooser .NB-feedchooser-dollar-value .NB-feedchooser-dollar-image {
display: none !important;
position: absolute; position: absolute;
width: 40px; width: 40px;
height: 40px; height: 40px;

View file

@ -6,11 +6,17 @@ NEWSBLUR.Models.Story = Backbone.Model.extend({
this.bind('change:comment_count', this.populate_comments); this.bind('change:comment_count', this.populate_comments);
this.bind('change:starred', this.change_starred); this.bind('change:starred', this.change_starred);
this.bind('change:user_tags', this.change_user_tags); this.bind('change:user_tags', this.change_user_tags);
this.bind('change:selected', this.select_story);
this.populate_comments(); this.populate_comments();
this.story_permalink = this.get('story_permalink'); this.story_permalink = this.get('story_permalink');
this.story_title = this.get('story_title'); this.story_title = this.get('story_title');
}, },
select_story: function(story, selected) {
console.log(['select_story', this, this.collection, story, selected]);
this.collection.detect_selected_story(this, selected);
},
populate_comments: function(story, collection) { populate_comments: function(story, collection) {
this.friend_comments = new NEWSBLUR.Collections.Comments(this.get('friend_comments')); this.friend_comments = new NEWSBLUR.Collections.Comments(this.get('friend_comments'));
this.friend_shares = new NEWSBLUR.Collections.Comments(this.get('friend_shares')); this.friend_shares = new NEWSBLUR.Collections.Comments(this.get('friend_shares'));
@ -260,7 +266,7 @@ NEWSBLUR.Collections.Stories = Backbone.Collection.extend({
active_story: null, active_story: null,
initialize: function() { initialize: function() {
this.bind('change:selected', this.detect_selected_story, this); // this.bind('change:selected', this.detect_selected_story, this); // Handled in the Story model so it fires first
this.bind('reset', this.clear_previous_stories_stack, this); this.bind('reset', this.clear_previous_stories_stack, this);
// this.bind('change:selected', this.change_selected); // this.bind('change:selected', this.change_selected);
}, },
@ -539,8 +545,8 @@ NEWSBLUR.Collections.Stories = Backbone.Collection.extend({
// ========== // ==========
detect_selected_story: function(selected_story, selected) { detect_selected_story: function(selected_story, selected) {
console.log(['detect_selected_story', selected, selected_story, this.active_story, this == NEWSBLUR.assets.stories ? "stories" : "dashboard"]);
if (selected) { if (selected) {
console.log(['detect_selected_story', selected, selected_story, this.active_story, this == NEWSBLUR.assets.stories ? "stories" : "dashboard"]);
this.deselect_other_stories(selected_story); this.deselect_other_stories(selected_story);
this.active_story = selected_story; this.active_story = selected_story;
NEWSBLUR.reader.active_story = selected_story; NEWSBLUR.reader.active_story = selected_story;

View file

@ -610,6 +610,20 @@
// = Navigation = // = Navigation =
// ============== // ==============
active_story_view: function(feed_id) {
feed_id = feed_id || this.active_feed;
if (_.string.startsWith(feed_id, 'river:')) {
if (this.active_story && this.active_story.get('story_feed_id')) {
feed_id = this.active_story.get('story_feed_id');
console.log(['Hijacking view setting', feed_id, ' --> ',
this.active_story && this.active_story.get('story_feed_id'), NEWSBLUR.assets.view_setting(feed_id, 'view')]);
}
}
return feed_id;
},
show_next_story: function(direction) { show_next_story: function(direction) {
var story = NEWSBLUR.assets.stories.get_next_story(direction, { var story = NEWSBLUR.assets.stories.get_next_story(direction, {
score: this.get_unread_view_score() score: this.get_unread_view_score()
@ -1306,12 +1320,8 @@
this.hide_tryout_signup_button(); this.hide_tryout_signup_button();
} }
this.active_folder = null;
this.active_feed = null;
this.active_story = null;
this.model.stories.deselect();
this.model.feeds.deselect(); this.model.feeds.deselect();
this.model.stories.deselect();
this.model.starred_feeds.deselect(); this.model.starred_feeds.deselect();
if (_.string.contains(this.active_feed, 'social:')) { if (_.string.contains(this.active_feed, 'social:')) {
this.model.social_feeds.deselect(); this.model.social_feeds.deselect();
@ -1319,6 +1329,11 @@
if (_.string.contains(this.active_feed, 'river:')) { if (_.string.contains(this.active_feed, 'river:')) {
this.model.folders.deselect(); this.model.folders.deselect();
} }
this.active_folder = null;
this.active_feed = null;
this.active_story = null;
NEWSBLUR.assets.stories.reset(); NEWSBLUR.assets.stories.reset();
NEWSBLUR.app.feed_selector.hide_feed_selector(); NEWSBLUR.app.feed_selector.hide_feed_selector();
NEWSBLUR.app.original_tab_view.unload_feed_iframe(); NEWSBLUR.app.original_tab_view.unload_feed_iframe();
@ -1521,10 +1536,12 @@
set_correct_story_view_for_feed: function(feed_id, view) { set_correct_story_view_for_feed: function(feed_id, view) {
feed_id = feed_id || this.active_feed; feed_id = feed_id || this.active_feed;
feed_id = this.active_story_view(feed_id);
var feed = NEWSBLUR.assets.get_feed(feed_id); var feed = NEWSBLUR.assets.get_feed(feed_id);
var $original_tabs = $('.task_view_page, .task_view_story'); var $original_tabs = $('.task_view_page, .task_view_story');
var $page_tab = $('.task_view_page'); var $page_tab = $('.task_view_page');
view = view || NEWSBLUR.assets.view_setting(feed_id); view = view || NEWSBLUR.assets.view_setting(feed_id);
console.log(['set_correct_story_view_for_feed', feed_id, view]);
$original_tabs.removeClass('NB-disabled-page') $original_tabs.removeClass('NB-disabled-page')
.removeClass('NB-disabled') .removeClass('NB-disabled')
@ -1534,7 +1551,7 @@
$(this).tipsy('disable'); $(this).tipsy('disable');
}); });
if (feed && if (feed && view == 'original' &&
(feed.get('disabled_page') || (feed.get('disabled_page') ||
NEWSBLUR.utils.is_url_iframe_buster(feed.get('feed_link')))) { NEWSBLUR.utils.is_url_iframe_buster(feed.get('feed_link')))) {
view = 'feed'; view = 'feed';
@ -1615,6 +1632,7 @@
$page_tab.addClass('NB-disabled'); $page_tab.addClass('NB-disabled');
} }
console.log(['setting reader.story_view', view, " was:", this.story_view]);
this.story_view = view; this.story_view = view;
}, },
@ -2028,7 +2046,7 @@
$('.task_view_page', this.$s.$taskbar).addClass('NB-disabled'); $('.task_view_page', this.$s.$taskbar).addClass('NB-disabled');
var explicit_view_setting = this.model.view_setting(this.active_feed, 'view'); var explicit_view_setting = this.model.view_setting(this.active_feed, 'view');
if (!explicit_view_setting || explicit_view_setting == 'page') { if (!explicit_view_setting || explicit_view_setting == 'page') {
explicit_view_setting = 'feed'; explicit_view_setting = 'feed';
} }
this.set_correct_story_view_for_feed(this.active_feed, explicit_view_setting); this.set_correct_story_view_for_feed(this.active_feed, explicit_view_setting);
this.switch_taskbar_view(this.story_view); this.switch_taskbar_view(this.story_view);
@ -2656,7 +2674,7 @@
var feed_id = this.active_feed; var feed_id = this.active_feed;
var feed = this.model.get_feed(feed_id); var feed = this.model.get_feed(feed_id);
console.log(['load_page_of_feed_stories', this.flags['opening_feed'], this.counts['page']]); // console.log(['load_page_of_feed_stories', this.flags['opening_feed'], this.counts['page']]);
if (this.flags['opening_feed']) return; if (this.flags['opening_feed']) return;
this.flags['opening_feed'] = true; this.flags['opening_feed'] = true;
@ -2844,10 +2862,12 @@
switch_taskbar_view: function(view, options) { switch_taskbar_view: function(view, options) {
options = options || {}; options = options || {};
// NEWSBLUR.log(['switch_taskbar_view', view, options.skip_save_type]);
var self = this; var self = this;
var $story_pane = this.$s.$story_pane; var $story_pane = this.$s.$story_pane;
var feed = this.model.get_feed(this.active_feed); var feed_id = this.active_story_view();
var feed = this.model.get_feed(feed_id);
view = view || this.story_view;
NEWSBLUR.log(['switch_taskbar_view', view, options.skip_save_type, feed]);
if (view == 'page' && feed && feed.get('has_exception') && if (view == 'page' && feed && feed.get('has_exception') &&
feed.get('exception_type') == 'page') { feed.get('exception_type') == 'page') {
@ -2874,7 +2894,7 @@
var $to_text_arrow = $('.NB-taskbar .NB-task-view-to-text-arrow'); var $to_text_arrow = $('.NB-taskbar .NB-task-view-to-text-arrow');
if (!options.skip_save_type && this.story_view != view) { if (!options.skip_save_type && this.story_view != view) {
this.model.view_setting(this.active_feed, {'view': view}); this.model.view_setting(feed_id, {'view': view});
} }
NEWSBLUR.app.taskbar_info.hide_stories_error(); NEWSBLUR.app.taskbar_info.hide_stories_error();

View file

@ -307,6 +307,8 @@ _.extend(NEWSBLUR.ReaderFeedchooser.prototype, {
}, },
update_counts: function(initial_load) { update_counts: function(initial_load) {
if (this.options.premium_only) return;
var $count = $('.NB-feedchooser-info-counts'); var $count = $('.NB-feedchooser-info-counts');
var approved = this.feedlist.folder_view.highlighted_count(); var approved = this.feedlist.folder_view.highlighted_count();
var $submit = $('.NB-modal-submit-save', this.$modal); var $submit = $('.NB-modal-submit-save', this.$modal);

View file

@ -20,6 +20,7 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
this.collection.bind('add', this.reset_story_positions, this); this.collection.bind('add', this.reset_story_positions, this);
this.collection.bind('no_more_stories', this.check_premium_river, this); this.collection.bind('no_more_stories', this.check_premium_river, this);
this.collection.bind('no_more_stories', this.check_premium_search, this); this.collection.bind('no_more_stories', this.check_premium_search, this);
this.collection.bind('change:selected', this.switch_story_view, this);
this.collection.bind('change:selected', this.show_only_selected_story, this); this.collection.bind('change:selected', this.show_only_selected_story, this);
this.collection.bind('change:selected', this.check_feed_view_scrolled_to_bottom, this); this.collection.bind('change:selected', this.check_feed_view_scrolled_to_bottom, this);
this.$el.bind('mousemove', _.bind(this.handle_mousemove_feed_view, this)); this.$el.bind('mousemove', _.bind(this.handle_mousemove_feed_view, this));
@ -640,6 +641,18 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
this.prefetch_story_locations_in_feed_view(); this.prefetch_story_locations_in_feed_view();
}, },
switch_story_view: function(story, selected) {
if (selected) {
var story_view = NEWSBLUR.assets.view_setting(story.get('story_feed_id'), 'view');
if (story_view != NEWSBLUR.reader.story_view) {
console.log(['story list, switch story view', NEWSBLUR.reader.story_view]);
NEWSBLUR.reader.set_correct_story_view_for_feed();
NEWSBLUR.reader.switch_to_correct_view();
NEWSBLUR.reader.switch_taskbar_view();
}
}
},
// ========== // ==========
// = Events = // = Events =
// ========== // ==========

View file

@ -15,6 +15,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
initialize: function() { initialize: function() {
this.model.bind('change', this.toggle_classes, this); this.model.bind('change', this.toggle_classes, this);
this.model.bind('change:read_status', this.toggle_read_status, this); this.model.bind('change:read_status', this.toggle_read_status, this);
this.model.bind('change:selected', this.switch_story_view, this);
this.model.bind('change:selected', this.toggle_selected, this); this.model.bind('change:selected', this.toggle_selected, this);
this.model.bind('change:starred', this.toggle_starred, this); this.model.bind('change:starred', this.toggle_starred, this);
this.model.bind('change:intelligence', this.toggle_intelligence, this); this.model.bind('change:intelligence', this.toggle_intelligence, this);
@ -130,23 +131,27 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
'), '),
render_inline_story_detail: function(temporary_text) { render_inline_story_detail: function(temporary_text) {
console.log(['render_inline_story_detail', temporary_text]); // console.log(['render_inline_story_detail', temporary_text]);
if (NEWSBLUR.reader.story_view == 'text' || temporary_text) { if (NEWSBLUR.reader.story_view == 'text' || temporary_text) {
this.text_view = new NEWSBLUR.Views.TextTabView({ if (!this.text_view) {
el: null, this.text_view = new NEWSBLUR.Views.TextTabView({
inline_story_title: true, el: null,
temporary: !!temporary_text inline_story_title: true,
}); temporary: !!temporary_text
this.text_view.fetch_and_render(this.model, temporary_text); });
this.text_view.fetch_and_render(this.model, temporary_text);
}
this.$(".NB-story-detail").html(this.text_view.$el); this.$(".NB-story-detail").html(this.text_view.$el);
this.text_view.story_detail.render_starred_tags(); this.text_view.story_detail.render_starred_tags();
} else { } else {
this.story_detail = new NEWSBLUR.Views.StoryDetailView({ if (!this.story_detail) {
model: this.model, this.story_detail = new NEWSBLUR.Views.StoryDetailView({
collection: this.model.collection, model: this.model,
tagName: 'div', collection: this.model.collection,
inline_story_title: true tagName: 'div',
}).render(); inline_story_title: true
}).render();
}
// console.log(['render_inline_story_detail', this.$(".NB-story-detail")]); // console.log(['render_inline_story_detail', this.$(".NB-story-detail")]);
this.$(".NB-story-detail").html(this.story_detail.$el); this.$(".NB-story-detail").html(this.story_detail.$el);
this.story_detail.attach_handlers(); this.story_detail.attach_handlers();
@ -540,6 +545,18 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
NEWSBLUR.app.story_tab_view.prepare_story(this.model, true); NEWSBLUR.app.story_tab_view.prepare_story(this.model, true);
NEWSBLUR.app.story_tab_view.open_story(this.model); NEWSBLUR.app.story_tab_view.open_story(this.model);
return false; return false;
},
switch_story_view: function(story, selected) {
if (selected) {
var story_view = NEWSBLUR.assets.view_setting(story.get('story_feed_id'), 'view');
if (story_view != NEWSBLUR.reader.story_view) {
console.log(['story title, switch story view', NEWSBLUR.reader.story_view]);
NEWSBLUR.reader.set_correct_story_view_for_feed();
NEWSBLUR.reader.switch_to_correct_view();
NEWSBLUR.reader.switch_taskbar_view();
}
}
} }
}); });

View file

@ -164,13 +164,13 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
} }
options = options || {}; options = options || {};
console.log(['fill out story titles', this.options.on_dashboard ? "dashboard" : "stories", options, NEWSBLUR.assets.flags['no_more_stories'], NEWSBLUR.assets.stories.length, NEWSBLUR.reader.flags.story_titles_closed]); // console.log(['fill out story titles', this.options.on_dashboard ? "dashboard" : "stories", options, NEWSBLUR.assets.flags['no_more_stories'], NEWSBLUR.assets.stories.length, NEWSBLUR.reader.flags.story_titles_closed]);
if (NEWSBLUR.reader.counts['page_fill_outs'] < NEWSBLUR.reader.constants.FILL_OUT_PAGES && if (NEWSBLUR.reader.counts['page_fill_outs'] < NEWSBLUR.reader.constants.FILL_OUT_PAGES &&
!NEWSBLUR.assets.flags['no_more_stories']) { !NEWSBLUR.assets.flags['no_more_stories']) {
var $last = this.$('.NB-story-title:visible:last'); var $last = this.$('.NB-story-title:visible:last');
var container_height = this.$story_titles.height(); var container_height = this.$story_titles.height();
NEWSBLUR.log(["fill out", $last.length && $last.position().top, container_height, $last.length, this.$story_titles.scrollTop()]); // NEWSBLUR.log(["fill out", $last.length && $last.position().top, container_height, $last.length, this.$story_titles.scrollTop()]);
NEWSBLUR.reader.counts['page_fill_outs'] += 1; NEWSBLUR.reader.counts['page_fill_outs'] += 1;
_.delay(_.bind(function() { _.delay(_.bind(function() {
this.scroll(); this.scroll();
@ -352,7 +352,7 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
var visible_height = $story_titles.height() * 2; var visible_height = $story_titles.height() * 2;
var total_height = this.$el.outerHeight() + NEWSBLUR.reader.$s.$feedbar.innerHeight(); var total_height = this.$el.outerHeight() + NEWSBLUR.reader.$s.$feedbar.innerHeight();
console.log(["scroll titles", this.options.on_dashboard ? "dashboard" : "stories", visible_height, scroll_y, ">", total_height, this.$el, container_offset]); // console.log(["scroll titles", this.options.on_dashboard ? "dashboard" : "stories", visible_height, scroll_y, ">", total_height, this.$el, container_offset]);
if (visible_height + scroll_y >= total_height) { if (visible_height + scroll_y >= total_height) {
NEWSBLUR.reader.load_page_of_feed_stories({scroll_to_loadbar: false}); NEWSBLUR.reader.load_page_of_feed_stories({scroll_to_loadbar: false});
} }