Adding preference for hiding story changes. This also allows users to have story changes off and selectively see them using the same logic to detect if a story has any modifications.

This commit is contained in:
Samuel Clay 2011-04-13 23:06:16 -04:00
parent 232af01b98
commit 3b96f5da55
4 changed files with 53 additions and 7 deletions

View file

@ -4934,6 +4934,10 @@ background: transparent;
vertical-align: middle;
margin: -4px 6px 0 2px;
}
.NB-modal-preferences .NB-preference-hidestorychanges label img {
vertical-align: middle;
margin: -4px 6px 0 2px;
}
.NB-modal-preferences .NB-preference-singlestory label img {
vertical-align: middle;
margin: -1px 6px 0 2px;

View file

@ -3083,8 +3083,6 @@
if (score < 0) score_color = 'negative';
if (story.story_content.indexOf('<ins') != -1) story_has_modifications = true;
var show_hide_mod_button = story_has_modifications && !this.model.preference('hide_story_changes');
river_same_feed = null;
if (this.cache.last_feed_view_story_feed_id == story.story_feed_id) {
// river_same_feed = 'NB-feed-story-river-same-feed';
@ -3115,7 +3113,11 @@
]),
(story.long_parsed_date &&
$.make('span', { className: 'NB-feed-story-date' }, [
(show_hide_mod_button && $.make('div', { className: 'NB-feed-story-hide-changes', title: 'Hide story modifications' })),
(story_has_modifications && $.make('div', {
className: 'NB-feed-story-hide-changes',
title: (this.model.preference('hide_story_changes') ?
'Show' : 'Hide') + ' story modifications'
})),
story.long_parsed_date
])),
(story.starred_date &&
@ -3125,11 +3127,15 @@
$.make('div', { className: 'NB-feed-story-content' }, story.story_content)
]).data('story', story.id).data('story_id', story.id).data('feed_id', story.story_feed_id);
if (show_hide_mod_button) {
if (story_has_modifications) {
$('.NB-feed-story-hide-changes', $story).tipsy({
delayIn: 375
});
}
if (story_has_modifications && this.model.preference('hide_story_changes')) {
$('ins', $story).css({'text-decoration': 'none'});
$('del', $story).css({'display': 'none'});
}
if (this.model.preference('new_window') == 1) {
$('a', $story).attr('target', '_blank');
}
@ -3298,9 +3304,14 @@
hide_story_changes: function($story) {
var $button = $('.NB-feed-story-hide-changes', $story);
$('ins', $story).css({'text-decoration': 'none'});
$('del', $story).css({'display': 'none'});
if (this.model.preference('hide_story_changes')) {
$('ins', $story).css({'text-decoration': 'underline'});
$('del', $story).css({'display': 'inline'});
} else {
$('ins', $story).css({'text-decoration': 'none'});
$('del', $story).css({'display': 'none'});
}
$button.css('opacity', 1).fadeOut(400);
$button.tipsy('hide').tipsy('disable');
},

View file

@ -198,6 +198,30 @@ NEWSBLUR.ReaderPreferences.prototype = {
$.make('div', { className: 'NB-preference-sublabel' }, this.make_site_sidebar_count())
])
]),
$.make('div', { className: 'NB-preference NB-preference-hidestorychanges' }, [
$.make('div', { className: 'NB-preference-options' }, [
$.make('div', [
$.make('input', { id: 'NB-preference-hidestorychanges-1', type: 'radio', name: 'hide_story_changes', value: 0 }),
$.make('label', { 'for': 'NB-preference-hidestorychanges-1' }, [
$.make('img', { src: NEWSBLUR.Globals.MEDIA_URL+'/img/reader/code_icon.png' }),
'Show ',
$.make('del', 'changes'),
' ',
$.make('ins', 'revisions'),
' in stories.'
])
]),
$.make('div', [
$.make('input', { id: 'NB-preference-hidestorychanges-2', type: 'radio', name: 'hide_story_changes', value: 1 }),
$.make('label', { 'for': 'NB-preference-hidestorychanges-2' }, [
'Hide changes and only show the final story.'
])
])
]),
$.make('div', { className: 'NB-preference-label'}, [
'Story changes'
])
]),
$.make('div', { className: 'NB-preference NB-preference-singlestory' }, [
$.make('div', { className: 'NB-preference-options' }, [
$.make('div', [
@ -355,6 +379,12 @@ NEWSBLUR.ReaderPreferences.prototype = {
return false;
}
});
$('input[name=hide_story_changes]', this.$modal).each(function() {
if ($(this).val() == NEWSBLUR.Preferences.hide_story_changes) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=feed_view_single_story]', this.$modal).each(function() {
if ($(this).val() == NEWSBLUR.Preferences.feed_view_single_story) {
$(this).attr('checked', true);

View file

@ -28,6 +28,7 @@
'new_window' : 1,
'default_view' : 'page',
'hide_read_feeds' : 0,
'hide_story_changes' : 0,
'feed_view_single_story' : 0,
'view_settings' : {},
'collapsed_folders' : [],