fixing sharebar

This commit is contained in:
Roy Yang 2012-08-13 15:34:53 -07:00
parent a380ca28d4
commit 265eb3d698
7 changed files with 125 additions and 116 deletions

View file

@ -62,7 +62,6 @@
// make mutable copy
NSMutableDictionary *newActiveStory = [appDelegate.activeStory mutableCopy];
[newActiveStory setValue:[NSArray arrayWithArray:newFriendsComments] forKey:@"friend_comments"];
if (!foundComment) {
NSArray *publicComments = [appDelegate.activeStory objectForKey:@"public_comments"];
@ -77,7 +76,7 @@
}
}
[newActiveStory setValue:[NSArray arrayWithArray:publicComments] forKey:@"public_comments"];
[newActiveStory setValue:[NSArray arrayWithArray:newPublicComments] forKey:@"public_comments"];
} else {
[newActiveStory setValue:[NSArray arrayWithArray:newFriendsComments] forKey:@"friend_comments"];
}

View file

@ -167,7 +167,7 @@ static UIFont *indicatorFont = nil;
// feed bar
CGContextSetStrokeColor(context, CGColorGetComponents([self.feedColorBarTopBorder CGColor]));
CGContextSetStrokeColor(context, CGColorGetComponents([self.feedColorBar CGColor])); //feedColorBarTopBorder
if (self.isRead) {
CGContextSetAlpha(context, 0.25);
}

View file

@ -246,10 +246,16 @@
for (int i = 0; i < share_user_ids.count; i++) {
NSDictionary *user = [self getUser:[[share_user_ids objectAtIndex:i] intValue]];
NSString *avatarClass = @"NB-user-avatar";
if ([key isEqualToString:@"commented_by_public"] ||
[key isEqualToString:@"shared_by_public"]) {
avatarClass = @"NB-public-user NB-user-avatar";
}
NSString *avatar = [NSString stringWithFormat:@
"<div class=\"NB-story-share-profile\"><div class=\"NB-user-avatar\">"
"<div class=\"NB-story-share-profile\"><div class=\"%@\">"
"<a id=\"NB-user-share-bar-%@\" class=\"NB-show-profile\" href=\"http://ios.newsblur.com/show-profile/%@\"><img src=\"%@\" /></a>"
"</div></div>",
avatarClass,
[user objectForKey:@"user_id"],
[user objectForKey:@"user_id"],
[user objectForKey:@"photo_url"]];
@ -300,37 +306,33 @@
}
- (NSString *)getShareBar {
NSString *comments = @"";
NSString *comments = @"<div id=\"NB-share-bar-wrapper\">";
NSString *commentLabel = @"";
NSString *shareLabel = @"";
NSString *replyStr = @"";
// NSString *replyStr = @"";
if ([[appDelegate.activeStory objectForKey:@"reply_count"] intValue] == 1) {
replyStr = [NSString stringWithFormat:@" and <b>1 reply</b>"];
} else if ([[appDelegate.activeStory objectForKey:@"reply_count"] intValue] == 1) {
replyStr = [NSString stringWithFormat:@" and <b>%@ replies</b>", [appDelegate.activeStory objectForKey:@"reply_count"]];
}
// if ([[appDelegate.activeStory objectForKey:@"reply_count"] intValue] == 1) {
// replyStr = [NSString stringWithFormat:@" and <b>1 reply</b>"];
// } else if ([[appDelegate.activeStory objectForKey:@"reply_count"] intValue] == 1) {
// replyStr = [NSString stringWithFormat:@" and <b>%@ replies</b>", [appDelegate.activeStory objectForKey:@"reply_count"]];
// }
NSLog(@"[appDelegate.activeStory objectForKey:@'comment_count'] %@", [[appDelegate.activeStory objectForKey:@"comment_count"] class]);
if (![[appDelegate.activeStory objectForKey:@"comment_count"] isKindOfClass:[NSNull class]] &&
[[appDelegate.activeStory objectForKey:@"comment_count"] intValue]) {
commentLabel = [commentLabel stringByAppendingString:[NSString stringWithFormat:@
"<div class=\"NB-story-comments-label\">"
"%@" // comment count
"%@" // reply count
//"%@" // reply count
"</div>"
"<div class=\"NB-story-share-profiles NB-story-share-profiles-comments\">"
"<div class=\"NB-story-share-profiles-comments-friends\">"
"%@" // friend avatars
"</div>"
"<div class=\"NB-story-share-profiles-comments-public\">"
"%@" // public avatars
"</div>"
"</div>",
[[appDelegate.activeStory objectForKey:@"comment_count"] intValue] == 1
? [NSString stringWithFormat:@"<b>1 comment</b>"] :
[NSString stringWithFormat:@"<b>%@ comments</b>", [appDelegate.activeStory objectForKey:@"comment_count"]],
replyStr,
//replyStr,
[self getAvatars:@"commented_by_friends"],
[self getAvatars:@"commented_by_public"]]];
NSLog(@"commentLabel is %@", commentLabel);
@ -339,23 +341,21 @@
if (![[appDelegate.activeStory objectForKey:@"share_count"] isKindOfClass:[NSNull class]] &&
[[appDelegate.activeStory objectForKey:@"share_count"] intValue]) {
shareLabel = [shareLabel stringByAppendingString:[NSString stringWithFormat:@
"<div class=\"NB-right\"><div class=\"NB-story-share-label\">"
"<div class=\"NB-right\">"
"<div class=\"NB-story-share-profiles NB-story-share-profiles-shares\">"
"%@" // friend avatars
"%@" // public avatars
"</div>"
"<div class=\"NB-story-share-label\">"
"%@" // comment count
"</div>"
"<div class=\"NB-story-share-profiles NB-story-share-profiles-shares\">"
"<div class=\"NB-story-share-profiles-shares-friends\">"
"%@" // friend avatars
"</div>"
"<div class=\"NB-story-share-profiles-shares-public\">"
"%@" // public avatars
"</div>"
"</div></div>",
"</div>",
[self getAvatars:@"shared_by_public"],
[self getAvatars:@"shared_by_friends"],
[[appDelegate.activeStory objectForKey:@"share_count"] intValue] == 1
? [NSString stringWithFormat:@"<b>1 share</b>"] :
[NSString stringWithFormat:@"<b>%@ shares</b>", [appDelegate.activeStory objectForKey:@"share_count"]],
[self getAvatars:@"shared_by_friends"],
[self getAvatars:@"shared_by_public"]]];
[NSString stringWithFormat:@"<b>%@ shares</b>", [appDelegate.activeStory objectForKey:@"share_count"]]]];
NSLog(@"commentLabel is %@", commentLabel);
}
@ -368,7 +368,7 @@
"<div class=\"NB-story-comments-shares-teaser\">"
"%@"
"%@"
"</div></div></div>",
"</div></div></div></div>",
commentLabel,
shareLabel
]];
@ -378,7 +378,7 @@
comments = [comments stringByAppendingString:[NSString stringWithFormat:@"</div>"]];
}
comments = [comments stringByAppendingString:[NSString stringWithFormat:@"</div>"]];
return comments;
}
@ -464,13 +464,15 @@
" <div class=\"NB-story-comment-username\">%@</div>"
" %@" // location
" <div class=\"NB-story-comment-date\">%@ ago</div>"
" <div class=\"NB-button-wrapper\">"
" %@" //User Like Button>"
" %@" //User Edit Button>"
" <div class=\"NB-story-comment-reply-button NB-button\">"
" <a href=\"http://ios.newsblur.com/reply/%@/%@\"><div class=\"NB-story-comment-reply-button-wrapper\">"
" Reply"
" </div></a>"
" </div>"
" %@" //User Edit Button>"
" %@" //User Like Button>"
" </div>"
"</div>"
"<div class=\"NB-story-comment-content\">%@</div>"
"%@"
@ -483,10 +485,10 @@
[user objectForKey:@"username"],
locationHtml,
[commentDict objectForKey:@"shared_date"],
[commentDict objectForKey:@"user_id"],
[user objectForKey:@"username"],
userEditButton,
userLikeButton,
[commentDict objectForKey:@"user_id"],
[user objectForKey:@"username"],
commentContent,
[self getReplies:[commentDict objectForKey:@"replies"] forUserId:[commentDict objectForKey:@"user_id"]]];
} else {
@ -570,25 +572,31 @@
locationHtml = [NSString stringWithFormat:@"<div class=\"NB-story-comment-location\">%@</div>", location];
}
NSString *reply = [NSString stringWithFormat:@
"<div class=\"NB-story-comment-reply\" id=\"NB-user-comment-%@\">"
" <a class=\"NB-show-profile\" href=\"http://ios.newsblur.com/show-profile/%@\">"
" <img class=\"NB-story-comment-reply-photo\" src=\"%@\" />"
" </a>"
" <div class=\"NB-story-comment-username NB-story-comment-reply-username\">%@</div>"
" %@"
" <div class=\"NB-story-comment-date NB-story-comment-reply-date\">%@ ago</div>"
" %@" //User Edit Button>"
" <div class=\"NB-story-comment-reply-content\">%@</div>"
"</div>",
[replyDict objectForKey:@"reply_id"],
[user objectForKey:@"user_id"],
[user objectForKey:@"photo_url"],
[user objectForKey:@"username"],
locationHtml,
[replyDict objectForKey:@"publish_date"],
userEditButton,
replyContent];
NSString *reply;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
reply = [NSString stringWithFormat:@
"<div class=\"NB-story-comment-reply\" id=\"NB-user-comment-%@\">"
" <a class=\"NB-show-profile\" href=\"http://ios.newsblur.com/show-profile/%@\">"
" <img class=\"NB-story-comment-reply-photo\" src=\"%@\" />"
" </a>"
" <div class=\"NB-story-comment-username NB-story-comment-reply-username\">%@</div>"
" %@"
" <div class=\"NB-story-comment-date NB-story-comment-reply-date\">%@ ago</div>"
" %@" //User Edit Button>"
" <div class=\"NB-story-comment-reply-content\">%@</div>"
"</div>",
[replyDict objectForKey:@"reply_id"],
[user objectForKey:@"user_id"],
[user objectForKey:@"photo_url"],
[user objectForKey:@"username"],
locationHtml,
[replyDict objectForKey:@"publish_date"],
userEditButton,
replyContent];
} else {
}
repliesString = [repliesString stringByAppendingString:reply];
}
repliesString = [repliesString stringByAppendingString:@"</div>"];
@ -678,7 +686,7 @@
"<div class='NB-share-wrapper'><div class='NB-share-inner-wrapper'>"
"<div id=\"NB-share-button-id\" class='NB-share-button NB-button'>"
"<a href=\"http://ios.newsblur.com/share\"><div>"
"<span class=\"NB-share-icon\"></span>Post to Blurblog"
"Post to Blurblog <span class=\"NB-share-icon\"></span>"
"</div></a>"
"</div>"
"</div></div>"];
@ -1256,10 +1264,14 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
}
- (void)refreshComments:(NSString *)replyId {
NSString *shareBarString = [self getShareBar];
NSString *commentString = [self getComments];
NSString *jsString = [[NSString alloc] initWithFormat:@
"document.getElementById('NB-comments-wrapper').innerHTML = '%@';",
commentString];
"document.getElementById('NB-comments-wrapper').innerHTML = '%@';"
"document.getElementById('NB-share-bar-wrapper').innerHTML = '%@';",
commentString,
shareBarString];
NSString *shareType = appDelegate.activeShareType;
[self.webView stringByEvaluatingJavaScriptFromString:jsString];

View file

@ -12,11 +12,11 @@
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
// #define BACKGROUND_REFRESH_SECONDS -5
#define BACKGROUND_REFRESH_SECONDS -10*60
#define BACKGROUND_REFRESH_SECONDS -5
// #define BACKGROUND_REFRESH_SECONDS -10*60
// #define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.com"]
#define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
#define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.com"]
// #define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
#define NEWSBLUR_LINK_COLOR 0x405BA8
#define NEWSBLUR_HIGHLIGHT_COLOR 0xd2e6fd

View file

@ -13,31 +13,13 @@
box-shadow: inset 1px 1px 1px rgba(255, 255, 255, 1);shar
}
#story_pane .NB-story-comment .NB-story-comment-location {
text-transform: uppercase;
font-size: 10px;
color: #B7B58D;
font-weight: bold;
.NB-story-share-profiles-comments-friends,
.NB-story-share-profiles-comments-public {
float: left;
margin-right: 8px;
padding: 0px 6px;
background-color: #EFEFEF;
border-radius: 8px;
line-height: 17px;
}
.NB-story-comments-label {
float: left;
margin-right: 12px;
}
.NB-story-share-label {
float: right;
margin-left: 12px;
}
.NB-story-share-profiles .NB-story-share-profiles-shares-friends, .NB-story-share-profiles .NB-story-share-profiles-shares-public {
.NB-story-share-profiles-shares-friends,
.NB-story-share-profiles-shares-public {
float: right;
}
@ -62,7 +44,7 @@
width: 32px;
}
#story_pane .NB-story-comment .NB-story-comment-author-container {
margin: 10px 0 0;
margin: 4px 0 0;
}
#story_pane .NB-story-comment .NB-story-comment-reshares {
position: absolute;
@ -79,7 +61,7 @@
font-size: 11px;
color: #1D4BA6;
font-weight: bold;
margin: 0 10px 0 0;
margin: 4px 10px 0 0;
text-shadow: 0 -1px 0 #F0F0F0;
cursor: pointer;
line-height: 17px;
@ -91,7 +73,22 @@
font-weight: bold;
float: left;
line-height: 17px;
margin-top: 4px;
}
#story_pane .NB-story-comment .NB-story-comment-location {
text-transform: uppercase;
font-size: 10px;
color: #B7B58D;
font-weight: bold;
float: left;
margin-right: 8px;
margin: 4px 10px 0 0;
background-color: #EFEFEF;
border-radius: 8px;
line-height: 17px;
}
#story_pane .NB-story-comment .NB-story-comment-content {
float: left;
color: #303030;
@ -165,10 +162,6 @@
padding-top: 0;
}
#story_pane .nb-story-comments-shares-teaser .NB-right {
margin-top: 2px;
}
#story_pane .NB-story-comments-public-teaser,
#story_pane .NB-story-comments-public-header {
background-color: #B1B6B4;
@ -197,9 +190,9 @@
font-weight: bold;
text-transform: uppercase;
font-size: 10px;
padding: 8px 12px 0;
padding: 4px 12px 0;
overflow: hidden;
height: 26px;
min-height: 26px;
border-bottom: 1px solid #A6A6A6;
background-image: whiteSmoke;
}
@ -214,18 +207,16 @@
padding: 0 1px;
font-size: 12px;
}
#story_pane .NB-story-share-label {
display: inline-block;
margin: 2px 4px 0 0;
}
#story_pane .NB-story-share-profiles {
display: inline-block;
float: left;
vertical-align: top;
height: 24px;
min-height: 24px;
padding-top: 2px;
margin-top: -4px;
margin-top: 0px;
overflow: hidden;
}
#story_pane .NB-story-share-profiles.NB-story-share-profiles-public {
float: right;
}
@ -236,15 +227,21 @@
#story_pane .NB-story-share-profile {
display: inline-block;
}
#story_pane .NB-story-share-profile .NB-user-avatar {
float: left;
font-size: 0;
vertical-align: middle;
height: 22px;
width: 22px;
margin: 0 4px 0 0;
margin: 0 4px 4px 0;
cursor: pointer;
}
#story_pane .NB-story-share-profile .NB-public-user {
opacity: 0.5;
}
#story_pane .NB-story-share-profile .NB-user-avatar img {
width: 22px;
height: 22px;
@ -254,7 +251,7 @@
float: left;
}
#story_pane .NB-story-comment .NB-story-comment-content {
clear: both;
clear: left;
padding: 0 0 8px 0;
}
#story_pane .NB-feed-story-endbar {

