mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Fixing issues around the feed floater.
This commit is contained in:
parent
df50ccf101
commit
a086cd83d4
5 changed files with 39 additions and 26 deletions
|
@ -1629,7 +1629,6 @@ background: transparent;
|
|||
z-index: 2;
|
||||
width: 100%;
|
||||
display: none;
|
||||
opacity: .9;
|
||||
}
|
||||
|
||||
.NB-view-river .NB-feed-story-view-floater {
|
||||
|
@ -1729,6 +1728,7 @@ background: transparent;
|
|||
border-bottom: 1px solid #000;
|
||||
border-top: 1px solid #707070;
|
||||
z-index: 2;
|
||||
opacity: .9;
|
||||
}
|
||||
#story_pane .NB-feed-story-header-feed.NB-feed-story-river-same-feed {
|
||||
z-index: 0;
|
||||
|
|
|
@ -949,7 +949,7 @@
|
|||
|
||||
if (!feed || (temp && !options.try_feed)) {
|
||||
// Setup tryfeed views first, then come back here.
|
||||
options.feed = options.feed.attributes;
|
||||
options.feed = options.feed && options.feed.attributes;
|
||||
return this.load_feed_in_tryfeed_view(feed_id, options);
|
||||
}
|
||||
|
||||
|
@ -998,7 +998,8 @@
|
|||
this.setup_mousemove_on_views();
|
||||
|
||||
if (!options.silent) {
|
||||
var slug = _.string.words(_.string.clean(feed.get('feed_title').replace(/[^a-z0-9\. ]/ig, ''))).join('-').toLowerCase();
|
||||
var feed_title = feed.get('feed_title') || '';
|
||||
var slug = _.string.words(_.string.clean(feed_title.replace(/[^a-z0-9\. ]/ig, ''))).join('-').toLowerCase();
|
||||
var url = "site/" + feed.id + "/" + slug;
|
||||
if (!_.string.include(window.location.pathname, url)) {
|
||||
// console.log(["Navigating to url", url]);
|
||||
|
@ -3965,7 +3966,7 @@
|
|||
feed_id : feed_id,
|
||||
feed_title : options.feed && options.feed.feed_title,
|
||||
temp : true
|
||||
}, options.feed.attributes);
|
||||
}, options.feed && options.feed.attributes);
|
||||
var $tryfeed_container = this.$s.$tryfeed_header.closest('.NB-feeds-header-container');
|
||||
|
||||
this.reset_feed();
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
NEWSBLUR.ReaderIntro = function(options) {
|
||||
var defaults = {};
|
||||
var intro_page = this.model.preference('intro_page');
|
||||
var intro_page = NEWSBLUR.assets.preference('intro_page');
|
||||
|
||||
_.bindAll(this, 'close', 'start_import_from_google_reader', 'post_connect');
|
||||
this.model = NEWSBLUR.assets;
|
||||
this.options = $.extend({
|
||||
'page_number': intro_page && _.isNumber(intro_page) && intro_page <= 4 ? intro_page : 1
|
||||
}, defaults, options);
|
||||
|
@ -168,8 +167,8 @@ _.extend(NEWSBLUR.ReaderIntro.prototype, {
|
|||
|
||||
fetch_friends: function(callback) {
|
||||
$('.NB-modal-loading', this.$modal).addClass('NB-active');
|
||||
this.model.fetch_friends(_.bind(function(data) {
|
||||
this.profile = this.model.user_profile;
|
||||
NEWSBLUR.assets.fetch_friends(_.bind(function(data) {
|
||||
this.profile = NEWSBLUR.assets.user_profile;
|
||||
this.services = data.services;
|
||||
this.autofollow = data.autofollow;
|
||||
this.make_find_friends_and_services();
|
||||
|
@ -240,7 +239,7 @@ _.extend(NEWSBLUR.ReaderIntro.prototype, {
|
|||
disconnect: function(service) {
|
||||
var $service = $('.NB-friends-service-'+service, this.$modal);
|
||||
$('.NB-friends-service-connect', $service).text('Disconnecting...');
|
||||
this.model.disconnect_social_service(service, _.bind(function(data) {
|
||||
NEWSBLUR.assets.disconnect_social_service(service, _.bind(function(data) {
|
||||
this.services = data.services;
|
||||
this.make_find_friends_and_services();
|
||||
this.make_profile_section();
|
||||
|
@ -261,7 +260,7 @@ _.extend(NEWSBLUR.ReaderIntro.prototype, {
|
|||
} else {
|
||||
this.fetch_friends();
|
||||
}
|
||||
this.model.preference('has_found_friends', true);
|
||||
NEWSBLUR.assets.preference('has_found_friends', true);
|
||||
NEWSBLUR.reader.check_hide_getting_started();
|
||||
},
|
||||
|
||||
|
@ -283,12 +282,12 @@ _.extend(NEWSBLUR.ReaderIntro.prototype, {
|
|||
}
|
||||
var page_count = $('.NB-page', this.$modal).length;
|
||||
this.page_number = page_number;
|
||||
this.model.preference('intro_page', page_number);
|
||||
NEWSBLUR.assets.preference('intro_page', page_number);
|
||||
|
||||
if (page_number == page_count) {
|
||||
$('.NB-tutorial-next-page-text', this.$modal).text('All Done ');
|
||||
} else if (page_number > page_count) {
|
||||
this.model.preference('has_setup_feeds', true);
|
||||
NEWSBLUR.assets.preference('has_setup_feeds', true);
|
||||
NEWSBLUR.reader.check_hide_getting_started();
|
||||
this.close(function() {
|
||||
NEWSBLUR.reader.open_dialog_after_feeds_loaded();
|
||||
|
@ -327,7 +326,7 @@ _.extend(NEWSBLUR.ReaderIntro.prototype, {
|
|||
var $carousel = $('.carousel', this.$modal);
|
||||
$carousel.carousel('pause');
|
||||
if (!_.isNumber(page)) {
|
||||
if (_.size(this.model.feeds) && !this.options.force_import) {
|
||||
if (NEWSBLUR.assets.feeds.size() && !this.options.force_import) {
|
||||
page = 2;
|
||||
$('.NB-intro-imports-sites', this.$modal).addClass('active');
|
||||
} else {
|
||||
|
@ -346,7 +345,7 @@ _.extend(NEWSBLUR.ReaderIntro.prototype, {
|
|||
},
|
||||
|
||||
count_feeds: function() {
|
||||
var feed_count = _.size(this.model.feeds);
|
||||
var feed_count = NEWSBLUR.assets.feeds.size();
|
||||
|
||||
$(".NB-intro-imports-sites h4", this.$modal).text([
|
||||
'You are subscribed to ',
|
||||
|
@ -355,7 +354,7 @@ _.extend(NEWSBLUR.ReaderIntro.prototype, {
|
|||
].join(""));
|
||||
|
||||
if (feed_count) {
|
||||
this.model.preference('has_setup_feeds', true);
|
||||
NEWSBLUR.assets.preference('has_setup_feeds', true);
|
||||
NEWSBLUR.reader.check_hide_getting_started();
|
||||
}
|
||||
},
|
||||
|
@ -415,7 +414,7 @@ _.extend(NEWSBLUR.ReaderIntro.prototype, {
|
|||
NEWSBLUR.reader.flags.importing_from_google_reader = false;
|
||||
this.advance_import_carousel(1);
|
||||
$loading.addClass('NB-active');
|
||||
this.model.start_import_from_google_reader($.rescope(this.finish_import_from_google_reader, this));
|
||||
NEWSBLUR.assets.start_import_from_google_reader($.rescope(this.finish_import_from_google_reader, this));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -491,14 +490,14 @@ _.extend(NEWSBLUR.ReaderIntro.prototype, {
|
|||
if ($input.is(':checked')) {
|
||||
$button.addClass('NB-active');
|
||||
if (this.services.twitter.twitter_uid) {
|
||||
this.model.follow_twitter_account(username);
|
||||
NEWSBLUR.assets.follow_twitter_account(username);
|
||||
} else {
|
||||
window.open('http://twitter.com/'+username, '_blank');
|
||||
}
|
||||
} else {
|
||||
$button.removeClass('NB-active');
|
||||
if (this.services.twitter.twitter_uid) {
|
||||
this.model.unfollow_twitter_account(username);
|
||||
NEWSBLUR.assets.unfollow_twitter_account(username);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -512,22 +511,22 @@ _.extend(NEWSBLUR.ReaderIntro.prototype, {
|
|||
if ($input.is(':checked')) {
|
||||
$button.addClass('NB-active');
|
||||
if (feed == 'blog') {
|
||||
this.model.save_add_url(blog_url, "", function() {
|
||||
NEWSBLUR.assets.save_add_url(blog_url, "", function() {
|
||||
NEWSBLUR.app.feed_list.fetch();
|
||||
}, {auto_active: false});
|
||||
} else if (feed == 'popular') {
|
||||
this.model.follow_user(popular_username, function() {
|
||||
NEWSBLUR.assets.follow_user(popular_username, function() {
|
||||
NEWSBLUR.reader.make_social_feeds();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$button.removeClass('NB-active');
|
||||
if (feed == 'blog') {
|
||||
this.model.delete_feed_by_url(blog_url, "", function() {
|
||||
NEWSBLUR.assets.delete_feed_by_url(blog_url, "", function() {
|
||||
NEWSBLUR.app.feed_list.fetch();
|
||||
});
|
||||
} else if (feed == 'popular') {
|
||||
this.model.unfollow_user(popular_username, function() {
|
||||
NEWSBLUR.assets.unfollow_user(popular_username, function() {
|
||||
NEWSBLUR.app.feed_list.make_social_feeds();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -30,8 +30,10 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
|||
// Binding directly instead of using event delegation. Need for speed.
|
||||
this.$el.bind('mouseenter', this.mouseenter);
|
||||
this.$el.bind('mouseleave', this.mouseleave);
|
||||
|
||||
this.model.story_view = this;
|
||||
|
||||
if (!this.options.feed_floater) {
|
||||
this.model.story_view = this;
|
||||
}
|
||||
},
|
||||
|
||||
// =============
|
||||
|
@ -178,6 +180,11 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
|||
}
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
this.model.unbind(null, null, this);
|
||||
this.remove();
|
||||
},
|
||||
|
||||
// ============
|
||||
// = Bindings =
|
||||
// ============
|
||||
|
|
|
@ -105,14 +105,20 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
|
|||
var $story = story.story_view.$el;
|
||||
$header = $('.NB-feed-story-header-feed', $story);
|
||||
var $new_header = $header.clone();
|
||||
|
||||
if (this.feed_title_floater) this.feed_title_floater.destroy();
|
||||
this.feed_title_floater = new NEWSBLUR.Views.StoryDetailView({
|
||||
feed_floater: true,
|
||||
model: story,
|
||||
el: $new_header
|
||||
});
|
||||
|
||||
$feed_floater.html($new_header);
|
||||
this.cache.feed_title_floater_feed_id = story.get('story_feed_id');
|
||||
var feed = NEWSBLUR.assets.get_feed(story.get('story_feed_id'));
|
||||
$feed_floater.toggleClass('NB-inverse', feed.is_light());
|
||||
$feed_floater.width($header.outerWidth());
|
||||
} else if (!story) {
|
||||
$feed_floater.empty();
|
||||
if (this.feed_title_floater) this.feed_title_floater.destroy();
|
||||
this.cache.feed_title_floater_feed_id = null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue