mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Forcing heights for friends and profiles. Resizing as necessary.
This commit is contained in:
parent
31d18752f2
commit
a98e8fadde
5 changed files with 26 additions and 26 deletions
|
@ -430,7 +430,7 @@
|
||||||
clear: both;
|
clear: both;
|
||||||
border-top: 1px solid #A0A0A0;
|
border-top: 1px solid #A0A0A0;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
max-height: 500px;
|
height: 400px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding-right: 12px;
|
padding-right: 12px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7558,6 +7558,7 @@ background: transparent;
|
||||||
.NB-profile-badge .NB-profile-badge-username {
|
.NB-profile-badge .NB-profile-badge-username {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
float: left;
|
float: left;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.NB-profile-badge.NB-profile-badge-embiggen .NB-profile-badge-username {
|
.NB-profile-badge.NB-profile-badge-embiggen .NB-profile-badge-username {
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
|
|
|
@ -14,10 +14,6 @@ NEWSBLUR.ReaderFriends.prototype = new NEWSBLUR.Modal;
|
||||||
_.extend(NEWSBLUR.ReaderFriends.prototype, {
|
_.extend(NEWSBLUR.ReaderFriends.prototype, {
|
||||||
|
|
||||||
runner: function() {
|
runner: function() {
|
||||||
this.options.onOpen = _.bind(function() {
|
|
||||||
this.resize_modal();
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
this.make_modal();
|
this.make_modal();
|
||||||
this.open_modal();
|
this.open_modal();
|
||||||
this.fetch_friends();
|
this.fetch_friends();
|
||||||
|
@ -226,22 +222,6 @@ _.extend(NEWSBLUR.ReaderFriends.prototype, {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
resize_modal: function(count) {
|
|
||||||
var $tab = $('.NB-tab.NB-active', this.$modal);
|
|
||||||
var $modal = this.$modal;
|
|
||||||
var $modal_container = $modal.closest('.simplemodal-container');
|
|
||||||
|
|
||||||
if (count > 50) return;
|
|
||||||
|
|
||||||
if ($modal.height() > $modal_container.height() - 24) {
|
|
||||||
$tab.height($tab.height() - 5);
|
|
||||||
this.resize_modal(count+1);
|
|
||||||
} else {
|
|
||||||
this.resize();
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
switch_tab: function(newtab) {
|
switch_tab: function(newtab) {
|
||||||
var $modal_tabs = $('.NB-modal-tab', this.$modal);
|
var $modal_tabs = $('.NB-modal-tab', this.$modal);
|
||||||
var $tabs = $('.NB-tab', this.$modal);
|
var $tabs = $('.NB-tab', this.$modal);
|
||||||
|
@ -257,7 +237,6 @@ _.extend(NEWSBLUR.ReaderFriends.prototype, {
|
||||||
} else if (newtab == 'followers') {
|
} else if (newtab == 'followers') {
|
||||||
this.make_followers_tab();
|
this.make_followers_tab();
|
||||||
}
|
}
|
||||||
_.defer(_.bind(this.resize_modal, this));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
connect: function(service) {
|
connect: function(service) {
|
||||||
|
@ -273,7 +252,6 @@ _.extend(NEWSBLUR.ReaderFriends.prototype, {
|
||||||
this.services = data.services;
|
this.services = data.services;
|
||||||
this.make_find_friends_and_services();
|
this.make_find_friends_and_services();
|
||||||
this.make_profile_section();
|
this.make_profile_section();
|
||||||
_.defer(_.bind(this.resize_modal, this));
|
|
||||||
}, this));
|
}, this));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -286,7 +264,6 @@ _.extend(NEWSBLUR.ReaderFriends.prototype, {
|
||||||
]).css('opacity', 0);
|
]).css('opacity', 0);
|
||||||
$('.NB-friends-services', this.$modal).append($error);
|
$('.NB-friends-services', this.$modal).append($error);
|
||||||
$error.animate({'opacity': 1}, {'duration': 1000});
|
$error.animate({'opacity': 1}, {'duration': 1000});
|
||||||
_.defer(_.bind(this.resize_modal, this));
|
|
||||||
} else {
|
} else {
|
||||||
this.fetch_friends();
|
this.fetch_friends();
|
||||||
}
|
}
|
||||||
|
@ -329,7 +306,6 @@ _.extend(NEWSBLUR.ReaderFriends.prototype, {
|
||||||
return new NEWSBLUR.Views.SocialProfileBadge({model: user});
|
return new NEWSBLUR.Views.SocialProfileBadge({model: user});
|
||||||
})));
|
})));
|
||||||
|
|
||||||
_.defer(_.bind(this.resize_modal, this));
|
|
||||||
}, this));
|
}, this));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,7 @@ _.extend(NEWSBLUR.ReaderSocialProfile.prototype, {
|
||||||
$('.NB-profile-follower-count', this.$modal).text(this.profile.get('follower_count'));
|
$('.NB-profile-follower-count', this.$modal).text(this.profile.get('follower_count'));
|
||||||
$('.NB-profile-following-count', this.$modal).text(this.profile.get('following_count'));
|
$('.NB-profile-following-count', this.$modal).text(this.profile.get('following_count'));
|
||||||
this.populate_friends(data);
|
this.populate_friends(data);
|
||||||
|
this.load_images_and_resize();
|
||||||
callback && callback();
|
callback && callback();
|
||||||
_.defer(_.bind(this.resize, this));
|
_.defer(_.bind(this.resize, this));
|
||||||
}, this));
|
}, this));
|
||||||
|
@ -101,6 +102,18 @@ _.extend(NEWSBLUR.ReaderSocialProfile.prototype, {
|
||||||
}, this));
|
}, this));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
load_images_and_resize: function() {
|
||||||
|
var $images = $('img', this.$modal);
|
||||||
|
var image_count = $images.length;
|
||||||
|
$images.load(_.bind(function() {
|
||||||
|
if (image_count > 1) {
|
||||||
|
image_count -= 1;
|
||||||
|
} else {
|
||||||
|
this.resize();
|
||||||
|
}
|
||||||
|
}, this));
|
||||||
|
},
|
||||||
|
|
||||||
make_profile_badges: function(user_ids, profiles) {
|
make_profile_badges: function(user_ids, profiles) {
|
||||||
var $badges = $.make('div', { className: 'NB-profile-links' }, _.map(user_ids, function(user_id) {
|
var $badges = $.make('div', { className: 'NB-profile-links' }, _.map(user_ids, function(user_id) {
|
||||||
var user = new NEWSBLUR.Models.User(profiles[user_id]);
|
var user = new NEWSBLUR.Models.User(profiles[user_id]);
|
||||||
|
|
|
@ -6,6 +6,7 @@ NEWSBLUR.Views.SocialProfileBadge = Backbone.View.extend({
|
||||||
"click .NB-profile-badge-action-follow": "follow_user",
|
"click .NB-profile-badge-action-follow": "follow_user",
|
||||||
"click .NB-profile-badge-action-unfollow": "unfollow_user",
|
"click .NB-profile-badge-action-unfollow": "unfollow_user",
|
||||||
"click .NB-profile-badge-action-preview": "preview_user",
|
"click .NB-profile-badge-action-preview": "preview_user",
|
||||||
|
"click .NB-profile-badge-username": "open_profile",
|
||||||
"mouseenter .NB-profile-badge-action-unfollow": "mouseenter_unfollow",
|
"mouseenter .NB-profile-badge-action-unfollow": "mouseenter_unfollow",
|
||||||
"mouseleave .NB-profile-badge-action-unfollow": "mouseleave_unfollow",
|
"mouseleave .NB-profile-badge-action-unfollow": "mouseleave_unfollow",
|
||||||
"mouseenter .NB-profile-badge-action-follow": "mouseenter_follow",
|
"mouseenter .NB-profile-badge-action-follow": "mouseenter_follow",
|
||||||
|
@ -37,7 +38,7 @@ NEWSBLUR.Views.SocialProfileBadge = Backbone.View.extend({
|
||||||
$.make('div', { className: 'NB-profile-badge-actions' }, [
|
$.make('div', { className: 'NB-profile-badge-actions' }, [
|
||||||
$.make('div', { className: 'NB-loading' })
|
$.make('div', { className: 'NB-loading' })
|
||||||
]),
|
]),
|
||||||
$.make('div', { className: 'NB-profile-badge-username' }, profile.get('username')),
|
$.make('div', { className: 'NB-profile-badge-username NB-splash-link' }, profile.get('username')),
|
||||||
$.make('div', { className: 'NB-profile-badge-location' }, profile.get('location')),
|
$.make('div', { className: 'NB-profile-badge-location' }, profile.get('location')),
|
||||||
(profile.get('website') && $.make('a', {
|
(profile.get('website') && $.make('a', {
|
||||||
href: profile.get('website'),
|
href: profile.get('website'),
|
||||||
|
@ -133,6 +134,15 @@ NEWSBLUR.Views.SocialProfileBadge = Backbone.View.extend({
|
||||||
}, this));
|
}, this));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
open_profile: function() {
|
||||||
|
var user_id = this.model.get('user_id');
|
||||||
|
NEWSBLUR.reader.model.add_user_profiles([this.model]);
|
||||||
|
|
||||||
|
$.modal.close(function() {
|
||||||
|
NEWSBLUR.reader.open_social_profile_modal(user_id);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
mouseenter_unfollow: function() {
|
mouseenter_unfollow: function() {
|
||||||
this.$('.NB-profile-badge-action-unfollow').text('Unfollow').addClass('NB-active');
|
this.$('.NB-profile-badge-action-unfollow').text('Unfollow').addClass('NB-active');
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue