Merge branch 'master' of github.com:samuelclay/NewsBlur

* 'master' of github.com:samuelclay/NewsBlur:
  Don't know how I feel about this change, but http://gizmodo.com/author/mat-honan.xml is failing when 'Safari/X' is in the user agent, but only with http opener. Ugh.
  Being much more aggressive about certain sites trying to take over the iframe. Blocking nytimes.com, twitter.com, and stackoverflow.com from even allowing an Original view.
  Fixing keyboard dialog.
  New preference: delay to mark a story as read.
  Closing #52: Adding delicious to sharing services and preferences. Thanks @palewire for the suggestion.
  db02 -> db01.
  db01 -> db02
  Adding backup restore for psql.
  Adding NEWSBLUR.reader.count_unreads_across_all_sites()
  Copying server settings.
This commit is contained in:
Samuel Clay 2012-05-08 10:18:31 -07:00
commit e73ed62d38
11 changed files with 249 additions and 67 deletions

1
.gitignore vendored
View file

@ -20,3 +20,4 @@ xcuserdata
*.mode1v3
*.pbxuser
media/maintenance.html
config/settings

View file

@ -32,6 +32,12 @@ from utils.diff import HTMLDiff
ENTRY_NEW, ENTRY_UPDATED, ENTRY_SAME, ENTRY_ERR = range(4)
BROKEN_PAGE_URLS = [
'nytimes.com',
'stackoverflow.com',
'twitter.com',
]
class Feed(models.Model):
feed_address = models.URLField(max_length=255, db_index=True)
feed_address_locked = models.NullBooleanField(default=False, blank=True, null=True)
@ -111,6 +117,11 @@ class Feed(models.Model):
feed['exception_type'] = None
feed['exception_code'] = self.exception_code
for broken_page in BROKEN_PAGE_URLS:
if broken_page in self.feed_link:
feed['disabled_page'] = True
break
if full:
feed['feed_tags'] = json.decode(self.data.popular_tags) if self.data.popular_tags else []
feed['feed_authors'] = json.decode(self.data.popular_authors) if self.data.popular_authors else []

33
fabfile.py vendored
View file

