git add scrolling to comment when you share

This commit is contained in:
Roy Yang 2012-07-30 14:58:57 -07:00
parent 27544b3bd3
commit ae1d713f46
12 changed files with 141 additions and 69 deletions

View file

@ -664,7 +664,7 @@
} completion:^(BOOL finished) {
if ([notification.name isEqualToString:@"UIKeyboardWillShowNotification"]) {
self.storyNavigationController.view.frame = storyNavigationFrame;
// [self.storyDetailViewController scrolltoBottom];
[self.storyDetailViewController scrolltoComment];
} else {
// remove the shareViewController after keyboard slides down
if (self.isHidingStory) {

View file

@ -207,9 +207,8 @@
- (void)hideStoryDetailView;
- (void)changeActiveFeedDetailRow;
- (void)dragFeedDetailView:(float)y;
- (void)showShareView:(NSString *)type setUserId:(NSString *)userId setUsername:(NSString *)username setCommentIndex:(NSString *)commentIndex;
- (void)showShareView:(NSString *)type setUserId:(NSString *)userId setUsername:(NSString *)username setReplyId:(NSString *)commentIndex;
- (void)hideShareView:(BOOL)resetComment;
- (void)refreshComments;
- (void)resetShareComments;
- (BOOL)isSocialFeed:(NSString *)feedIdStr;
- (BOOL)isPortrait;

View file

@ -253,14 +253,14 @@
- (void)showShareView:(NSString *)type
setUserId:(NSString *)userId
setUsername:(NSString *)username
setCommentIndex:(NSString *)commentIndex {
setReplyId:(NSString *)replyId {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[self.masterContainerViewController transitionToShareView];
[self.shareViewController setSiteInfo:type setUserId:userId setUsername:username setCommentIndex:commentIndex];
[self.shareViewController setSiteInfo:type setUserId:userId setUsername:username setReplyId:replyId];
} else {
[self.navigationController presentModalViewController:self.shareViewController animated:YES];
[self.shareViewController setSiteInfo:type setUserId:userId setUsername:username setCommentIndex:commentIndex];
[self.shareViewController setSiteInfo:type setUserId:userId setUsername:username setReplyId:replyId];
}
}
@ -277,10 +277,6 @@
}
}
- (void)refreshComments {
[storyDetailViewController refreshComments];
}
- (void)resetShareComments {
[shareViewController clearComments];
}

View file

@ -11,18 +11,18 @@
@interface ShareViewController : UIViewController <ASIHTTPRequestDelegate, UITextViewDelegate> {
NewsBlurAppDelegate *appDelegate;
int activeCommentIndex;
NSString *activeReplyId;
}
@property ( nonatomic) IBOutlet UITextView *commentField;
@property (nonatomic) IBOutlet UITextView *commentField;
@property (nonatomic) IBOutlet NewsBlurAppDelegate *appDelegate;
@property ( nonatomic) IBOutlet UIButton *facebookButton;
@property ( nonatomic) IBOutlet UIButton *twitterButton;
@property ( nonatomic) IBOutlet UIBarButtonItem *submitButton;
@property ( nonatomic) IBOutlet UIBarButtonItem *toolbarTitle;
@property (nonatomic) int activeCommentIndex;
@property (nonatomic) IBOutlet UIButton *facebookButton;
@property (nonatomic) IBOutlet UIButton *twitterButton;
@property (nonatomic) IBOutlet UIBarButtonItem *submitButton;
@property (nonatomic) IBOutlet UIBarButtonItem *toolbarTitle;
@property (nonatomic) NSString * activeReplyId;
- (void)setSiteInfo:(NSString *)type setUserId:(NSString *)userId setUsername:(NSString *)username setCommentIndex:(NSString *)commentIndex;
- (void)setSiteInfo:(NSString *)type setUserId:(NSString *)userId setUsername:(NSString *)username setReplyId:(NSString *)commentIndex;
- (void)clearComments;
- (IBAction)doCancelButton:(id)sender;
- (IBAction)doToggleButton:(id)sender;
@ -31,6 +31,7 @@
- (void)finishShareThisStory:(ASIHTTPRequest *)request;
- (void)finishAddReply:(ASIHTTPRequest *)request;
- (void)requestFailed:(ASIHTTPRequest *)request;- (void)replaceStory:(NSDictionary *)newStory;
- (void)replaceStory:(NSDictionary *)newStory withReplyId:(NSString *)replyId;
- (NSString *)stringByStrippingHTML:(NSString *)s;
@end

View file

@ -22,7 +22,7 @@
@synthesize toolbarTitle;
@synthesize commentField;
@synthesize appDelegate;
@synthesize activeCommentIndex;
@synthesize activeReplyId;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
@ -99,21 +99,32 @@
[userPreferences synchronize];
}
- (void)setSiteInfo:(NSString *)type setUserId:(NSString *)userId setUsername:(NSString *)username setCommentIndex:(NSString *)commentIndex {
- (void)setSiteInfo:(NSString *)type setUserId:(NSString *)userId setUsername:(NSString *)username setReplyId:(NSString *)replyId {
if ([type isEqualToString: @"edit-reply"]) {
[submitButton setTitle:@"Save"];
facebookButton.hidden = YES;
twitterButton.hidden = YES;
[toolbarTitle setTitle:[NSString stringWithFormat:@"Edit Your Reply"]];
[submitButton setAction:(@selector(doReplyToComment:))];
self.activeCommentIndex = [commentIndex intValue];
self.activeReplyId = replyId;
// get old comment
// get existing reply
NSArray *replies = [appDelegate.activeComment objectForKey:@"replies"];
int commentIdx = [commentIndex intValue];
self.commentField.text = [self stringByStrippingHTML:[[replies objectAtIndex:commentIdx] objectForKey:@"comments"]];
NSDictionary *reply = nil;
for (int i = 0; i < replies.count; i++) {
NSString *replyId = [NSString stringWithFormat:@"%@", [[replies objectAtIndex:i] valueForKey:@"reply_id"]];
NSLog(@"[replies objectAtIndex:i] valueForKey:@reply_id] %@", [[replies objectAtIndex:i] valueForKey:@"reply_id"]);
NSLog(@":self.activeReplyId %@", self.activeReplyId);
if ([replyId isEqualToString:self.activeReplyId]) {
reply = [replies objectAtIndex:i];
}
}
if (reply) {
self.commentField.text = [self stringByStrippingHTML:[reply objectForKey:@"comments"]];
}
} else if ([type isEqualToString: @"reply"]) {
self.activeCommentIndex = -1;
self.activeReplyId = nil;
[submitButton setTitle:@"Reply"];
facebookButton.hidden = YES;
twitterButton.hidden = YES;
@ -197,7 +208,7 @@
options:kNilOptions
error:&error];
[self replaceStory:[results objectForKey:@"story"]];
[self replaceStory:[results objectForKey:@"story"] withReplyId:nil];
}
# pragma mark
@ -210,7 +221,7 @@
return;
}
NSLog(@"REPLY TO COMMENT, %@", appDelegate.activeComment);
// NSLog(@"REPLY TO COMMENT, %@", appDelegate.activeComment);
NSString *urlString = [NSString stringWithFormat:@"http://%@/social/save_comment_reply",
NEWSBLUR_URL];
@ -224,9 +235,8 @@
[request setPostValue:[appDelegate.activeComment objectForKey:@"user_id"] forKey:@"comment_user_id"];
[request setPostValue:commentField.text forKey:@"reply_comments"];
if (self.activeCommentIndex != -1) {
NSDictionary *activeComment = [[appDelegate.activeComment objectForKey:@"replies"] objectAtIndex:self.activeCommentIndex];
[request setPostValue:[self stringByStrippingHTML:[activeComment objectForKey:@"comments"]] forKey:@"original_message"];
if (self.activeReplyId) {
[request setPostValue:activeReplyId forKey:@"reply_id"];
}
[request setDelegate:self];
@ -249,7 +259,7 @@
error:&error];
// add the comment into the activeStory dictionary
NSDictionary *newStory = [DataUtilities updateComment:results for:appDelegate];
[self replaceStory:newStory];
[self replaceStory:newStory withReplyId:[results objectForKey:@"reply_id"]];
}
- (void)requestFailed:(ASIHTTPRequest *)request
@ -258,7 +268,7 @@
NSLog(@"Error: %@", error);
}
- (void)replaceStory:(NSDictionary *)newStory {
- (void)replaceStory:(NSDictionary *)newStory withReplyId:(NSString *)replyId {
// update the current story and the activeFeedStories
appDelegate.activeStory = newStory;
@ -278,7 +288,7 @@
appDelegate.activeFeedStories = [NSArray arrayWithArray:newActiveFeedStories];
self.commentField.text = nil;
[appDelegate.storyDetailViewController refreshComments];
[appDelegate.storyDetailViewController refreshComments:replyId];
}

View file

@ -54,7 +54,7 @@
- (void)markStoryAsRead;
- (void)toggleLikeComment:(BOOL)likeComment;
- (void)showStory;
- (void)scrolltoBottom;
- (void)scrolltoComment;
- (IBAction)showOriginalSubview:(id)sender;
- (IBAction)doNextUnreadStory;
- (IBAction)doNextStory;
@ -65,7 +65,7 @@
- (void)initStory;
- (void)showShareHUD;
- (void)refreshComments;
- (void)refreshComments:(NSString *)replyId;
- (void)finishMarkAsRead:(ASIHTTPRequest *)request;
- (void)finishLikeComment:(ASIHTTPRequest *)request;
- (void)requestFailed:(ASIHTTPRequest *)request;

View file

@ -443,18 +443,19 @@
NSString *userEditButton = @"";
NSString *replyUserId = [NSString stringWithFormat:@"%@", [replyDict objectForKey:@"user_id"]];
NSString *replyId = [replyDict objectForKey:@"reply_id"];
NSString *currentUserId = [NSString stringWithFormat:@"%@", [appDelegate.dictUserProfile objectForKey:@"user_id"]];
if ([replyUserId isEqualToString:currentUserId]) {
userEditButton = [NSString stringWithFormat:@
"<div class=\"NB-story-comment-edit-button NB-story-comment-share-edit-button NB-button\">"
"<div class=\"NB-story-comment-edit-button-wrapper\">"
"<a href=\"http://ios.newsblur.com/edit-reply/%@/%@/%i\">edit</a>"
"<a href=\"http://ios.newsblur.com/edit-reply/%@/%@/%@\">edit</a>"
"</div>"
"</div>",
commentUserId,
replyUserId,
i // comment number in array
replyId
];
}
@ -557,7 +558,7 @@
sharingHtmlString = [NSString stringWithFormat:@
"<div class='NB-share-header'></div>"
"<div class='NB-share-wrapper'><div class='NB-share-inner-wrapper'>"
"<div class='NB-share-button NB-button'><div>"
"<div id=\"NB-share-button-id\" class='NB-share-button NB-button'><div>"
"<a href=\"http://ios.newsblur.com/share\">Post to Blurblog</a>"
"</div></div>"
"</div></div>"];
@ -623,7 +624,7 @@
footerString
];
NSLog(@"\n\n\n\nhtmlString:\n\n\n%@\n\n\n", htmlString);
// NSLog(@"\n\n\n\nhtmlString:\n\n\n%@\n\n\n", htmlString);
NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
@ -749,17 +750,17 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
[appDelegate showShareView:@"reply"
setUserId:[NSString stringWithFormat:@"%@", [urlComponents objectAtIndex:2]]
setUsername:[NSString stringWithFormat:@"%@", [urlComponents objectAtIndex:3]]
setCommentIndex:nil];
setReplyId:nil];
} else if ([action isEqualToString:@"edit-reply"]) {
[appDelegate showShareView:@"edit-reply"
setUserId:[NSString stringWithFormat:@"%@", [urlComponents objectAtIndex:2]]
setUsername:nil
setCommentIndex:[NSString stringWithFormat:@"%@", [urlComponents objectAtIndex:4]]];
setReplyId:[NSString stringWithFormat:@"%@", [urlComponents objectAtIndex:4]]];
} else if ([action isEqualToString:@"edit-share"]) {
[appDelegate showShareView:@"edit-share"
setUserId:nil
setUsername:nil
setCommentIndex:nil];
setReplyId:nil];
} else if ([action isEqualToString:@"like-comment"]) {
[self toggleLikeComment:YES];
} else if ([action isEqualToString:@"unlike-comment"]) {
@ -783,12 +784,12 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
[appDelegate showShareView:@"share"
setUserId:nil
setUsername:nil
setCommentIndex:nil];
setReplyId:nil];
} else {
[appDelegate showShareView:@"edit-share"
setUserId:nil
setUsername:nil
setCommentIndex:nil];
setReplyId:nil];
}
return NO;
} else if ([action isEqualToString:@"show-profile"]) {
@ -1023,7 +1024,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
appDelegate.activeFeedStories = [NSArray arrayWithArray:newActiveFeedStories];
[self refreshComments];
[self refreshComments:@"like"];
}
@ -1045,16 +1046,24 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
self.storyHUD.margin = 20.0f;
}
- (void)refreshComments {
- (void)refreshComments:(NSString *)replyId {
NSString *commentString = [self getComments:@"friends"];
NSString *jsString = [[NSString alloc] initWithFormat:@
"document.getElementById('NB-comments-wrapper').innerHTML = '%@';",
commentString];
NSString *shareType = appDelegate.activeShareType;
// NSLog(@"JSSTRING IS %@\n\n\n", jsString);
[self.webView stringByEvaluatingJavaScriptFromString:jsString];
if (!replyId) {
NSString *currentUserId = [NSString stringWithFormat:@"%@", [appDelegate.dictUserProfile objectForKey:@"user_id"]];
NSString *jsFlashString = [[NSString alloc] initWithFormat:@"slideToComment('%@', true);", currentUserId];
[self.webView stringByEvaluatingJavaScriptFromString:jsFlashString];
} else if ([replyId isEqualToString:@"like"]) {
}
// // adding in a simulated delay
// sleep(4);
@ -1078,9 +1087,10 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
[self.storyHUD hide:YES afterDelay:1];
}
- (void)scrolltoBottom {
CGPoint bottomOffset = CGPointMake(0, self.webView.scrollView.contentSize.height - self.webView.bounds.size.height);
[self.webView.scrollView setContentOffset:bottomOffset animated:YES];
- (void)scrolltoComment {
NSString *currentUserId = [NSString stringWithFormat:@"%@", [appDelegate.dictUserProfile objectForKey:@"user_id"]];
NSString *jsFlashString = [[NSString alloc] initWithFormat:@"slideToComment('%@');", currentUserId];
[self.webView stringByEvaluatingJavaScriptFromString:jsFlashString];
}
- (IBAction)doNextUnreadStory {

View file

@ -16,7 +16,7 @@
#define BACKGROUND_REFRESH_SECONDS -10*60
#define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.host"]
// #define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
// #define NEWSBLUR_URL [NSStrigit ng stringWithFormat:@"www.newsblur.com"]
#define NEWSBLUR_ORANGE 0xAE5D15

View file

@ -1,3 +1,3 @@
<html><head><link rel="stylesheet" type="text/css" href="reader.css" ><link rel="stylesheet" type="text/css" href="storyDetailView.css" ><meta name="viewport" id="viewport" content="width=320, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/></head><body id="story_pane" class="NB-iphone"> <div class="NB-header"><div class="NB-header-inner"><div class="NB-story-date">Friday, July 27th, 2012 11:12am</div><div class="NB-story-title">Robert Buelteman ran 80,000 volts of electricity through various...</div><div class="NB-story-author"></div><div class="NB-story-tags"><div class="NB-story-tag">photography</div></div></div></div> <div class="NB-san-serif" id="NB-font-style"> <div class="NB-medium" id="NB-font-size"> <div class="NB-story"><img src="http://25.media.tumblr.com/tumblr_m7okupxEFS1qz7ymyo1_500.jpg" /><br /> <br /><img src="http://24.media.tumblr.com/tumblr_m7okupxEFS1qz7ymyo2_500.jpg" /><br /> <br /><img src="http://24.media.tumblr.com/tumblr_m7okupxEFS1qz7ymyo3_500.jpg" /><br /> <br /><p><a href="http://www.buelteman.com/home.html" target="_hplink">Robert Buelteman</a> ran 80,000 volts of electricity through various plants, creating these awesome photos! With so much energy passing through the plant, the air surrounding it ionizes, leaving a peculiar blue haze. </p>
<p><strong><a href="http://www.huffingtonpost.com/2012/07/23/artist-robert-buelteman_n_1694747.html?utm_hp_ref=arts#slide=1261762">Robert Buelteman Shocks Flowers With 80,000 Volts</a></strong></p>
<p><small><em>via <a href="http://www.reddit.com/r/photography/comments/x1591/photographer_robert_buelteman_shocks_flowers_with/">Reddit</a></em></small></p><img height="1" src="http://feeds.feedburner.com/~r/PhotojojoTumblr/~4/1tdBEmRG7WM" width="1" /></div> </div> </div> <div class='NB-share-header'></div><div class='NB-share-wrapper'><div class='NB-share-inner-wrapper'><div class='NB-share-button NB-button'><div><a href="http://ios.newsblur.com/share">Post to Blurblog</a></div></div></div></div> <div id="NB-comments-wrapper"> <div class="NB-feed-story-comments"><div class="NB-story-comments-shares-teaser-wrapper"><div class="NB-story-comments-shares-teaser"><div class="NB-right">Shared by 2 people</div><div class="NB-story-share-profiles NB-story-share-profiles-public"></div><div class="NB-story-share-label">Shared by: </div><div class="NB-story-share-profiles NB-story-share-profiles-friends"><div class="NB-story-share-profile"><div class="NB-user-avatar"><a class="NB-show-profile" href="http://ios.newsblur.com/show-profile/13"><img src="http://a0.twimg.com/profile_images/1382021023/Campeche_Steps_normal.jpg" /></a></div></div><div class="NB-story-share-profile"><div class="NB-user-avatar"><a class="NB-show-profile" href="http://ios.newsblur.com/show-profile/32601"><img src="http://www.gravatar.com/avatar/fe66f260795c73ef4add39866445a861" /></a></div></div></div></div></div><div class="NB-story-comment" id="NB-user-comment-32601"><div class="NB-user-avatar"><a class="NB-show-profile" href="http://ios.newsblur.com/show-profile/32601"><img src="http://www.gravatar.com/avatar/fe66f260795c73ef4add39866445a861" /></a></div><div class="NB-story-comment-author-container"> <div class="NB-story-comment-username">mgeraci</div> <div class="NB-story-comment-date">4 days ago</div></div><div class="NB-story-comment-content">32601<div style='clear:both'> <div class="NB-story-comment-reply-button NB-button"> <div class="NB-story-comment-reply-button-wrapper"> <a href="http://ios.newsblur.com/reply/mgeraci/Whoah.">Reply</a> </div> </div> <div class="NB-story-comment-like-button NB-button"><div class="NB-story-comment-like-button-wrapper"><a href="http://ios.newsblur.com/like-comment/32601">Favorite</a></div></div></div></div><div class="NB-story-comment-replies"><div class="NB-story-comment-reply"> <a class="NB-show-profile" href="http://ios.newsblur.com/show-profile/27551"> <img class="NB-user-avatar NB-story-comment-reply-photo" src="http://graph.facebook.com/1702670/picture" /> </a> <div class="NB-story-comment-username NB-story-comment-reply-username">roy</div> <div class="NB-story-comment-date NB-story-comment-reply-date">3 days ago</div> <div class="NB-story-comment-edit-button NB-story-comment-share-edit-button NB-button"><div class="NB-story-comment-edit-button-wrapper"><a href="http://ios.newsblur.com/edit-reply/32601/27551/0">edit</a></div></div> <div class="NB-story-comment-reply-content">Poor plants, what did they do to deserve death by electrocution?</div></div></div></div></div> </div> <script src="zepto.js"></script><script src="storyDetailView.js"></script></body></html>
<p><small><em>via <a href="http://www.reddit.com/r/photography/comments/x1591/photographer_robert_buelteman_shocks_flowers_with/">Reddit</a></em></small></p><img height="1" src="http://feeds.feedburner.com/~r/PhotojojoTumblr/~4/1tdBEmRG7WM" width="1" /></div> </div> </div> <div class='NB-share-header'></div><div class='NB-share-wrapper'><div class='NB-share-inner-wrapper'><div id="NB-share-button-id" class='NB-share-button NB-button'><div><a href="http://ios.newsblur.com/share">Post to Blurblog</a></div></div></div></div> <div id="NB-comments-wrapper"> <div class="NB-feed-story-comments"><div class="NB-story-comments-shares-teaser-wrapper"><div class="NB-story-comments-shares-teaser"><div class="NB-right">Shared by 2 people</div><div class="NB-story-share-profiles NB-story-share-profiles-public"></div><div class="NB-story-share-label">Shared by: </div><div class="NB-story-share-profiles NB-story-share-profiles-friends"><div class="NB-story-share-profile"><div class="NB-user-avatar"><a class="NB-show-profile" href="http://ios.newsblur.com/show-profile/13"><img src="http://a0.twimg.com/profile_images/1382021023/Campeche_Steps_normal.jpg" /></a></div></div><div class="NB-story-share-profile"><div class="NB-user-avatar"><a class="NB-show-profile" href="http://ios.newsblur.com/show-profile/32601"><img src="http://www.gravatar.com/avatar/fe66f260795c73ef4add39866445a861" /></a></div></div></div></div></div><div class="NB-story-comment" id="NB-user-comment-32601"><div class="NB-user-avatar"><a class="NB-show-profile" href="http://ios.newsblur.com/show-profile/32601"><img src="http://www.gravatar.com/avatar/fe66f260795c73ef4add39866445a861" /></a></div><div class="NB-story-comment-author-container"> <div class="NB-story-comment-username">mgeraci</div> <div class="NB-story-comment-date">4 days ago</div></div><div class="NB-story-comment-content">32601<div style='clear:both'> <div class="NB-story-comment-reply-button NB-button"> <div class="NB-story-comment-reply-button-wrapper"> <a href="http://ios.newsblur.com/reply/mgeraci/Whoah.">Reply</a> </div> </div> <div class="NB-story-comment-like-button NB-button"><div class="NB-story-comment-like-button-wrapper"><a href="http://ios.newsblur.com/like-comment/32601">Favorite</a></div></div></div></div><div class="NB-story-comment-replies"><div class="NB-story-comment-reply"> <a class="NB-show-profile" href="http://ios.newsblur.com/show-profile/27551"> <img class="NB-user-avatar NB-story-comment-reply-photo" src="http://graph.facebook.com/1702670/picture" /> </a> <div class="NB-story-comment-username NB-story-comment-reply-username">roy</div> <div class="NB-story-comment-date NB-story-comment-reply-date">3 days ago</div> <div class="NB-story-comment-edit-button NB-story-comment-share-edit-button NB-button"><div class="NB-story-comment-edit-button-wrapper"><a href="http://ios.newsblur.com/edit-reply/32601/27551/0">edit</a></div></div> <div class="NB-story-comment-reply-content">Poor plants, what did they do to deserve death by electrocution?</div></div></div></div></div> </div> <script src="zepto.js"></script><script src="storyDetailView.js"></script></body></html>

View file

@ -275,6 +275,18 @@ del {
max-width: none !important;
}
#story_pane .NB-story-comment.NB-highlighted {
background-color: #FBE5C7;
background-image: -moz-linear-gradient(top, #FBE5C7, #F7D9AD); /* FF3.6 */
background-image: -webkit-gradient(linear, left top, left bottom, from(#FBE5C7), to(#F7D9AD)); /* Saf4+, Chrome */
background-image: linear-gradient(top, #FBE5C7, #F7D9AD);
}
#story_pane .NB-story-comment {
-webkit-transition: background-color .5s linear;
background: none;
}
/* Disable certain interactions on touch devices */
#story_pane .NB-story-comment {
-webkit-touch-callout: none;

View file

@ -45,19 +45,32 @@ function setImage(img) {
}
}
//window.onload = load;
//
//function load() {
// document.getElementsByClassName('NB-button').addEventListener("touchstart", touchStart, false);
// document.getElementsByClassName('NB-button').addEventListener("touchend", touchEnd, false);
//}
//
//function touchStart(e) {
// var original_class = e.target.getAttribute("class");
// e.target.setAttribute("class", original_class + " hover");
//}
//
//function touchEnd(e) {
// var original_class = e.target.getAttribute("class");
// e.target.setAttribute("class", original_class.replace('hover', ''));
//}
function slideToComment(commentId, highlight) {
var commentString = 'NB-user-comment-' + commentId;
//Get comment
var $comment = $('#' + commentString);
if ($comment.length) {
$.scroll($comment.offset().top, 500);
} else {
var shareButton = document.getElementById("NB-share-button-id");
$.scroll($('#NB-share-button-id').offset().top, 500);
}
if (highlight) {
$('#' + commentString).addClass('NB-highlighted');
setTimeout(function(){
$('#' + commentString).removeClass('NB-highlighted');
}, 2000);
}
}
function findPos(obj) {
var curtop = 0;
if (obj.offsetParent) {
do {
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
return [curtop];
}
}

File diff suppressed because one or more lines are too long