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 {
border: 1px solid #F7E7BC;
background-color: #FFFCF3;
border-radius: 3px;
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;
overflow: hidden;
border-radius: 4px;
font-size: 14px;
text-align: center;
}
@ -6518,7 +6534,7 @@ form.opml_import_form input {
font-size: 12px;
text-transform: uppercase;
margin: 12px 0 0;
color: #909090;
color: #ebc17c;
}
/* ================= */
@ -9136,24 +9152,24 @@ form.opml_import_form input {
display: block;
}
.NB-modal-feedchooser .NB-modal-submit.NB-modal-submit-paypal {
border-radius: 12px;
border: 1px solid #F6BD44;
border-radius: 3px;
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, #FFED68),
color-stop(0.84, #FFF8B1)
color-stop(0.16, #fff5cc),
color-stop(0.84, #fff7d4)
);
background-image: -moz-linear-gradient(
center bottom,
#FFED68 16%,
#FFF8B1 84%
#fff5cc 16%,
#fff7d4 84%
);
-moz-box-shadow:0 2px 2px #CE972F;
box-shadow:0 2px 2px #CE972F;
-moz-box-shadow:0 2px 0px #ebc17c;
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 {
-moz-box-shadow:2px 2px 0 #E2D121;
box-shadow:2px 2px 0 #E2D121;
/* -moz-box-shadow:0 2px 0 #1a5e0e;*/
/* box-shadow:0 2px 0 #1a5e0e;*/
}
.NB-modal-feedchooser .NB-creditcards img {
width: 32px;
@ -9197,7 +9213,8 @@ form.opml_import_form input {
}
.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;
clear: both;
position: relative;
@ -9218,6 +9235,7 @@ form.opml_import_form input {
}
.NB-modal-feedchooser .NB-feedchooser-dollar-value .NB-feedchooser-dollar-image {
display: none !important;
position: absolute;
width: 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:starred', this.change_starred);
this.bind('change:user_tags', this.change_user_tags);
this.bind('change:selected', this.select_story);
this.populate_comments();
this.story_permalink = this.get('story_permalink');
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) {
this.friend_comments = new NEWSBLUR.Collections.Comments(this.get('friend_comments'));
this.friend_shares = new NEWSBLUR.Collections.Comments(this.get('friend_shares'));
@ -260,7 +266,7 @@ NEWSBLUR.Collections.Stories = Backbone.Collection.extend({
active_story: null,
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('change:selected', this.change_selected);
},
@ -539,8 +545,8 @@ NEWSBLUR.Collections.Stories = Backbone.Collection.extend({
// ==========
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) {
console.log(['detect_selected_story', selected, selected_story, this.active_story, this == NEWSBLUR.assets.stories ? "stories" : "dashboard"]);
this.deselect_other_stories(selected_story);
this.active_story = selected_story;
NEWSBLUR.reader.active_story = selected_story;

View file

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

View file

@ -307,6 +307,8 @@ _.extend(NEWSBLUR.ReaderFeedchooser.prototype, {
},
update_counts: function(initial_load) {
if (this.options.premium_only) return;
var $count = $('.NB-feedchooser-info-counts');
var approved = this.feedlist.folder_view.highlighted_count();
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('no_more_stories', this.check_premium_river, 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.check_feed_view_scrolled_to_bottom, 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();
},
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 =
// ==========

View file

@ -15,6 +15,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
initialize: function() {
this.model.bind('change', this.toggle_classes, 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:starred', this.toggle_starred, 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) {
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 (!this.text_view) {
this.text_view = new NEWSBLUR.Views.TextTabView({
el: null,
inline_story_title: true,
temporary: !!temporary_text
});
this.text_view.fetch_and_render(this.model, temporary_text);
}
this.$(".NB-story-detail").html(this.text_view.$el);
this.text_view.story_detail.render_starred_tags();
} else {
if (!this.story_detail) {
this.story_detail = new NEWSBLUR.Views.StoryDetailView({
model: this.model,
collection: this.model.collection,
tagName: 'div',
inline_story_title: true
}).render();
}
// console.log(['render_inline_story_detail', this.$(".NB-story-detail")]);
this.$(".NB-story-detail").html(this.story_detail.$el);
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.open_story(this.model);
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 || {};
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 &&
!NEWSBLUR.assets.flags['no_more_stories']) {
var $last = this.$('.NB-story-title:visible:last');
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;
_.delay(_.bind(function() {
this.scroll();
@ -352,7 +352,7 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
var visible_height = $story_titles.height() * 2;
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) {
NEWSBLUR.reader.load_page_of_feed_stories({scroll_to_loadbar: false});
}