New feature: Insta-fetch stories. Refreshes a feed by fetching and parsing latest stories. Can be accessed from the right-click per-site-menu.

This commit is contained in:
Samuel Clay 2010-10-10 20:14:31 -04:00
parent 48d4e69d0d
commit 5d9660f5d8
4 changed files with 55 additions and 9 deletions

View file

@ -404,13 +404,17 @@ a img {
display: none;
}
#feed_list .feed.NB-feed-exception .NB-feed-exception-icon {
#feed_list .feed .NB-feed-exception-icon {
background: url('../img/icons/silk/exclamation.png') no-repeat 0 0;
width: 16px;
height: 16px;
position: absolute;
right: 4px;
top: 2px;
display: none;
}
#feed_list .feed.NB-feed-exception .NB-feed-exception-icon {
display: block;
}
#feed_list .feed.NB-feed-unfetched .feed_counts {
@ -422,7 +426,8 @@ a img {
#feed_list .feed.NB-feed-unfetched .feed_title {
color: #A0A0A0;
}
#feed_list .feed.NB-feed-unfetched .NB-feed-unfetched-icon {
#feed_list .feed .NB-feed-unfetched-icon {
background: url('../img/reader/recycle_spinner.gif') no-repeat 0 0;
opacity: .1;
width: 16px;
@ -430,6 +435,10 @@ a img {
position: absolute;
right: 4px;
top: 2px;
display: none;
}
#feed_list .feed.NB-feed-unfetched .NB-feed-unfetched-icon {
display: block;
}
.feed.NB-feed-sorting,
@ -2747,6 +2756,9 @@ background: transparent;
.NB-menu-manage .NB-menu-manage-feed-train .NB-menu-manage-image {
background: transparent url('../img/icons/silk/bricks.png') no-repeat 0 0;
}
.NB-menu-manage .NB-menu-manage-feed-reload .NB-menu-manage-image {
background: transparent url('../img/icons/silk/car.png') no-repeat 0 -1px;
}
.NB-menu-manage .NB-menu-manage-feed-stats .NB-menu-manage-image {
background: transparent url('../img/icons/silk/chart_curve.png') no-repeat 0 0;

View file

@ -168,7 +168,7 @@ NEWSBLUR.AssetModel.Reader.prototype = {
load_feed_precallback: function(data, feed_id, callback, first_load) {
// NEWSBLUR.log(['pre_callback', data]);
if (feed_id != this.feed_id && data) {
if ((feed_id != this.feed_id && data) || first_load) {
this.stories = data.stories;
this.feed_tags = data.feed_tags;
this.feed_authors = data.feed_authors;

View file

@ -60,6 +60,8 @@
// = Initialization =
// ==================
this.unload_iframe();
if (NEWSBLUR.Flags['start_import_from_google_reader']) {
this.start_import_from_google_reader();
} else {
@ -579,7 +581,7 @@
if (NEWSBLUR.Globals.is_authenticated) {
this.start_count_unreads_after_import();
this.force_feed_refresh($.rescope(this.finish_count_unreads_after_import, this));
this.force_feeds_refresh($.rescope(this.finish_count_unreads_after_import, this));
}
},
@ -677,8 +679,8 @@
$.make('span', { className: 'NB-feedbar-last-updated-date' }, feed.updated + ' ago')
])),
(type == 'story' && $.make('div', { className: 'NB-feedbar-mark-feed-read' }, 'Mark All as Read')),
(feed.has_exception && $.make('div', { className: 'NB-feed-exception-icon' })),
(feed.not_yet_fetched && $.make('div', { className: 'NB-feed-unfetched-icon' })),
$.make('div', { className: 'NB-feed-exception-icon' }),
$.make('div', { className: 'NB-feed-unfetched-icon' }),
(type == 'feed' && $.make('div', { className: 'NB-feedlist-manage-icon' }))
]).data('feed_id', feed.id);
@ -2233,6 +2235,21 @@
NEWSBLUR.statistics = new NEWSBLUR.ReaderStatistics(feed_id);
},
force_feed_refresh: function(feed_id) {
var self = this;
var $feed = this.find_feed_in_feed_list(feed_id);
$feed.addClass('NB-feed-unfetched').removeClass('NB-feed-exception');
this.model.save_exception_retry(feed_id, function() {
self.force_feeds_refresh(function() {
$feed.removeClass('NB-feed-unfetched');
if (self.active_feed == feed_id) {
self.open_feed(feed_id, null, true);
}
}, true);
});
},
make_manage_menu: function(type, feed_id, inverse, $item) {
var $manage_menu;
@ -2277,6 +2294,10 @@
$.make('div', { className: 'NB-menu-manage-image' }),
$.make('div', { className: 'NB-menu-manage-title' }, 'Statistics')
]),
$.make('li', { className: 'NB-menu-manage-feed NB-menu-manage-feed-reload' }, [
$.make('div', { className: 'NB-menu-manage-image' }),
$.make('div', { className: 'NB-menu-manage-title' }, 'Insta-fetch stories')
]),
$.make('li', { className: 'NB-menu-separator' }),
$.make('li', { className: 'NB-menu-manage-feed NB-menu-manage-feed-train' }, [
$.make('div', { className: 'NB-menu-manage-image' }),
@ -2701,7 +2722,7 @@
}, this.FEED_REFRESH_INTERVAL);
},
force_feed_refresh: function(callback, update_all) {
force_feeds_refresh: function(callback, update_all) {
if (callback) {
this.cache.refresh_callback = callback;
} else {
@ -3332,6 +3353,13 @@
self.open_feed_statistics_modal(feed_id);
}
});
$.targetIs(e, { tagSelector: '.NB-menu-manage-feed-reload' }, function($t, $p){
e.preventDefault();
if (!$t.hasClass('NB-disabled')) {
var feed_id = $t.parents('.NB-menu-manage').data('feed_id');
self.force_feed_refresh(feed_id);
}
});
$.targetIs(e, { tagSelector: '.NB-menu-manage-delete' }, function($t, $p){
e.preventDefault();
e.stopPropagation();

View file

@ -40,6 +40,12 @@ NEWSBLUR.ReaderStatistics.prototype = {
]),
$.make('div', { className: 'NB-modal-statistics-info' })
]);
var $stats = this.make_stats({
'last_update': '',
'next_update': ''
});
$('.NB-modal-statistics-info', this.$modal).replaceWith($stats);
},
initialize_feed: function(feed_id) {
@ -142,7 +148,7 @@ NEWSBLUR.ReaderStatistics.prototype = {
$.make('div', { className: 'NB-statistics-stat NB-statistics-updates'}, [
$.make('div', { className: 'NB-statistics-update'}, [
$.make('div', { className: 'NB-statistics-label' }, 'Last Update'),
$.make('div', { className: 'NB-statistics-count' }, data['last_update'] + ' ago')
$.make('div', { className: 'NB-statistics-count' }, ' ' + (data['last_update'] && (data['last_update'] + ' ago')))
]),
$.make('div', { className: 'NB-statistics-update'}, [
$.make('div', { className: 'NB-statistics-label' }, 'Every'),
@ -150,7 +156,7 @@ NEWSBLUR.ReaderStatistics.prototype = {
]),
$.make('div', { className: 'NB-statistics-update'}, [
$.make('div', { className: 'NB-statistics-label' }, 'Next Update'),
$.make('div', { className: 'NB-statistics-count' }, 'in ' + data['next_update'])
$.make('div', { className: 'NB-statistics-count' }, ' ' + (data['next_update'] && ('in ' + data['next_update'])))
])
]),
$.make('div', { className: 'NB-statistics-stat NB-statistics-history'}, [