File diff suppressed because one or more lines are too long

View file

@ -372,15 +372,15 @@ del {
float: none;
}
.NB-iphone#story_pane .nb-story-share-label {
.nb-story-comments-label {
float: left;
display: block;
margin: 2px 4px 0 0;
margin-right: 5px;
margin-top: 6px;
}
.NB-iphone .NB-story-share-profile {
margin-top: -2px;
margin-bottom: 10px;
.nb-story-share-label {
float: right;
margin-top: 6px;
}
/* Sharing */
@ -417,9 +417,13 @@ a.NB-show-profile {
/* Edit, Like, and Reply buttons */
.NB-button {
padding: 0px 0px 4px 10px;
.NB-button-wrapper {
float: right;
}
.NB-button {
padding: 0px 0px 4px 4px;
display: inline-block;
cursor: pointer;
margin-top: -5px;
margin-bottom: -4px;
@ -435,6 +439,7 @@ a.NB-show-profile {
float: none;
padding: 0px 0px 20px 0px;
margin-bottom: 0;
display: block;
}
.NB-button div {
@ -468,12 +473,12 @@ a.NB-show-profile {
}
.NB-button.NB-share-button div span {
background: url("data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACGUlEQVR42o2TTUsbYRSFZ+MvcNn/0EU1rSCCgkSxVRCLFgyiqFSE1tDSpNKoEaQJiAvBryDZGCVQKWIpWIeAFMHWL1qKjUJ3KRQSNUgSJzPR5PieMRMqjuLibAaec+577xkJwJ30p0jqEloXiglpQlmh3F3AaaEogWhnMw6dPTgafIljtx3i262gTSgSKbuPQ8dzxEfsSEw6kHBV4NRThrOVAaSd0o2wX0iJdj9D3PMaJ/1WKF4LtMlHyExf6jw0CO2dZAovCmWOBl4gMeFAyv0AmTyoLVRCXa1H+nsLtMgUktslpsmZ46E+JGedUMcsl2CwCumvTVD22qAcdOjS/vmQ3LVce7PCZMLa+EMdVj/XQflp06G/ezZ8/NYAV6gKUz+GcM8vXTGI8M0c20hW5QYo4XacCnhxox5dK+Wo+1SKmuUSeHdcKJ6VrpwqF3//Cqnh0kIy4djvNoyuVeNJHmwNONDrCyIg/8LjN0sFgyhPlfK/5cL4Zo7NZB2uFWDjh6fonQliXg5jQd7H3JcwDQoNy/LOPBXT9YXlx2YyYXcgpIPe+S10emTCqtAmDdbZMJaEd+apuG0ujG/m2EwmbB9fM0CrsTsaxFhPNozpvDPTuW0ujG/m2EwmbID/G2jsNutJA5aEBjyVnu7T042xrWYGWf4Y7DbryYaxJLwzT8Vtc2FGuplBTog/BrvNerJhLAnvTNDQppnBBZHZrv4ITeFuAAAAAElFTkSuQmCC") no-repeat 0 0px;
background: url("data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACGUlEQVR42o2TTUsbYRSFZ+MvcNn/0EU1rSCCgkSxVRCLFgyiqFSE1tDSpNKoEaQJiAvBryDZGCVQKWIpWIeAFMHWL1qKjUJ3KRQSNUgSJzPR5PieMRMqjuLibAaec+577xkJwJ30p0jqEloXiglpQlmh3F3AaaEogWhnMw6dPTgafIljtx3i262gTSgSKbuPQ8dzxEfsSEw6kHBV4NRThrOVAaSd0o2wX0iJdj9D3PMaJ/1WKF4LtMlHyExf6jw0CO2dZAovCmWOBl4gMeFAyv0AmTyoLVRCXa1H+nsLtMgUktslpsmZ46E+JGedUMcsl2CwCumvTVD22qAcdOjS/vmQ3LVce7PCZMLa+EMdVj/XQflp06G/ezZ8/NYAV6gKUz+GcM8vXTGI8M0c20hW5QYo4XacCnhxox5dK+Wo+1SKmuUSeHdcKJ6VrpwqF3//Cqnh0kIy4djvNoyuVeNJHmwNONDrCyIg/8LjN0sFgyhPlfK/5cL4Zo7NZB2uFWDjh6fonQliXg5jQd7H3JcwDQoNy/LOPBXT9YXlx2YyYXcgpIPe+S10emTCqtAmDdbZMJaEd+apuG0ujG/m2EwmbB9fM0CrsTsaxFhPNozpvDPTuW0ujG/m2EwmbID/G2jsNutJA5aEBjyVnu7T042xrWYGWf4Y7DbryYaxJLwzT8Vtc2FGuplBTog/BrvNerJhLAnvTNDQppnBBZHZrv4ITeFuAAAAAElFTkSuQmCC") no-repeat top right;
width: 23px;
display: inline-block;
height: 16px;
margin-bottom: -2px;
margin-left: -23px;
margin-right: -23px;
}
.NB-iphone .NB-button .NB-story-comment-like-button-wrapper,