mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Fixing tag and author inline classifier changes to not lose hover behavior when switching scores.
This commit is contained in:
parent
232d98cf55
commit
f557abb47c
3 changed files with 17 additions and 27 deletions
|
@ -2445,7 +2445,6 @@ background: transparent;
|
||||||
opacity: .4;
|
opacity: .4;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
-webkit-filter: grayscale(100%);
|
-webkit-filter: grayscale(100%);
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
.NB-sideoption-share .NB-sideoption-share-crosspost-twitter:hover,
|
.NB-sideoption-share .NB-sideoption-share-crosspost-twitter:hover,
|
||||||
.NB-sideoption-share .NB-sideoption-share-crosspost-facebook:hover {
|
.NB-sideoption-share .NB-sideoption-share-crosspost-facebook:hover {
|
||||||
|
|
|
@ -1173,7 +1173,8 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
|
||||||
this.make_request('/oauth/unfollow_twitter_account', {'username': username}, callback);
|
this.make_request('/oauth/unfollow_twitter_account', {'username': username}, callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
recalculate_story_scores: function(feed_id) {
|
recalculate_story_scores: function(feed_id, options) {
|
||||||
|
options = options || {};
|
||||||
this.stories.each(_.bind(function(story, i) {
|
this.stories.each(_.bind(function(story, i) {
|
||||||
if (story.get('story_feed_id') != feed_id) return;
|
if (story.get('story_feed_id') != feed_id) return;
|
||||||
var intelligence = {
|
var intelligence = {
|
||||||
|
@ -1183,35 +1184,35 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
|
||||||
title: 0
|
title: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
_.each(this.classifiers[feed_id].titles, _.bind(function(classifier_score, classifier_title) {
|
_.each(this.classifiers[feed_id].titles, function(classifier_score, classifier_title) {
|
||||||
if (intelligence.title <= 0 &&
|
if (intelligence.title <= 0 &&
|
||||||
story.get('story_title', '').indexOf(classifier_title) != -1) {
|
story.get('story_title', '').indexOf(classifier_title) != -1) {
|
||||||
intelligence.title = classifier_score;
|
intelligence.title = classifier_score;
|
||||||
}
|
}
|
||||||
}, this));
|
});
|
||||||
|
|
||||||
_.each(this.classifiers[feed_id].authors, _.bind(function(classifier_score, classifier_author) {
|
_.each(this.classifiers[feed_id].authors, function(classifier_score, classifier_author) {
|
||||||
if (intelligence.author <= 0 &&
|
if (intelligence.author <= 0 &&
|
||||||
story.get('story_authors', '').indexOf(classifier_author) != -1) {
|
story.get('story_authors', '').indexOf(classifier_author) != -1) {
|
||||||
intelligence.author = classifier_score;
|
intelligence.author = classifier_score;
|
||||||
}
|
}
|
||||||
}, this));
|
});
|
||||||
|
|
||||||
_.each(this.classifiers[feed_id].tags, _.bind(function(classifier_score, classifier_tag) {
|
_.each(this.classifiers[feed_id].tags, function(classifier_score, classifier_tag) {
|
||||||
if (intelligence.tags <= 0 &&
|
if (intelligence.tags <= 0 &&
|
||||||
story.get('story_tags') && _.contains(story.get('story_tags'), classifier_tag)) {
|
story.get('story_tags') && _.contains(story.get('story_tags'), classifier_tag)) {
|
||||||
intelligence.tags = classifier_score;
|
intelligence.tags = classifier_score;
|
||||||
}
|
}
|
||||||
}, this));
|
});
|
||||||
|
|
||||||
_.each(this.classifiers[feed_id].feeds, _.bind(function(classifier_score, classifier_feed_id) {
|
_.each(this.classifiers[feed_id].feeds, function(classifier_score, classifier_feed_id) {
|
||||||
if (intelligence.feed <= 0 &&
|
if (intelligence.feed <= 0 &&
|
||||||
story.get('story_feed_id') == classifier_feed_id) {
|
story.get('story_feed_id') == classifier_feed_id) {
|
||||||
intelligence.feed = classifier_score;
|
intelligence.feed = classifier_score;
|
||||||
}
|
}
|
||||||
}, this));
|
});
|
||||||
|
|
||||||
story.set('intelligence', intelligence);
|
story.set('intelligence', intelligence, options);
|
||||||
}, this));
|
}, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
render_header: function() {
|
render_header: function(model, value, options) {
|
||||||
var params = this.get_render_params();
|
var params = this.get_render_params();
|
||||||
this.$('.NB-feed-story-header').replaceWith($(this.story_header_template(params)));
|
this.$('.NB-feed-story-header').replaceWith($(this.story_header_template(params)));
|
||||||
this.generate_gradients();
|
this.generate_gradients();
|
||||||
|
@ -280,11 +280,11 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
||||||
.one('mouseleave', function() {
|
.one('mouseleave', function() {
|
||||||
$tag.removeClass('NB-score-now-'+score);
|
$tag.removeClass('NB-score-now-'+score);
|
||||||
});
|
});
|
||||||
_.defer(function() {
|
_.delay(function() {
|
||||||
$tag.one('mouseenter', function() {
|
$tag.one('mouseenter', function() {
|
||||||
$tag.removeClass('NB-score-now-'+score);
|
$tag.removeClass('NB-score-now-'+score);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
}, 100);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggle_starred: function() {
|
toggle_starred: function() {
|
||||||
|
@ -394,21 +394,11 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
NEWSBLUR.assets.classifiers[feed_id][classifier_type+'s'][value] = score;
|
NEWSBLUR.assets.classifiers[feed_id][classifier_type+'s'][value] = score;
|
||||||
NEWSBLUR.assets.recalculate_story_scores(feed_id);
|
NEWSBLUR.assets.recalculate_story_scores(feed_id, {story_view: this});
|
||||||
NEWSBLUR.assets.save_classifier(data, function(resp) {
|
NEWSBLUR.assets.save_classifier(data, function(resp) {
|
||||||
NEWSBLUR.reader.force_feeds_refresh(null, true, feed_id);
|
NEWSBLUR.reader.force_feeds_refresh(null, true, feed_id);
|
||||||
});
|
});
|
||||||
|
|
||||||
NEWSBLUR.assets.stories.each(function(story) {
|
|
||||||
if (classifier_type == 'tag' &&
|
|
||||||
_.contains(story.get('story_tags'), value)) {
|
|
||||||
story.trigger('change:intelligence');
|
|
||||||
} else if (classifier_type == 'author' &&
|
|
||||||
story.get('story_authors') == value) {
|
|
||||||
story.trigger('change:intelligence');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.preserve_classifier_color(classifier_type, value, score);
|
this.preserve_classifier_color(classifier_type, value, score);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue