mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Merge branch 'master' into social
* master: Boosting fillout pages. Small cleanup in ajax manager. Abort old requests and don't cache responses. Trying to fix IE read story bug. Force jquery to never cache. Checking for exceptions earlier in order to show fixed site. Changing user agent to hopefully override overly-sniffy websites. Fixing inaccurate substitution on feed urls. Ugh, can't believe this was here this long. Adding the setting of a feed's view settings to Site Settings dialog. This should've been in there a loooong time ago.
This commit is contained in:
commit
3e7d6a42ee
6 changed files with 116 additions and 20 deletions
|
@ -582,11 +582,9 @@ class Feed(models.Model):
|
|||
|
||||
def update(self, verbose=False, force=False, single_threaded=True, compute_scores=True):
|
||||
from utils import feed_fetcher
|
||||
try:
|
||||
if settings.DEBUG:
|
||||
self.feed_address = self.feed_address % {'NEWSBLUR_DIR': settings.NEWSBLUR_DIR}
|
||||
self.feed_link = self.feed_link % {'NEWSBLUR_DIR': settings.NEWSBLUR_DIR}
|
||||
except:
|
||||
pass
|
||||
|
||||
self.set_next_scheduled_update()
|
||||
|
||||
|
|
|
@ -5095,6 +5095,12 @@ background: transparent;
|
|||
.NB-modal-exception.NB-modal-feed-settings .NB-exception-block-only {
|
||||
display: none;
|
||||
}
|
||||
.NB-modal-exception .NB-settings-only {
|
||||
display: none;
|
||||
}
|
||||
.NB-modal-exception.NB-modal-feed-settings .NB-settings-only {
|
||||
display: block;
|
||||
}
|
||||
.NB-modal-exception .NB-modal-title {
|
||||
display: none;
|
||||
}
|
||||
|
@ -5145,6 +5151,40 @@ background: transparent;
|
|||
.NB-modal-exception .NB-modal-loading {
|
||||
margin: 6px 8px 0;
|
||||
}
|
||||
.NB-modal-feed-settings .NB-preference-label {
|
||||
float: left;
|
||||
margin: 6px 0;
|
||||
}
|
||||
.NB-modal-feed-settings .NB-preference-options {
|
||||
margin-left: 24px;
|
||||
float: left;
|
||||
overflow: hidden;
|
||||
}
|
||||
.NB-modal-feed-settings .NB-preference-options div {
|
||||
float: left;
|
||||
margin: 0 12px;
|
||||
}
|
||||
.NB-modal-feed-settings .NB-preference-options input[type=radio] {
|
||||
float: left;
|
||||
margin: 10px 4px;
|
||||
}
|
||||
|
||||
.NB-modal-feed-settings .NB-preference-options label {
|
||||
padding-left: 4px;
|
||||
margin: 0 0 4px 0;
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
.NB-modal-feed-settings .NB-preference-options img {
|
||||
height: 31px;
|
||||
}
|
||||
.NB-modal-feed-settings .NB-exception-option-status {
|
||||
color: #3945C0;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* ===================== */
|
||||
/* = Feedchooser Modal = */
|
||||
/* ===================== */
|
||||
|
@ -6630,4 +6670,4 @@ background: transparent;
|
|||
.NB-modal-friends .NB-profile-badge .NB-profile-badge-stats .NB-count {
|
||||
padding-right: 3px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,10 +43,10 @@ NEWSBLUR.AssetModel.Reader.prototype = {
|
|||
|
||||
init: function() {
|
||||
this.ajax = {};
|
||||
this.ajax['queue'] = $.manageAjax.create('queue', {queue: false});
|
||||
this.ajax['queue'] = $.manageAjax.create('queue', {queue: true});
|
||||
this.ajax['queue_clear'] = $.manageAjax.create('queue_clear', {queue: 'clear'});
|
||||
this.ajax['feed'] = $.manageAjax.create('feed', {queue: 'clear', abortOld: true, domCompleteTrigger: true});
|
||||
this.ajax['feed_page'] = $.manageAjax.create('feed_page', {queue: false, abortOld: true, abortIsNoSuccess: false, domCompleteTrigger: true});
|
||||
this.ajax['feed_page'] = $.manageAjax.create('feed_page', {queue: 'clear', abortOld: true, abortIsNoSuccess: false, domCompleteTrigger: true});
|
||||
this.ajax['statistics'] = $.manageAjax.create('statistics', {queue: 'clear', abortOld: true});
|
||||
$.ajaxSettings.traditional = true;
|
||||
return;
|
||||
|
@ -68,7 +68,6 @@ NEWSBLUR.AssetModel.Reader.prototype = {
|
|||
}
|
||||
if (options['ajax_group'] == 'statistics') {
|
||||
clear_queue = true;
|
||||
request_type = 'GET';
|
||||
}
|
||||
|
||||
if (clear_queue) {
|
||||
|
@ -79,6 +78,8 @@ NEWSBLUR.AssetModel.Reader.prototype = {
|
|||
url: url,
|
||||
data: data,
|
||||
type: request_type,
|
||||
cache: false,
|
||||
cacheResponse: false,
|
||||
beforeSend: function() {
|
||||
// NEWSBLUR.log(['beforeSend', options]);
|
||||
$.isFunction(options['beforeSend']) && options['beforeSend']();
|
||||
|
@ -129,7 +130,6 @@ NEWSBLUR.AssetModel.Reader.prototype = {
|
|||
feed_id: feed_id
|
||||
}, null, null, {
|
||||
'ajax_group': 'queue_clear',
|
||||
'traditional': true,
|
||||
'beforeSend': function() {
|
||||
self.queued_read_stories[feed_id] = [];
|
||||
}
|
||||
|
@ -485,19 +485,19 @@ NEWSBLUR.AssetModel.Reader.prototype = {
|
|||
NEWSBLUR.log(['Dupe feed being refreshed', f, feed.id, this.feeds[f]]);
|
||||
this.feeds[feed.id] = this.feeds[f];
|
||||
}
|
||||
if ((feed['has_exception'] && !this.feeds[f]['has_exception']) ||
|
||||
(this.feeds[f]['has_exception'] && !feed['has_exception'])) {
|
||||
updated = true;
|
||||
this.feeds[f]['has_exception'] = !!feed['has_exception'];
|
||||
}
|
||||
for (var k in feed) {
|
||||
if (this.feeds[f][k] != feed[k]) {
|
||||
// NEWSBLUR.log(['New Feed', this.feeds[f][k], feed[k], f, k]);
|
||||
NEWSBLUR.log(['Different', k, this.feeds[f][k], feed[k]]);
|
||||
this.feeds[f][k] = feed[k];
|
||||
NEWSBLUR.log(['Different', k, this.feeds[f], feed]);
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
if ((feed['has_exception'] && !this.feeds[f]['has_exception']) ||
|
||||
(this.feeds[f]['has_exception'] && !feed['has_exception'])) {
|
||||
updated = true;
|
||||
this.feeds[f]['has_exception'] = !!feed['has_exception'];
|
||||
}
|
||||
if (feed['favicon']) {
|
||||
this.feeds[f]['favicon'] = feed['favicon'];
|
||||
this.feeds[f]['favicon_color'] = feed['favicon_color'];
|
||||
|
@ -811,7 +811,7 @@ NEWSBLUR.AssetModel.Reader.prototype = {
|
|||
get_feed_statistics: function(feed_id, callback) {
|
||||
this.make_request('/rss_feeds/statistics/'+feed_id, {}, callback, callback, {
|
||||
'ajax_group': 'statistics',
|
||||
'requesst_type': 'GET'
|
||||
'request_type': 'GET'
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
this.layout = {};
|
||||
this.constants = {
|
||||
FEED_REFRESH_INTERVAL: (1000 * 60) * 1, // 1 minute
|
||||
FILL_OUT_PAGES: 8,
|
||||
FILL_OUT_PAGES: 50,
|
||||
RIVER_STORIES_FOR_STANDARD_ACCOUNT: 12
|
||||
};
|
||||
|
||||
|
@ -1953,7 +1953,7 @@
|
|||
this.$s.$body.addClass('NB-view-river');
|
||||
this.flags.river_view = true;
|
||||
$('.task_view_page', this.$s.$taskbar).addClass('NB-disabled');
|
||||
var explicit_view_setting = NEWSBLUR.Preferences.view_settings[this.active_feed];
|
||||
var explicit_view_setting = this.model.view_setting(this.active_feed);
|
||||
if (!explicit_view_setting) {
|
||||
explicit_view_setting = 'feed';
|
||||
}
|
||||
|
@ -2014,7 +2014,7 @@
|
|||
|
||||
|
||||
$('.task_view_page', this.$s.$taskbar).addClass('NB-disabled');
|
||||
var explicit_view_setting = NEWSBLUR.Preferences.view_settings[this.active_feed];
|
||||
var explicit_view_setting = this.model.view_setting(this.active_feed);
|
||||
if (!explicit_view_setting) {
|
||||
explicit_view_setting = 'feed';
|
||||
}
|
||||
|
|
|
@ -30,10 +30,17 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
|
|||
},
|
||||
|
||||
initialize_feed: function(feed_id) {
|
||||
var view_setting = this.model.view_setting(feed_id);
|
||||
NEWSBLUR.Modal.prototype.initialize_feed.call(this, feed_id);
|
||||
$('input[name=feed_link]', this.$modal).val(this.feed.feed_link);
|
||||
$('input[name=feed_address]', this.$modal).val(this.feed.feed_address);
|
||||
|
||||
$('input[name=view_settings]', this.$modal).each(function() {
|
||||
if ($(this).val() == view_setting) {
|
||||
$(this).attr('checked', true);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (this.feed.exception_type) {
|
||||
this.$modal.removeClass('NB-modal-feed-settings');
|
||||
} else {
|
||||
|
@ -74,6 +81,40 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
|
|||
$.make('span', { className: 'NB-modal-feed-subscribers' }, Inflector.commas(this.feed.num_subscribers) + Inflector.pluralize(' subscriber', this.feed.num_subscribers))
|
||||
])
|
||||
]),
|
||||
$.make('div', { className: 'NB-fieldset NB-exception-option NB-exception-option-view NB-modal-submit NB-settings-only' }, [
|
||||
$.make('h5', [
|
||||
$.make('div', { className: 'NB-exception-option-status NB-right' }),
|
||||
$.make('div', { className: 'NB-exception-option-meta' }),
|
||||
'View settings'
|
||||
]),
|
||||
$.make('div', { className: 'NB-fieldset-fields' }, [
|
||||
$.make('div', { className: 'NB-exception-input-wrapper' }, [
|
||||
$.make('div', { className: 'NB-preference-label'}, [
|
||||
'Reading view'
|
||||
]),
|
||||
$.make('div', { className: 'NB-preference-options' }, [
|
||||
$.make('div', [
|
||||
$.make('input', { id: 'NB-preference-view-1', type: 'radio', name: 'view_settings', value: 'page' }),
|
||||
$.make('label', { 'for': 'NB-preference-view-1' }, [
|
||||
$.make('img', { src: NEWSBLUR.Globals.MEDIA_URL+'/img/reader/preferences_view_original.png' })
|
||||
])
|
||||
]),
|
||||
$.make('div', [
|
||||
$.make('input', { id: 'NB-preference-view-2', type: 'radio', name: 'view_settings', value: 'feed' }),
|
||||
$.make('label', { 'for': 'NB-preference-view-2' }, [
|
||||
$.make('img', { src: NEWSBLUR.Globals.MEDIA_URL+'/img/reader/preferences_view_feed.png' })
|
||||
])
|
||||
]),
|
||||
$.make('div', [
|
||||
$.make('input', { id: 'NB-preference-view-3', type: 'radio', name: 'view_settings', value: 'story' }),
|
||||
$.make('label', { 'for': 'NB-preference-view-3' }, [
|
||||
$.make('img', { src: NEWSBLUR.Globals.MEDIA_URL+'/img/reader/preferences_view_story.png' })
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
]),
|
||||
$.make('div', { className: 'NB-fieldset NB-exception-option NB-exception-option-retry NB-modal-submit NB-exception-block-only' }, [
|
||||
$.make('h5', [
|
||||
$.make('div', { className: 'NB-exception-option-meta' }),
|
||||
|
@ -283,6 +324,23 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
|
|||
self.initialize_feed(feed_id);
|
||||
self.get_feed_settings();
|
||||
});
|
||||
|
||||
$.targetIs(e, { tagSelector: 'input[name=view_settings]' }, function($t, $p){
|
||||
self.model.view_setting(self.feed_id, $t.val());
|
||||
|
||||
var $status = $('.NB-exception-option-view .NB-exception-option-status', self.$modal);
|
||||
$status.text('Saved').animate({
|
||||
'opacity': 1
|
||||
}, {
|
||||
'queue': false,
|
||||
'duration': 600,
|
||||
'complete': function() {
|
||||
_.delay(function() {
|
||||
$status.animate({'opacity': 0}, {'queue': false, 'duration': 1000});
|
||||
}, 300);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
|
@ -60,7 +60,7 @@ class FetchFeed:
|
|||
modified = None
|
||||
etag = None
|
||||
|
||||
USER_AGENT = 'NewsBlur Feed Fetcher (%s subscriber%s) - %s (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)' % (
|
||||
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)' % (
|
||||
self.feed.num_subscribers,
|
||||
's' if self.feed.num_subscribers != 1 else '',
|
||||
URL
|
||||
|
|
Loading…
Add table
Reference in a new issue