@ -240,6 +240,7 @@ def setup_app():
setup_vps()
setup_app_firewall()
setup_app_motd()
copy_app_settings()
setup_gunicorn(supervisor=True)
update_gunicorn()
@ -249,6 +250,7 @@ def setup_db():
setup_db_firewall()
setup_db_motd()
# setup_rabbitmq()
copy_task_settings()
setup_memcached()
setup_postgres()
setup_mongo()
@ -260,6 +262,7 @@ def setup_task():
setup_vps()
setup_task_firewall()
setup_task_motd()
copy_task_settings()
enable_celery_supervisor()
setup_gunicorn(supervisor=False)
update_gunicorn()
@ -495,6 +498,9 @@ def setup_node():
sudo('ufw allow 8888')
put('config/supervisor_node.conf', '/etc/supervisor/conf.d/node.conf', use_sudo=True)
def copy_app_settings():
put('config/settings/app_settings.py', '%s/local_settings.py' % env.NEWSBLUR_PATH)
run('echo "\nSERVER_NAME = \\\\"`hostname`\\\\"" >> %s/local_settings.py' % env.NEWSBLUR_PATH)
# ==============
# = Setup - DB =
@ -539,17 +545,19 @@ def setup_mongo():
sudo('apt-get -y install mongodb-10gen')
def setup_redis():
redis_version = '2.4.13'
with cd(env.VENDOR_PATH):
run('wget http://redis.googlecode.com/files/redis-2.4.2.tar.gz')
run('tar -xzf redis-2.4.2.tar.gz')
run('rm redis-2.4.2.tar.gz')
with cd(os.path.join(env.VENDOR_PATH, 'redis-2.4.2')):
run('wget http://redis.googlecode.com/files/redis-%s.tar.gz' % redis_version)
run('tar -xzf redis-%s.tar.gz' % redis_version)
run('rm redis-%s.tar.gz' % redis_version)
with cd(os.path.join(env.VENDOR_PATH, 'redis-%s' % redis_version)):
sudo('make install')
put('config/redis-init', '/etc/init.d/redis', use_sudo=True)
sudo('chmod u+x /etc/init.d/redis')
put('config/redis.conf', '/etc/redis.conf', use_sudo=True)
sudo('mkdir -p /var/lib/redis')
sudo('update-rc.d redis defaults')
sudo('/etc/init.d/redis stop')
sudo('/etc/init.d/redis start')
def setup_db_munin():
@ -572,6 +580,23 @@ def setup_task_motd():
def enable_celery_supervisor():
put('config/supervisor_celeryd.conf', '/etc/supervisor/conf.d/celeryd.conf', use_sudo=True)
def copy_task_settings():
put('config/settings/task_settings.py', '%s/local_settings.py' % env.NEWSBLUR_PATH)
run('echo "\nSERVER_NAME = \\\\"`hostname`\\\\"" >> %s/local_settings.py' % env.NEWSBLUR_PATH)
# ==============
# = Tasks - DB =
# ==============
def restore_postgres():
backup_date = '2012-05-03-08-00'
run('PYTHONPATH=/home/sclay/newsblur python s3.py get backup_postgresql_%s.sql.gz' % backup_date)
sudo('su postgres -c "createuser -U newsblur"')
sudo('su postgres -c "createdb newsblur -O newsblur"')
sudo('su postgres -c "pg_restore --role=newsblur --dbname=newsblur backup_postgresql_%s.sql.gz"' % backup_date)
# ======
# = S3 =
# ======

View file

