mirror of
https://github.com/viq/NewsBlur.git
synced 2025-08-31 22:20:12 +00:00
Fixing signle story mode.
This commit is contained in:
parent
97633614f8
commit
aeefbb645b
6 changed files with 62 additions and 14 deletions
|
@ -1795,7 +1795,10 @@ class MStory(mongo.Document):
|
|||
soup = BeautifulSoup(story_content)
|
||||
image = soup.find('img')
|
||||
if image:
|
||||
self.image_url = image.get('src')
|
||||
image_url = image.get('src')
|
||||
if image_url and len(image_url) >= 1024:
|
||||
return
|
||||
self.image_url = image_url
|
||||
return self.image_url
|
||||
|
||||
def fetch_original_text(self, force=False, request=None):
|
||||
|
@ -1830,6 +1833,7 @@ class MStarredStory(mongo.Document):
|
|||
story_guid = mongo.StringField()
|
||||
story_hash = mongo.StringField()
|
||||
story_tags = mongo.ListField(mongo.StringField(max_length=250))
|
||||
image_url = mongo.StringField(max_length=1024)
|
||||
|
||||
meta = {
|
||||
'collection': 'starred_stories',
|
||||
|
|
|
@ -1228,6 +1228,7 @@ class MSharedStory(mongo.Document):
|
|||
story_permalink = mongo.StringField()
|
||||
story_guid = mongo.StringField(unique_with=('user_id',))
|
||||
story_guid_hash = mongo.StringField(max_length=6)
|
||||
image_url = mongo.StringField(max_length=1024)
|
||||
story_tags = mongo.ListField(mongo.StringField(max_length=250))
|
||||
posted_to_services = mongo.ListField(mongo.StringField(max_length=20))
|
||||
mute_email_users = mongo.ListField(mongo.IntField())
|
||||
|
|
|
@ -458,6 +458,26 @@ body {
|
|||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.NB-story-list-empty {
|
||||
background: transparent url("/media/embed/reader/big_world.png") no-repeat center 0;
|
||||
background-size: 64px;
|
||||
color: rgba(0, 0, 0, .4);
|
||||
opacity: .4;
|
||||
font-size: 16px;
|
||||
padding: 78px 24px 0;
|
||||
position: absolute;
|
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, .4);
|
||||
top: 40%;
|
||||
width: 100%;
|
||||
z-index: 10;
|
||||
cursor: default;
|
||||
line-height: 20px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.NB-feedlists ::-moz-selection {
|
||||
background: transparent;
|
||||
|
|
|
@ -4081,7 +4081,9 @@
|
|||
|
||||
show_mouse_indicator: function() {
|
||||
var self = this;
|
||||
|
||||
|
||||
if (NEWSBLUR.assets.preference('feed_view_single_story')) return;
|
||||
|
||||
if (this.flags['mouse_indicator_hidden']) {
|
||||
this.flags['mouse_indicator_hidden'] = false;
|
||||
this.$s.$mouse_indicator.animate({'opacity': 1, 'left': 0}, {
|
||||
|
|
|
@ -80,6 +80,7 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
|||
if (this.feed) {
|
||||
this.$el.toggleClass('NB-inverse', this.feed.is_light());
|
||||
}
|
||||
|
||||
this.setup_classes();
|
||||
this.toggle_classes();
|
||||
this.toggle_read_status();
|
||||
|
@ -305,7 +306,7 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
|||
this.$el.toggleClass('NB-story-shared', !!story.get('shared'));
|
||||
this.toggle_intelligence();
|
||||
this.render_intelligence();
|
||||
|
||||
|
||||
if (NEWSBLUR.assets.preference('show_tooltips')) {
|
||||
this.$('.NB-story-sentiment').tipsy({
|
||||
delayIn: 375,
|
||||
|
@ -362,7 +363,8 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
|||
|
||||
truncate_story_height: function() {
|
||||
if (this._truncated) return;
|
||||
|
||||
if (NEWSBLUR.assets.preference('feed_view_single_story')) return;
|
||||
|
||||
// console.log(["Checking truncate", this.$el, this.images_to_load, this.truncate_delay / 1000 + " sec delay"]);
|
||||
var $expander = this.$(".NB-story-content-expander");
|
||||
var $expander_cutoff = this.$(".NB-story-cutoff");
|
||||
|
|
|
@ -48,7 +48,11 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
|
|||
collection: collection
|
||||
}).render();
|
||||
});
|
||||
this.$el.html(_.pluck(stories, 'el'));
|
||||
if (NEWSBLUR.assets.preference('feed_view_single_story')) {
|
||||
this.show_explainer_single_story_mode();
|
||||
} else {
|
||||
this.$el.html(_.pluck(stories, 'el'));
|
||||
}
|
||||
_.invoke(stories, 'watch_images_for_story_height');
|
||||
this.show_correct_feed_in_feed_title_floater();
|
||||
|
||||
|
@ -67,7 +71,9 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
|
|||
collection: collection
|
||||
}).render();
|
||||
}));
|
||||
this.$el.append(_.pluck(stories, 'el'));
|
||||
if (!NEWSBLUR.assets.preference('feed_view_single_story')) {
|
||||
this.$el.append(_.pluck(stories, 'el'));
|
||||
}
|
||||
_.invoke(stories, 'watch_images_for_story_height');
|
||||
|
||||
this.stories = this.stories.concat(stories);
|
||||
|
@ -82,6 +88,14 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
|
|||
this.$el.empty();
|
||||
},
|
||||
|
||||
show_explainer_single_story_mode: function() {
|
||||
var $empty = $.make("div", { className: "NB-story-list-empty" }, [
|
||||
'Select a story to read'
|
||||
]);
|
||||
|
||||
this.$el.append($empty);
|
||||
},
|
||||
|
||||
// ===========
|
||||
// = Actions =
|
||||
// ===========
|
||||
|
@ -125,19 +139,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 && story.story_view) {
|
||||
if (story.get('selected')) {
|
||||
story.story_view.$el.show();
|
||||
} else {
|
||||
story.story_view.$el.hide();
|
||||
}
|
||||
this.collection.any(_.bind(function(story) {
|
||||
if (story && story.story_view && story.get('selected')) {
|
||||
this.$el.html(story.story_view.$el);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}, this));
|
||||
|
||||
this.show_no_more_stories();
|
||||
},
|
||||
|
||||
show_no_more_stories: function() {
|
||||
if (!NEWSBLUR.assets.flags['no_more_stories']) return;
|
||||
|
||||
var pane_height = NEWSBLUR.reader.$s.$story_pane.height();
|
||||
var indicator_position = NEWSBLUR.assets.preference('lock_mouse_indicator');
|
||||
var endbar_height = 20;
|
||||
|
@ -153,6 +167,10 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
|
|||
}
|
||||
|
||||
this.$('.NB-feed-story-endbar').remove();
|
||||
if (NEWSBLUR.assets.preference('feed_view_single_story')) {
|
||||
var last_story = NEWSBLUR.assets.stories.last();
|
||||
if (!last_story.get('selected')) return;
|
||||
}
|
||||
var $end_stories_line = $.make('div', {
|
||||
className: 'NB-feed-story-endbar'
|
||||
}).css('paddingBottom', endbar_height);
|
||||
|
@ -313,6 +331,7 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
|
|||
NEWSBLUR.reader.load_page_of_feed_stories();
|
||||
return;
|
||||
}
|
||||
if (NEWSBLUR.assets.preference('feed_view_single_story')) return;
|
||||
|
||||
var $last_story = last_story.story_view.$el;
|
||||
var container_offset = this.$el.position().top;
|
||||
|
|
Loading…
Add table
Reference in a new issue