mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Seamless flipping between story layouts.
This commit is contained in:
parent
2b52bc213d
commit
3ad7eabcea
5 changed files with 22 additions and 9 deletions
|
@ -1356,9 +1356,9 @@ background: transparent;
|
|||
line-height: 8px;
|
||||
}
|
||||
|
||||
.NB-intelligence-positive #story_titles .NB-story-title.NB-story-neutral.NB-story-hidden-visible,
|
||||
.NB-intelligence-positive #story_titles .NB-story-title.NB-story-negative.NB-story-hidden-visible,
|
||||
.NB-intelligence-neutral #story_titles .NB-story-title.NB-story-negative.NB-story-hidden-visible {
|
||||
.NB-intelligence-positive .NB-story-title.NB-story-neutral.NB-story-hidden-visible .NB-hidden-fade,
|
||||
.NB-intelligence-positive .NB-story-title.NB-story-negative.NB-story-hidden-visible .NB-hidden-fade,
|
||||
.NB-intelligence-neutral .NB-story-title.NB-story-negative.NB-story-hidden-visible .NB-hidden-fade {
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
|
|
|
@ -1312,6 +1312,14 @@
|
|||
NEWSBLUR.assets.preference('story_layout', story_layout);
|
||||
|
||||
this.apply_resizable_layout(true);
|
||||
this.switch_to_correct_view();
|
||||
if (this.active_story && story_layout == 'list') {
|
||||
this.active_story.story_title_view.render_inline_story_detail();
|
||||
} else if (this.active_story && story_layout == 'split') {
|
||||
NEWSBLUR.app.story_list.scroll_to_selected_story();
|
||||
this.active_story.story_title_view.destroy_inline_story_detail();
|
||||
}
|
||||
NEWSBLUR.app.story_titles.scroll_to_selected_story();
|
||||
},
|
||||
|
||||
// ===============
|
||||
|
|
|
@ -43,7 +43,9 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
|||
// this.$el.bind('mouseenter', this.mouseenter);
|
||||
// this.$el.bind('mouseleave', this.mouseleave);
|
||||
|
||||
if (!this.options.feed_floater && !this.options.text_view) {
|
||||
if (!this.options.feed_floater &&
|
||||
!this.options.text_view &&
|
||||
!this.options.inline_story_title) {
|
||||
this.model.story_view = this;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -38,7 +38,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
|
|||
template: _.template('\
|
||||
<div class="NB-story-title">\
|
||||
<div class="NB-storytitles-sentiment"></div>\
|
||||
<a href="<%= story.get("story_permalink") %>" class="story_title">\
|
||||
<a href="<%= story.get("story_permalink") %>" class="story_title NB-hidden-fade">\
|
||||
<% if (feed) { %>\
|
||||
<div class="NB-story-feed">\
|
||||
<img class="feed_favicon" src="<%= $.favicon(feed) %>">\
|
||||
|
@ -50,7 +50,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
|
|||
<span class="NB-storytitles-title"><%= story.get("story_title") %></span>\
|
||||
<span class="NB-storytitles-author"><%= story.get("story_authors") %></span>\
|
||||
</a>\
|
||||
<span class="story_date"><%= story.get("short_parsed_date") %></span>\
|
||||
<span class="story_date NB-hidden-fade"><%= story.get("short_parsed_date") %></span>\
|
||||
<% if (story.get("comment_count_friends")) { %>\
|
||||
<div class="NB-storytitles-shares">\
|
||||
<% _.each(story.get("commented_by_friends"), function(user_id) { %>\
|
||||
|
@ -66,7 +66,9 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
|
|||
render_inline_story_detail: function() {
|
||||
this.story_detail = new NEWSBLUR.Views.StoryDetailView({
|
||||
model: this.model,
|
||||
collection: this.model.collection
|
||||
collection: this.model.collection,
|
||||
tagName: 'div',
|
||||
inline_story_title: true
|
||||
}).render();
|
||||
|
||||
this.$(".NB-story-detail").html(this.story_detail.$el);
|
||||
|
@ -164,7 +166,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
|
|||
if (NEWSBLUR.assets.preference('story_layout') == 'list') {
|
||||
this.render_inline_story_detail();
|
||||
}
|
||||
NEWSBLUR.app.story_titles.scroll_to_selected_story(this.model);
|
||||
NEWSBLUR.app.story_titles.scroll_to_selected_story(this.model, options);
|
||||
} else {
|
||||
this.destroy_inline_story_detail();
|
||||
}
|
||||
|
|
|
@ -179,7 +179,8 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
|
|||
if (!story_title_view) return;
|
||||
|
||||
var story_title_visisble = NEWSBLUR.reader.$s.$story_titles.isScrollVisible(story_title_view.$el);
|
||||
if (!story_title_visisble || options.force) {
|
||||
if (!story_title_visisble || options.force ||
|
||||
NEWSBLUR.assets.preference('story_layout') == 'list') {
|
||||
var container_offset = NEWSBLUR.reader.$s.$story_titles.position().top;
|
||||
var scroll = story_title_view.$el.position().top;
|
||||
var container = NEWSBLUR.reader.$s.$story_titles.scrollTop();
|
||||
|
|
Loading…
Add table
Reference in a new issue