@ -2491,12 +2491,18 @@ background: transparent;
.NB-taskbar .task_button.task_view_page.NB-exception-page .NB-task-image {
background-image: url('/media/embed/icons/silk/exclamation.png');
}
.NB-taskbar .task_button.task_view_page.NB-disabled-page .NB-task-image {
background-image: url('/media/embed/icons/silk/error.png');
}
.NB-taskbar .task_button.task_view_feed .NB-task-image {
background: transparent url('/media/embed/icons/silk/application_view_list.png') no-repeat 0 0;
}
.NB-taskbar .task_button.task_view_story .NB-task-image {
background: transparent url('/media/embed/icons/silk/application_view_gallery.png') no-repeat 0 0;
}
.NB-taskbar .task_button.task_view_story.NB-disabled-page .NB-task-image {
background-image: url('/media/embed/icons/silk/error.png');
}
.NB-taskbar .task_button.task_story_next_positive .NB-task-image {
background: transparent url('/media/embed/icons/silk/bullet_green.png') no-repeat 0 0;
}
@ -4441,6 +4447,9 @@ background: transparent;
.NB-menu-manage .NB-menu-manage-story-thirdparty .NB-menu-manage-thirdparty-tumblr {
background: transparent url('/media/embed/reader/tumblr.png') no-repeat 0 0;
}
.NB-menu-manage .NB-menu-manage-story-thirdparty .NB-menu-manage-thirdparty-delicious {
background: transparent url('/media/embed/reader/delicious.png') no-repeat 0 0;
}
.NB-menu-manage .NB-menu-manage-story-thirdparty .NB-menu-manage-thirdparty-pinboard {
background: transparent url('/media/embed/reader/pinboard.png') no-repeat 0 0;
}
@ -4488,6 +4497,13 @@ background: transparent;
.NB-menu-manage .NB-menu-manage-story-thirdparty.NB-menu-manage-highlight-tumblr .NB-menu-manage-thirdparty-tumblr {
opacity: 1;
}
.NB-menu-manage .NB-menu-manage-story-thirdparty.NB-menu-manage-highlight-delicious .NB-menu-manage-image,
.NB-menu-manage .NB-menu-manage-story-thirdparty.NB-menu-manage-highlight-delicious .NB-menu-manage-thirdparty-icon {
opacity: .2;
}
.NB-menu-manage .NB-menu-manage-story-thirdparty.NB-menu-manage-highlight-delicious .NB-menu-manage-thirdparty-delicious {
opacity: 1;
}
.NB-menu-manage .NB-menu-manage-story-thirdparty.NB-menu-manage-highlight-pinboard .NB-menu-manage-image,
.NB-menu-manage .NB-menu-manage-story-thirdparty.NB-menu-manage-highlight-pinboard .NB-menu-manage-thirdparty-icon {
opacity: .2;
@ -5590,7 +5606,7 @@ background: transparent;
margin-right: 0;
}
.NB-modal-keyboard .NB-keyboard-shortcut .NB-keyboard-shortcut-key {
.NB-keyboard-shortcut-key {
border-radius: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
@ -5607,12 +5623,12 @@ background: transparent;
margin: 0 4px 0 0;
}
.NB-modal-keyboard .NB-keyboard-shortcut .NB-keyboard-shortcut-key span {
.NB-keyboard-shortcut-key span {
color: #A0A0A0;
padding: 0 4px;
}
.NB-modal-keyboard .NB-keyboard-shortcut .NB-keyboard-shortcut-explanation {
.NB-keyboard-shortcut-explanation {
float: right;
font-size: 14px;
font-weight: bold;
@ -5621,11 +5637,11 @@ background: transparent;
color: #404030;
text-shadow: 1px 1px 0 #E0E0E0;
}
.NB-modal-keyboard .NB-keyboard-shortcut .NB-keyboard-shortcut-image {
.NB-keyboard-shortcut-image {
clear: both;
}
.NB-modal-keyboard .NB-keyboard-shortcut .NB-keyboard-shortcut-image img {
.NB-keyboard-shortcut-image img {
margin: 8px 0 0 0;
border: 1px solid #202020;
width: 268px;
@ -5771,6 +5787,12 @@ background: transparent;
-webkit-box-shadow:2px 2px 0 #D0D0D0;
box-shadow:2px 2px 0 #D0D0D0;
}
.NB-modal-preferences .NB-preference-readstorydelay .NB-tangle-readstorydelay {
display: inline-block;
margin: 0 16px 0 8px;
top: 2px;
width: 100px;
}
.NB-modal-preferences .NB-preference.NB-preference-story-share .NB-preference-option {
float: left;
margin: 0 8px 4px 0;
@ -5795,6 +5817,9 @@ background: transparent;
.NB-modal-preferences .NB-preference-story-share label[for=NB-preference-story-share-tumblr] {
background: transparent url('/media/embed/reader/tumblr.png') no-repeat 0 0;
}
.NB-modal-preferences .NB-preference-story-share label[for=NB-preference-story-share-delicious] {
background: transparent url('/media/embed/reader/delicious.png') no-repeat 0 0;
}
.NB-modal-preferences .NB-preference-story-share label[for=NB-preference-story-share-pinboard] {
background: transparent url('/media/embed/reader/pinboard.png') no-repeat 0 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -962,15 +962,14 @@
this.active_story = story;
this.mark_story_title_as_selected($next_story_title);
this.mark_story_as_read(story.id);
this.mark_story_as_read_in_feed_view(story, {'animate': this.story_view == 'feed'});
}
}
},
mark_story_as_read_in_feed_view: function(story, options) {
if (!story) return;
mark_story_as_read_in_feed_view: function(story_id, options) {
if (!story_id) return;
options = options || {};
$story = this.cache.feed_view_stories[story.id] || this.find_story_in_feed_view(story.id);
$story = this.cache.feed_view_stories[story_id] || this.find_story_in_feed_view(story_id);
if ($story) {
$story.addClass('read');
}
@ -1730,6 +1729,7 @@
'feed_title_floater_feed_id': null,
'feed_title_floater_story_id': null,
'last_feed_view_story_feed_id': null,
'last_read_story_id': null,
'$feed_in_feed_list': {},
'$feed_counts_in_feed_list': {}
});
@ -1753,6 +1753,7 @@
$('.NB-selected', this.$s.$feed_list).removeClass('NB-selected');
this.$s.$body.removeClass('NB-view-river');
$('.task_view_page', this.$s.$taskbar).removeClass('NB-disabled');
$('.task_view_story', this.$s.$taskbar).removeClass('NB-disabled');
$('.task_view_page', this.$s.$taskbar).removeClass('NB-task-return');
this.hide_content_pane_feed_counter();
// $('.feed_counts_floater').remove();
@ -1913,8 +1914,20 @@
view = 'feed';
}
$('.task_view_page').addClass('NB-exception-page');
} else if (feed && feed.disabled_page) {
if (view == 'page') {
view = 'feed';
}
$('.task_view_page').addClass('NB-disabled-page')
.addClass('NB-disabled');
$('.task_view_story').addClass('NB-disabled-page')
.addClass('NB-disabled');
} else {
$('.task_view_page').removeClass('NB-exception-page');
$('.task_view_page').removeClass('NB-disabled-page')
.removeClass('NB-disabled')
.removeClass('NB-exception-page');
$('.task_view_story').removeClass('NB-disabled-page')
.removeClass('NB-disabled');
}
this.story_view = view;
@ -1924,6 +1937,17 @@
// = Feed Header =
// ===============
count_unreads_across_all_sites: function() {
return _.reduce(this.model.feeds, function(m, v) {
if (v.active) {
m['positive'] += v.ps;
m['neutral'] += v.nt;
m['negative'] += v.ng;
}
return m;
}, {'positive': 0, 'negative': 0, 'neutral': 0});
},
update_header_counts: function(skip_sites, unread_view) {
if (!skip_sites) {
var feeds_count = _.select(this.model.feeds, function(f) {
@ -1934,14 +1958,7 @@
}
}
var unread_counts = _.reduce(this.model.feeds, function(m, v) {
if (v.active) {
m['positive'] += v.ps;
m['neutral'] += v.nt;
m['negative'] += v.ng;
}
return m;
}, {'positive': 0, 'negative': 0, 'neutral': 0});
var unread_counts = this.count_unreads_across_all_sites();
_(['positive', 'neutral', 'negative']).each(function(level) {
// This is for .NB-feeds-header-count
var $count = $('.NB-feeds-header-'+level);
@ -2223,7 +2240,6 @@
if (this.active_story != story) {
this.active_story = story;
this.mark_story_title_as_selected($story_title);
this.mark_story_as_read_in_feed_view(story, {'animate': true});
this.unload_story_iframe();
// Used when auto-tracking the user as they move over the feed/page.
@ -2498,14 +2514,29 @@
// $story_title.parent('.story').next('.story').children('a').addClass('after_selected');
},
mark_story_as_read: function(story_id) {
mark_story_as_read: function(story_id, skip_delay) {
var self = this;
var delay = this.model.preference('read_story_delay');
if (skip_delay) {
delay = 0;
} else if (delay == -1) {
return;
}
this.cache.last_read_story_id = story_id;
clearTimeout(this.cache.read_story_delay);
this.cache.read_story_delay = _.delay(_.bind(function() {
if (skip_delay || this.cache.last_read_story_id == story_id || delay == 0) {
var $story_title = this.find_story_in_story_titles(story_id);
var feed_id = parseInt($story_title.data('feed_id'), 10) || this.active_feed;
this.model.mark_story_as_read(story_id, feed_id, function(read) {
self.update_read_count(story_id, feed_id, false, read);
});
this.mark_story_as_read_in_feed_view(story_id, {'animate': this.story_view == 'feed'});
}
}, this), delay * 1000);
},
mark_story_as_unread: function(story_id, feed_id) {
@ -2636,7 +2667,7 @@
if (_.includes(this.active_feed, folder_name)) {
$('.story:not(.read)', this.$s.$story_titles).addClass('read');
_.each(this.model.stories, _.bind(function(story) {
this.mark_story_as_read_in_feed_view(story);
this.mark_story_as_read_in_feed_view(story.id);
}, this));
}
},
@ -2790,6 +2821,20 @@
this.mark_story_as_read(story_id);
},
send_story_to_delicious: function(story_id) {
var story = this.model.get_story(story_id);
var url = 'http://www.delicious.com/save';
var delicious_url = [
url,
'?v=6&url=',
encodeURIComponent(story.story_permalink),
'&title=',
encodeURIComponent(story.story_title)
].join('');
window.open(delicious_url, '_blank');
this.mark_story_as_read(story_id);
},
send_story_to_readability: function(story_id) {
var story = this.model.get_story(story_id);
var url = 'http://www.readability.com/save';
@ -3047,7 +3092,6 @@
unload_feed_iframe: function() {
var $feed_iframe = this.$s.$feed_iframe;
var $taskbar_view_page = $('.NB-taskbar .task_view_page');
$taskbar_view_page.removeClass('NB-disabled');
$taskbar_view_page.removeClass('NB-task-return');
this.flags['iframe_view_loaded'] = false;
@ -3991,6 +4035,8 @@
if (view == 'page' && feed && feed.has_exception && feed.exception_type == 'page') {
this.open_feed_exception_modal(this.active_feed);
return;
} else if (_.contains(['page', 'story'], view) && feed && feed.disabled_page) {
view = 'feed';
} else if ($('.task_button_view.task_view_'+view).hasClass('NB-disabled')) {
return;
}
@ -4458,6 +4504,11 @@
}, this)).bind('mouseleave', _.bind(function(e) {
$(e.target).siblings('.NB-menu-manage-title').text('Email story').parent().removeClass('NB-menu-manage-highlight-tumblr');
}, this))),
(NEWSBLUR.Preferences['story_share_delicious'] && $.make('div', { className: 'NB-menu-manage-thirdparty-icon NB-menu-manage-thirdparty-delicious'}).bind('mouseenter', _.bind(function(e) {
$(e.target).siblings('.NB-menu-manage-title').text('Delicious').parent().addClass('NB-menu-manage-highlight-delicious');
}, this)).bind('mouseleave', _.bind(function(e) {
$(e.target).siblings('.NB-menu-manage-title').text('Email story').parent().removeClass('NB-menu-manage-highlight-delicious');
}, this))),
(NEWSBLUR.Preferences['story_share_pinboard'] && $.make('div', { className: 'NB-menu-manage-thirdparty-icon NB-menu-manage-thirdparty-pinboard'}).bind('mouseenter', _.bind(function(e) {
$(e.target).siblings('.NB-menu-manage-title').text('Pinboard').parent().addClass('NB-menu-manage-highlight-pinboard');
}, this)).bind('mouseleave', _.bind(function(e) {
@ -4492,6 +4543,8 @@
this.send_story_to_readitlater(story.id);
} else if ($target.hasClass('NB-menu-manage-thirdparty-tumblr')) {
this.send_story_to_tumblr(story.id);
} else if ($target.hasClass('NB-menu-manage-thirdparty-delicious')) {
this.send_story_to_delicious(story.id);
} else if ($target.hasClass('NB-menu-manage-thirdparty-readability')) {
this.send_story_to_readability(story.id);
} else if ($target.hasClass('NB-menu-manage-thirdparty-pinboard')) {
@ -6192,7 +6245,7 @@
$.targetIs(e, { tagSelector: 'a.mark_story_as_read' }, function($t, $p){
e.preventDefault();
var story_id = $t.attr('href').slice(1).split('/');
self.mark_story_as_read(story_id);
self.mark_story_as_read(story_id, true);
});
$.targetIs(e, { tagSelector: '.NB-feed-story-premium-only a' }, function($t, $p){
e.preventDefault();
@ -6916,7 +6969,7 @@
e.preventDefault();
self.page_in_story(0.65, -1);
});
$document.bind('keydown', 'u', function(e) {
$document.bind('keydown', 'shift+u', function(e) {
e.preventDefault();
if (self.flags['sidebar_closed']) {
self.open_sidebar();
@ -6988,12 +7041,12 @@
e.preventDefault();
self.open_river_stories();
});
$document.bind('keydown', 'shift+u', function(e) {
$document.bind('keydown', 'u', function(e) {
e.preventDefault();
var story_id = self.active_story.id;
console.log(["self.active_story", self.active_story]);
if (self.active_story && !self.active_story.read_status) {
self.mark_story_as_read(story_id);
self.mark_story_as_read(story_id, true);
} else if (self.active_story && self.active_story.read_status) {
self.mark_story_as_unread(story_id);
}

View file

@ -121,7 +121,7 @@ NEWSBLUR.ReaderKeyboard.prototype = {
])
]),
$.make('div', { className: 'NB-keyboard-shortcut NB-last' }, [
$.make('div', { className: 'NB-keyboard-shortcut-explanation' }, 'Hide Sidebar'),
$.make('div', { className: 'NB-keyboard-shortcut-explanation' }, 'Toggle read/unread'),
$.make('div', { className: 'NB-keyboard-shortcut-key' }, [
'u'
])
@ -206,7 +206,7 @@ NEWSBLUR.ReaderKeyboard.prototype = {
]),
$.make('div', { className: 'NB-keyboard-group' }, [
$.make('div', { className: 'NB-keyboard-shortcut' }, [
$.make('div', { className: 'NB-keyboard-shortcut-explanation' }, 'Toggle read/unread'),
$.make('div', { className: 'NB-keyboard-shortcut-explanation' }, 'Hide Sidebar'),
$.make('div', { className: 'NB-keyboard-shortcut-key' }, [
'shift',
$.make('span', '+'),

View file

@ -313,6 +313,37 @@ _.extend(NEWSBLUR.ReaderPreferences.prototype, {
'When opening a site'
])
]),
$.make('div', { className: 'NB-preference NB-preference-readstorydelay' }, [
$.make('div', { className: 'NB-preference-options' }, [
$.make('div', [
$.make('input', { id: 'NB-preference-readstorydelay-1', type: 'radio', name: 'read_story_delay', value: '0' }),
$.make('label', { 'for': 'NB-preference-readstorydelay-1' }, [
'Immediately'
])
]),
$.make('div', [
$.make('input', { id: 'NB-preference-readstorydelay-2', type: 'radio', name: 'read_story_delay', value: '1' }),
$.make('label', { 'for': 'NB-preference-readstorydelay-2' }, [
'After ',
$.make('span', { className: 'NB-tangle-readstorydelay', 'data-var': 'delay' }),
$.make('span', { className: 'NB-tangle-seconds' }, ' second.')
])
]),
$.make('div', [
$.make('input', { id: 'NB-preference-readstorydelay-0', type: 'radio', name: 'read_story_delay', value: "-1" }),
$.make('label', { 'for': 'NB-preference-readstorydelay-0' }, [
'Manually by hitting ',
$.make('div', { className: 'NB-keyboard-shortcut-key',
style: 'display: inline; float: none' }, [
'u'
])
])
])
]),
$.make('div', { className: 'NB-preference-label'}, [
'Mark a story as read'
])
]),
$.make('div', { className: 'NB-preference NB-preference-hidestorychanges' }, [
$.make('div', { className: 'NB-preference-options' }, [
$.make('div', [
@ -473,6 +504,10 @@ _.extend(NEWSBLUR.ReaderPreferences.prototype, {
$.make('div', { className: 'NB-preference-option', title: 'Tumblr' }, [
$.make('input', { type: 'checkbox', id: 'NB-preference-story-share-tumblr', name: 'story_share_tumblr' }),
$.make('label', { 'for': 'NB-preference-story-share-tumblr' })
]),
$.make('div', { className: 'NB-preference-option', title: 'Delicious' }, [
$.make('input', { type: 'checkbox', id: 'NB-preference-story-share-delicious', name: 'story_share_delicious' }),
$.make('label', { 'for': 'NB-preference-story-share-delicious' })
])
]),
$.make('div', { className: 'NB-preference-label'}, [
@ -515,8 +550,10 @@ _.extend(NEWSBLUR.ReaderPreferences.prototype, {
},
select_preferences: function() {
var $modal = this.$modal;
if (NEWSBLUR.Preferences.timezone) {
$('select[name=timezone] option', this.$modal).each(function() {
$('select[name=timezone] option', $modal).each(function() {
if ($(this).val() == NEWSBLUR.Preferences.timezone) {
$(this).attr('selected', true);
return false;
@ -524,85 +561,91 @@ _.extend(NEWSBLUR.ReaderPreferences.prototype, {
});
}
$('input[name=default_view]', this.$modal).each(function() {
$('input[name=default_view]', $modal).each(function() {
if ($(this).val() == NEWSBLUR.Preferences.default_view) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=story_pane_anchor]', this.$modal).each(function() {
$('input[name=story_pane_anchor]', $modal).each(function() {
if ($(this).val() == NEWSBLUR.Preferences.story_pane_anchor) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=new_window]', this.$modal).each(function() {
$('input[name=new_window]', $modal).each(function() {
if ($(this).val() == NEWSBLUR.Preferences.new_window) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=hide_read_feeds]', this.$modal).each(function() {
$('input[name=hide_read_feeds]', $modal).each(function() {
if ($(this).val() == NEWSBLUR.Preferences.hide_read_feeds) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=feed_order]', this.$modal).each(function() {
$('input[name=feed_order]', $modal).each(function() {
if ($(this).val() == NEWSBLUR.Preferences.feed_order) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=ssl]', this.$modal).each(function() {
$('input[name=ssl]', $modal).each(function() {
if ($(this).val() == NEWSBLUR.Preferences.ssl) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=show_unread_counts_in_title]', this.$modal).each(function() {
$('input[name=show_unread_counts_in_title]', $modal).each(function() {
if (NEWSBLUR.Preferences.show_unread_counts_in_title) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=open_feed_action]', this.$modal).each(function() {
$('input[name=open_feed_action]', $modal).each(function() {
if ($(this).val() == NEWSBLUR.Preferences.open_feed_action) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=hide_story_changes]', this.$modal).each(function() {
$('input[name=read_story_delay]', $modal).each(function() {
if ($(this).val() == ""+NEWSBLUR.Preferences.read_story_delay) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=hide_story_changes]', $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() {
$('input[name=feed_view_single_story]', $modal).each(function() {
if ($(this).val() == NEWSBLUR.Preferences.feed_view_single_story) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=animations]', this.$modal).each(function() {
$('input[name=animations]', $modal).each(function() {
if ($(this).val() == ""+NEWSBLUR.Preferences.animations) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=folder_counts]', this.$modal).each(function() {
$('input[name=folder_counts]', $modal).each(function() {
if ($(this).val() == ""+NEWSBLUR.Preferences.folder_counts) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=show_tooltips]', this.$modal).each(function() {
$('input[name=show_tooltips]', $modal).each(function() {
if ($(this).val() == NEWSBLUR.Preferences.show_tooltips) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=story_styling]', this.$modal).each(function() {
$('input[name=story_styling]', $modal).each(function() {
if ($(this).val() == NEWSBLUR.Preferences.story_styling) {
$(this).attr('checked', true);
return false;
@ -612,10 +655,32 @@ _.extend(NEWSBLUR.ReaderPreferences.prototype, {
var share_preferences = _.select(_.keys(NEWSBLUR.Preferences), function(p) {
return p.indexOf('story_share') != -1;
});
_.each(share_preferences, _.bind(function(share) {
_.each(share_preferences, function(share) {
var share_name = share.match(/story_share_(.*)/)[1];
$('input#NB-preference-story-share-'+share_name, this.$modal).attr('checked', NEWSBLUR.Preferences[share]);
}, this));
$('input#NB-preference-story-share-'+share_name, $modal).attr('checked', NEWSBLUR.Preferences[share]);
});
$(".NB-tangle-readstorydelay", $modal).slider({
range: 'min',
min: 1,
max: 60,
step: 1,
value: NEWSBLUR.Preferences.read_story_delay > 0 ? NEWSBLUR.Preferences.read_story_delay : 1,
slide: _.bind(this.slide_read_story_delay_slider, this)
});
this.slide_read_story_delay_slider();
},
slide_read_story_delay_slider: function(e, ui) {
var value = (ui && ui.value) ||
(NEWSBLUR.Preferences.read_story_delay > 0 ? NEWSBLUR.Preferences.read_story_delay : 1);
$(".NB-tangle-seconds", this.$modal).text(value == 1 ? value + ' second.' : value + ' seconds.');
if (NEWSBLUR.Preferences.read_story_delay > 0 || ui) {
$("#NB-preference-readstorydelay-2", this.$modal).attr('checked', true).val(value);
if (ui) {
this.enable_save();
}
}
},
serialize_preferences: function() {

View file

@ -39,6 +39,7 @@
'feed_order' : 'ALPHABETICAL',
'ssl' : 0,
'open_feed_action' : 0,
'read_story_delay' : 0,
'hide_story_changes' : 1,
'feed_view_single_story' : 0,
'animations' : true,

View file

@ -58,7 +58,7 @@ class FetchFeed:
modified = None
etag = None
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_1) AppleWebKit/534.48.3 (KHTML, like Gecko) Version/5.1 Safari/534.48.3 (NewsBlur Feed Fetcher - %s subscriber%s - %s)' % (
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/536.2.3 (KHTML, like Gecko) Version/5.2 (NewsBlur Feed Fetcher - %s subscriber%s - %s)' % (
self.feed.num_subscribers,
's' if self.feed.num_subscribers != 1 else '',
settings.NEWSBLUR_URL
@ -253,9 +253,10 @@ class ProcessFeed:
unicode(self.feed)[:30], hub_url))
PushSubscription.objects.subscribe(self_url, feed=self.feed, hub=hub_url)
logging.debug(u' ---> [%-30s] ~FYParsed Feed: new=~FG~SB%s~SN~FY up=~FY~SB%s~SN same=~FY%s err=~FR~SB%s' % (
logging.debug(u' ---> [%-30s] ~FYParsed Feed: new=~FG~SB%s~SN~FY up=~FY~SB%s~SN same=~FY%s err=~FR~SB%s~SN~FY total=~SB%s' % (
unicode(self.feed)[:30],
ret_values[ENTRY_NEW], ret_values[ENTRY_UPDATED], ret_values[ENTRY_SAME], ret_values[ENTRY_ERR]))
ret_values[ENTRY_NEW], ret_values[ENTRY_UPDATED], ret_values[ENTRY_SAME], ret_values[ENTRY_ERR],
len(self.fpf.entries)))
self.feed.update_all_statistics(full=bool(ret_values[ENTRY_NEW]), force=self.options['force'])
self.feed.trim_feed()
self.feed.save_feed_history(200, "OK")