mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Merge branch 'hidden_stories'
* hidden_stories: Hiding indicator when there are no hidden stories. Fixing show/hide hidden stories button to cycle through postiive, neutral, negative. Stubbing in hide hidden stories toggle. Still needs to work.
This commit is contained in:
commit
c6c9c05b42
5 changed files with 39 additions and 22 deletions
|
@ -1550,10 +1550,10 @@ a img {
|
|||
.NB-feedbar .NB-story-title-indicator .NB-story-title-indicator-count .unread_count_starred {
|
||||
display: none;
|
||||
}
|
||||
.NB-feedbar .NB-story-title-indicator.unread_threshold_negative {
|
||||
/*.NB-feedbar .NB-story-title-indicator.unread_threshold_negative {
|
||||
display: none;
|
||||
}
|
||||
.NB-feedbar .NB-story-title-indicator .feed_counts_floater {
|
||||
*/.NB-feedbar .NB-story-title-indicator .feed_counts_floater {
|
||||
float: left;
|
||||
padding: 2px 0 0;
|
||||
text-align: center;
|
||||
|
|
|
@ -4468,9 +4468,9 @@
|
|||
});
|
||||
},
|
||||
|
||||
get_unread_view_score: function() {
|
||||
get_unread_view_score: function(ignore_temp) {
|
||||
if (this.flags['feed_list_showing_starred']) return -1;
|
||||
if (this.flags['unread_threshold_temporarily']) {
|
||||
if (this.flags['unread_threshold_temporarily'] && !ignore_temp) {
|
||||
var score_name = this.flags['unread_threshold_temporarily'];
|
||||
if (score_name == 'neutral') {
|
||||
return 0;
|
||||
|
@ -4482,13 +4482,13 @@
|
|||
return this.model.preference('unread_view');
|
||||
},
|
||||
|
||||
get_unread_view_name: function(unread_view) {
|
||||
if (this.flags['unread_threshold_temporarily']) {
|
||||
get_unread_view_name: function(unread_view, ignore_temp) {
|
||||
if (this.flags['unread_threshold_temporarily'] && !ignore_temp) {
|
||||
return this.flags['unread_threshold_temporarily'];
|
||||
}
|
||||
|
||||
if (typeof unread_view == 'undefined') {
|
||||
unread_view = this.get_unread_view_score();
|
||||
if (typeof unread_view == 'undefined' || unread_view === null) {
|
||||
unread_view = this.get_unread_view_score(ignore_temp);
|
||||
}
|
||||
|
||||
if (this.flags['feed_list_showing_starred']) return 'starred';
|
||||
|
|
|
@ -309,7 +309,7 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
|||
var score = this.model.score();
|
||||
var unread_view = NEWSBLUR.reader.get_unread_view_score();
|
||||
|
||||
if (score >= unread_view || this.model.get('visible')) {
|
||||
if (score >= unread_view) {
|
||||
this.$el.removeClass('NB-hidden');
|
||||
this.model.set('visible', true);
|
||||
} else {
|
||||
|
|
|
@ -172,8 +172,9 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
|
|||
options = options || {};
|
||||
var score = this.model.score();
|
||||
var unread_view = NEWSBLUR.reader.get_unread_view_score();
|
||||
// console.log(['render_intelligence', score, unread_view, this.model.get('visible'), this.model.get('story_title')]);
|
||||
|
||||
if (score >= unread_view || this.model.get('visible')) {
|
||||
if (score >= unread_view) {
|
||||
this.$st.removeClass('NB-hidden');
|
||||
this.model.set('visible', true);
|
||||
} else {
|
||||
|
|
|
@ -8,7 +8,6 @@ NEWSBLUR.Views.StoryTitlesHeader = Backbone.View.extend({
|
|||
|
||||
events: {
|
||||
"click .NB-feedbar-options" : "open_options_popover",
|
||||
"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"
|
||||
|
@ -200,21 +199,22 @@ NEWSBLUR.Views.StoryTitlesHeader = Backbone.View.extend({
|
|||
|
||||
show_hidden_story_titles: function() {
|
||||
var $indicator = this.$('.NB-story-title-indicator');
|
||||
var unread_view_name = NEWSBLUR.reader.get_unread_view_name();
|
||||
var temp_unread_view_name = NEWSBLUR.reader.get_unread_view_name();
|
||||
var unread_view_name = NEWSBLUR.reader.get_unread_view_name(null, true);
|
||||
var hidden_stories_at_threshold = NEWSBLUR.assets.stories.any(function(story) {
|
||||
var score = story.score();
|
||||
if (unread_view_name == 'positive') return score == 0;
|
||||
else if (unread_view_name == 'neutral') return score < 0;
|
||||
if (temp_unread_view_name == 'positive') return score == 0;
|
||||
else if (temp_unread_view_name == 'neutral') return score < 0;
|
||||
});
|
||||
var hidden_stories_below_threshold = unread_view_name == 'positive' &&
|
||||
var hidden_stories_below_threshold = temp_unread_view_name == 'positive' &&
|
||||
NEWSBLUR.assets.stories.any(function(story) {
|
||||
return story.score() < 0;
|
||||
});
|
||||
|
||||
// NEWSBLUR.log(['show_hidden_story_titles', hidden_stories_at_threshold, hidden_stories_below_threshold, unread_view_name]);
|
||||
NEWSBLUR.log(['show_hidden_story_titles', hidden_stories_at_threshold, hidden_stories_below_threshold, unread_view_name, temp_unread_view_name, NEWSBLUR.reader.flags['unread_threshold_temporarily']]);
|
||||
|
||||
// First click, open neutral. Second click, open negative.
|
||||
if (unread_view_name == 'positive' &&
|
||||
if (temp_unread_view_name == 'positive' &&
|
||||
hidden_stories_at_threshold &&
|
||||
hidden_stories_below_threshold) {
|
||||
NEWSBLUR.reader.flags['unread_threshold_temporarily'] = 'neutral';
|
||||
|
@ -223,8 +223,11 @@ NEWSBLUR.Views.StoryTitlesHeader = Backbone.View.extend({
|
|||
'animate': true,
|
||||
'follow': true
|
||||
});
|
||||
$indicator.removeClass('unread_threshold_positive').addClass('unread_threshold_neutral');
|
||||
} else {
|
||||
$indicator.removeClass('unread_threshold_positive')
|
||||
.removeClass('unread_threshold_negative');
|
||||
$indicator.addClass('unread_threshold_neutral');
|
||||
$(".NB-story-title-indicator-text", $indicator).text("show hidden stories");
|
||||
} else if (NEWSBLUR.reader.flags['unread_threshold_temporarily'] != 'negative') {
|
||||
NEWSBLUR.reader.flags['unread_threshold_temporarily'] = 'negative';
|
||||
NEWSBLUR.reader.show_story_titles_above_intelligence_level({
|
||||
'unread_view_name': 'negative',
|
||||
|
@ -232,9 +235,22 @@ NEWSBLUR.Views.StoryTitlesHeader = Backbone.View.extend({
|
|||
'follow': true
|
||||
});
|
||||
$indicator.removeClass('unread_threshold_positive')
|
||||
.removeClass('unread_threshold_neutral')
|
||||
.addClass('unread_threshold_negative');
|
||||
$indicator.animate({'opacity': 0}, {'duration': 500}).css('display', 'none');
|
||||
.removeClass('unread_threshold_neutral');
|
||||
$indicator.addClass('unread_threshold_negative');
|
||||
// $indicator.animate({'opacity': 0}, {'duration': 500}).css('display', 'none');
|
||||
$(".NB-story-title-indicator-text", $indicator).text("hide hidden stories");
|
||||
} else {
|
||||
NEWSBLUR.reader.flags['unread_threshold_temporarily'] = null;
|
||||
NEWSBLUR.reader.show_story_titles_above_intelligence_level({
|
||||
'unread_view_name': unread_view_name,
|
||||
'animate': true,
|
||||
'follow': true
|
||||
});
|
||||
$indicator.removeClass('unread_threshold_positive')
|
||||
.removeClass('unread_threshold_neutral')
|
||||
.removeClass('unread_threshold_negative');
|
||||
$indicator.addClass('unread_threshold_'+unread_view_name);
|
||||
$(".NB-story-title-indicator-text", $indicator).text("show hidden stories");
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue