mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Adding mark as read button to All Site Stories on web.
This commit is contained in:
parent
b05999e0e5
commit
57f1f7e5ec
5 changed files with 56 additions and 12 deletions
|
@ -1073,7 +1073,7 @@ class Feed(models.Model):
|
||||||
else:
|
else:
|
||||||
ret_values['same'] += 1
|
ret_values['same'] += 1
|
||||||
if verbose:
|
if verbose:
|
||||||
logging.debug("Unchanged story: %s / %s " % (story.get('guid'), story.get('title')))
|
logging.debug("Unchanged story (%s): %s / %s " % (story.get('story_hash'), story.get('guid'), story.get('title')))
|
||||||
|
|
||||||
return ret_values
|
return ret_values
|
||||||
|
|
||||||
|
@ -1344,7 +1344,7 @@ class Feed(models.Model):
|
||||||
# story_published_now = story.get('published_now', False)
|
# story_published_now = story.get('published_now', False)
|
||||||
# start_date = story_pub_date - datetime.timedelta(hours=8)
|
# start_date = story_pub_date - datetime.timedelta(hours=8)
|
||||||
# end_date = story_pub_date + datetime.timedelta(hours=8)
|
# end_date = story_pub_date + datetime.timedelta(hours=8)
|
||||||
|
|
||||||
for existing_story in existing_stories.values():
|
for existing_story in existing_stories.values():
|
||||||
content_ratio = 0
|
content_ratio = 0
|
||||||
# existing_story_pub_date = existing_story.story_date
|
# existing_story_pub_date = existing_story.story_date
|
||||||
|
@ -1391,7 +1391,8 @@ class Feed(models.Model):
|
||||||
seq = difflib.SequenceMatcher(None, story_content, existing_story_content)
|
seq = difflib.SequenceMatcher(None, story_content, existing_story_content)
|
||||||
|
|
||||||
similiar_length_min = 1000
|
similiar_length_min = 1000
|
||||||
if existing_story.story_permalink == story_link:
|
if (existing_story.story_permalink == story_link and
|
||||||
|
existing_story.story_title == story.get('title')):
|
||||||
similiar_length_min = 20
|
similiar_length_min = 20
|
||||||
|
|
||||||
if (seq
|
if (seq
|
||||||
|
|
|
@ -1374,6 +1374,12 @@ a img {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.NB-feedbar .NB-folder-fake .NB-feedbar-mark-feed-read-container {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.NB-feedbar .NB-folder-river .NB-feedbar-mark-feed-read-container {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.NB-feedbar .feed .feed_counts {
|
.NB-feedbar .feed .feed_counts {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
|
@ -5378,7 +5384,7 @@ form.opml_import_form input {
|
||||||
background-size: 28px;
|
background-size: 28px;
|
||||||
}
|
}
|
||||||
.NB-modal-markread .NB-markread-slider {
|
.NB-modal-markread .NB-markread-slider {
|
||||||
margin-top: 24px;
|
margin: 24px 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.NB-modal-markread .NB-markread-explanation {
|
.NB-modal-markread .NB-markread-explanation {
|
||||||
|
|
|
@ -5,6 +5,13 @@ NEWSBLUR.ReaderMarkRead = function(options) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.flags = {};
|
this.flags = {};
|
||||||
|
this.values = {
|
||||||
|
0: 0,
|
||||||
|
1: 1,
|
||||||
|
2: 3,
|
||||||
|
3: 7,
|
||||||
|
4: 14
|
||||||
|
};
|
||||||
this.options = $.extend({}, defaults, options);
|
this.options = $.extend({}, defaults, options);
|
||||||
this.model = NEWSBLUR.assets;
|
this.model = NEWSBLUR.assets;
|
||||||
this.runner();
|
this.runner();
|
||||||
|
@ -58,11 +65,11 @@ _.extend(NEWSBLUR.ReaderMarkRead.prototype, {
|
||||||
$slider.slider({
|
$slider.slider({
|
||||||
range: 'min',
|
range: 'min',
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 7,
|
max: 4,
|
||||||
step: 1,
|
step: 1,
|
||||||
value: this.options['days'],
|
value: _.indexOf(_.values(this.values), this.options['days']),
|
||||||
slide: function(e, ui) {
|
slide: function(e, ui) {
|
||||||
var value = ui.value;
|
var value = self.values[ui.value];
|
||||||
self.update_dayofweek(value);
|
self.update_dayofweek(value);
|
||||||
self.generate_explanation(value);
|
self.generate_explanation(value);
|
||||||
},
|
},
|
||||||
|
@ -95,7 +102,7 @@ _.extend(NEWSBLUR.ReaderMarkRead.prototype, {
|
||||||
|
|
||||||
var $save = $('.NB-modal input[type=submit]');
|
var $save = $('.NB-modal input[type=submit]');
|
||||||
var $slider = $('.NB-markread-slider', this.$modal);
|
var $slider = $('.NB-markread-slider', this.$modal);
|
||||||
var days = $slider.slider('option', 'value');
|
var days = this.values[$slider.slider('option', 'value')];
|
||||||
|
|
||||||
this.flags.saving = true;
|
this.flags.saving = true;
|
||||||
$save.attr('value', 'Marking as read...').addClass('NB-disabled').attr('disabled', true);
|
$save.attr('value', 'Marking as read...').addClass('NB-disabled').attr('disabled', true);
|
||||||
|
|
|
@ -28,7 +28,8 @@ NEWSBLUR.Views.Folder = Backbone.View.extend({
|
||||||
_.bindAll(this, 'update_title', 'update_selected', 'delete_folder', 'check_collapsed',
|
_.bindAll(this, 'update_title', 'update_selected', 'delete_folder', 'check_collapsed',
|
||||||
'update_hidden');
|
'update_hidden');
|
||||||
|
|
||||||
this.options.folder_title = this.model && this.model.get('folder_title');
|
this.options.folder_title = this.options.folder_title ||
|
||||||
|
(this.model && this.model.get('folder_title'));
|
||||||
|
|
||||||
if (this.model && !this.options.feed_chooser) {
|
if (this.model && !this.options.feed_chooser) {
|
||||||
// Root folder does not have a model.
|
// Root folder does not have a model.
|
||||||
|
|
|
@ -7,8 +7,11 @@ NEWSBLUR.Views.StoryTitlesHeader = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
"click .NB-feedbar-options" : "open_options_popover",
|
"click .NB-feedbar-options" : "open_options_popover",
|
||||||
"click .NB-story-title-indicator" : "show_hidden_story_titles"
|
"click .NB-story-title-indicator" : "show_hidden_story_titles",
|
||||||
|
"click .NB-feedbar-mark-feed-read" : "mark_folder_as_read",
|
||||||
|
"click .NB-feedbar-mark-feed-read-expand" : "expand_mark_read",
|
||||||
|
"click .NB-feedbar-mark-feed-read-time" : "mark_folder_as_read_days"
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
@ -70,7 +73,7 @@ NEWSBLUR.Views.StoryTitlesHeader = Backbone.View.extend({
|
||||||
', {}));
|
', {}));
|
||||||
} else if (this.showing_fake_folder) {
|
} else if (this.showing_fake_folder) {
|
||||||
$view = $(_.template('\
|
$view = $(_.template('\
|
||||||
<div class="NB-folder NB-no-hover">\
|
<div class="NB-folder NB-no-hover NB-folder-<%= all_stories ? "river" : "fake" %>">\
|
||||||
<div class="NB-search-container"></div>\
|
<div class="NB-search-container"></div>\
|
||||||
<% if (show_options) { %>\
|
<% if (show_options) { %>\
|
||||||
<div class="NB-feedbar-options-container">\
|
<div class="NB-feedbar-options-container">\
|
||||||
|
@ -82,6 +85,14 @@ NEWSBLUR.Views.StoryTitlesHeader = Backbone.View.extend({
|
||||||
</span>\
|
</span>\
|
||||||
</div>\
|
</div>\
|
||||||
<% } %>\
|
<% } %>\
|
||||||
|
<div class="NB-feedbar-mark-feed-read-container">\
|
||||||
|
<div class="NB-feedbar-mark-feed-read"><div class="NB-icon"></div></div>\
|
||||||
|
<div class="NB-feedbar-mark-feed-read-time" data-days="1">1d</div>\
|
||||||
|
<div class="NB-feedbar-mark-feed-read-time" data-days="3">3d</div>\
|
||||||
|
<div class="NB-feedbar-mark-feed-read-time" data-days="7">7d</div>\
|
||||||
|
<div class="NB-feedbar-mark-feed-read-time" data-days="14">14d</div>\
|
||||||
|
<div class="NB-feedbar-mark-feed-read-expand"></div>\
|
||||||
|
</div>\
|
||||||
<div class="NB-story-title-indicator">\
|
<div class="NB-story-title-indicator">\
|
||||||
<div class="NB-story-title-indicator-count"></div>\
|
<div class="NB-story-title-indicator-count"></div>\
|
||||||
<span class="NB-story-title-indicator-text">show hidden stories</span>\
|
<span class="NB-story-title-indicator-text">show hidden stories</span>\
|
||||||
|
@ -93,6 +104,7 @@ NEWSBLUR.Views.StoryTitlesHeader = Backbone.View.extend({
|
||||||
', {
|
', {
|
||||||
folder_title: this.fake_folder_title(),
|
folder_title: this.fake_folder_title(),
|
||||||
folder_id: NEWSBLUR.reader.active_feed,
|
folder_id: NEWSBLUR.reader.active_feed,
|
||||||
|
all_stories: NEWSBLUR.reader.active_feed == "river:",
|
||||||
show_options: !NEWSBLUR.reader.active_folder.get('fake') ||
|
show_options: !NEWSBLUR.reader.active_folder.get('fake') ||
|
||||||
NEWSBLUR.reader.active_folder.get('show_options')
|
NEWSBLUR.reader.active_folder.get('show_options')
|
||||||
}));
|
}));
|
||||||
|
@ -235,6 +247,23 @@ NEWSBLUR.Views.StoryTitlesHeader = Backbone.View.extend({
|
||||||
anchor: this.$(".NB-feedbar-options"),
|
anchor: this.$(".NB-feedbar-options"),
|
||||||
feed_id: NEWSBLUR.reader.active_feed
|
feed_id: NEWSBLUR.reader.active_feed
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
mark_folder_as_read: function(e, days_back) {
|
||||||
|
if (!this.showing_fake_folder) return;
|
||||||
|
NEWSBLUR.reader.open_mark_read_modal({days: days_back || 0});
|
||||||
|
this.$('.NB-feedbar-mark-feed-read-container').fadeOut(400);
|
||||||
|
},
|
||||||
|
|
||||||
|
mark_folder_as_read_days: function(e) {
|
||||||
|
if (!this.showing_fake_folder) return;
|
||||||
|
var days = parseInt($(e.target).data('days'), 10);
|
||||||
|
this.mark_folder_as_read(e, days);
|
||||||
|
},
|
||||||
|
|
||||||
|
expand_mark_read: function() {
|
||||||
|
if (!this.showing_fake_folder) return;
|
||||||
|
NEWSBLUR.Views.FeedTitleView.prototype.expand_mark_read.call(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue