mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Fixing training in river/social. Also adding avatars to fast clicks.
This commit is contained in:
parent
c2653fa869
commit
94136ae41b
8 changed files with 375 additions and 99 deletions
|
@ -220,7 +220,7 @@
|
|||
|
||||
[self.storyTitlesTable reloadData];
|
||||
[storyTitlesTable scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];
|
||||
|
||||
appDelegate.activeClassifiers = [NSMutableDictionary dictionary];
|
||||
|
||||
if (appDelegate.isRiverView) {
|
||||
[self fetchRiverPage:1 withCallback:nil];
|
||||
|
@ -411,7 +411,10 @@
|
|||
[self loadFaviconsFromActiveFeed];
|
||||
}
|
||||
|
||||
appDelegate.activeClassifiers = [[results objectForKey:@"classifiers"] mutableCopy];
|
||||
NSMutableDictionary *newClassifiers = [[results objectForKey:@"classifiers"] mutableCopy];
|
||||
for (id key in [newClassifiers allKeys]) {
|
||||
[appDelegate.activeClassifiers setObject:[newClassifiers objectForKey:key] forKey:key];
|
||||
}
|
||||
|
||||
NSArray *newStories = [results objectForKey:@"stories"];
|
||||
NSMutableArray *confirmedNewStories = [[NSMutableArray alloc] init];
|
||||
|
|
|
@ -171,7 +171,7 @@
|
|||
@property (nonatomic, readwrite) BOOL inFeedDetail;
|
||||
@property (nonatomic, readwrite) BOOL inStoryDetail;
|
||||
@property (readwrite) NSDictionary * activeFeed;
|
||||
@property (readwrite) NSMutableDictionary * activeClassifiers;
|
||||
@property (strong, readwrite) NSMutableDictionary * activeClassifiers;
|
||||
@property (readwrite) NSString * activeFolder;
|
||||
@property (readwrite) NSDictionary * activeComment;
|
||||
@property (readwrite) NSString * activeShareType;
|
||||
|
|
|
@ -94,6 +94,7 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
[self.intelligenceControl setWidth:62 forSegmentAtIndex:2];
|
||||
self.intelligenceControl.hidden = YES;
|
||||
|
||||
appDelegate.activeClassifiers = [NSMutableDictionary dictionary];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
|
@ -813,6 +814,7 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
appDelegate.isRiverView = NO;
|
||||
appDelegate.isSocialRiverView = NO;
|
||||
[appDelegate.folderCountCache removeObjectForKey:folderName];
|
||||
appDelegate.activeClassifiers = [NSMutableDictionary dictionary];
|
||||
|
||||
[appDelegate loadFeedDetailView];
|
||||
}
|
||||
|
|
|
@ -203,7 +203,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];
|
||||
|
||||
|
@ -278,51 +278,76 @@
|
|||
#pragma mark Story layout
|
||||
|
||||
- (NSString *)getHeader {
|
||||
NSString *story_author = @"";
|
||||
if ([self.activeStory objectForKey:@"story_authors"]) {
|
||||
NSString *feedId = [NSString stringWithFormat:@"%@", [appDelegate.activeStory
|
||||
objectForKey:@"story_feed_id"]];
|
||||
NSString *storyAuthor = @"";
|
||||
if ([[self.activeStory objectForKey:@"story_authors"] class] != [NSNull class] &&
|
||||
[[self.activeStory objectForKey:@"story_authors"] length]) {
|
||||
NSString *author = [NSString stringWithFormat:@"%@",
|
||||
[self.activeStory objectForKey:@"story_authors"]];
|
||||
if (author && ![author isEqualToString:@"<null>"]) {
|
||||
int author_score = [[[appDelegate.activeClassifiers objectForKey:@"authors"] objectForKey:author] intValue];
|
||||
story_author = [NSString stringWithFormat:@"<a href=\"http://ios.newsblur.com/classify-author/%@\" "
|
||||
"class=\"NB-story-author %@\"><div class=\"NB-highlight\"></div>%@</a>",
|
||||
author,
|
||||
author_score > 0 ? @"NB-story-author-positive" : author_score < 0 ? @"NB-story-author-negative" : @"",
|
||||
author];
|
||||
if (author && [author class] != [NSNull class]) {
|
||||
int authorScore;
|
||||
if (appDelegate.isRiverView || appDelegate.isSocialRiverView || appDelegate.isSocialView) {
|
||||
authorScore = [[[[appDelegate.activeClassifiers objectForKey:feedId]
|
||||
objectForKey:@"authors"]
|
||||
objectForKey:author] intValue];
|
||||
} else {
|
||||
authorScore = [[[appDelegate.activeClassifiers objectForKey:@"authors"]
|
||||
objectForKey:author] intValue];
|
||||
}
|
||||
storyAuthor = [NSString stringWithFormat:@"<a href=\"http://ios.newsblur.com/classify-author/%@\" "
|
||||
"class=\"NB-story-author %@\" id=\"NB-story-author\"><div class=\"NB-highlight\"></div>%@</a>",
|
||||
author,
|
||||
authorScore > 0 ? @"NB-story-author-positive" : authorScore < 0 ? @"NB-story-author-negative" : @"",
|
||||
author];
|
||||
}
|
||||
}
|
||||
NSString *story_tags = @"";
|
||||
NSString *storyTags = @"";
|
||||
if ([self.activeStory objectForKey:@"story_tags"]) {
|
||||
NSArray *tag_array = [self.activeStory objectForKey:@"story_tags"];
|
||||
if ([tag_array count] > 0) {
|
||||
NSMutableArray *tag_strings = [NSMutableArray array];
|
||||
for (NSString *tag in tag_array) {
|
||||
int tag_score = [[[appDelegate.activeClassifiers objectForKey:@"tags"] objectForKey:tag] intValue];
|
||||
NSString *tag_html = [NSString stringWithFormat:@"<a href=\"http://ios.newsblur.com/classify-tag/%@\" "
|
||||
NSArray *tagArray = [self.activeStory objectForKey:@"story_tags"];
|
||||
if ([tagArray count] > 0) {
|
||||
NSMutableArray *tagStrings = [NSMutableArray array];
|
||||
for (NSString *tag in tagArray) {
|
||||
int tagScore;
|
||||
if (appDelegate.isRiverView || appDelegate.isSocialRiverView || appDelegate.isSocialView) {
|
||||
tagScore = [[[[appDelegate.activeClassifiers objectForKey:feedId]
|
||||
objectForKey:@"tags"]
|
||||
objectForKey:tag] intValue];
|
||||
} else {
|
||||
tagScore = [[[appDelegate.activeClassifiers objectForKey:@"tags"]
|
||||
objectForKey:tag] intValue];
|
||||
}
|
||||
NSString *tagHtml = [NSString stringWithFormat:@"<a href=\"http://ios.newsblur.com/classify-tag/%@\" "
|
||||
"class=\"NB-story-tag %@\"><div class=\"NB-highlight\"></div>%@</a>",
|
||||
tag,
|
||||
tag_score > 0 ? @"NB-story-tag-positive" : tag_score < 0 ? @"NB-story-tag-negative" : @"",
|
||||
tagScore > 0 ? @"NB-story-tag-positive" : tagScore < 0 ? @"NB-story-tag-negative" : @"",
|
||||
tag];
|
||||
[tag_strings addObject:tag_html];
|
||||
[tagStrings addObject:tagHtml];
|
||||
}
|
||||
story_tags = [NSString
|
||||
stringWithFormat:@"<div id=\"NB-story-tags\" class=\"NB-story-tags\">"
|
||||
"%@"
|
||||
"</div>",
|
||||
[tag_strings componentsJoinedByString:@""]];
|
||||
storyTags = [NSString
|
||||
stringWithFormat:@"<div id=\"NB-story-tags\" class=\"NB-story-tags\">"
|
||||
"%@"
|
||||
"</div>",
|
||||
[tagStrings componentsJoinedByString:@""]];
|
||||
}
|
||||
}
|
||||
|
||||
NSString *story_title = [self.activeStory objectForKey:@"story_title"];
|
||||
for (NSString *title_classifier in [appDelegate.activeClassifiers objectForKey:@"titles"]) {
|
||||
if ([story_title containsString:title_classifier]) {
|
||||
int title_score = [[[appDelegate.activeClassifiers objectForKey:@"titles"]
|
||||
objectForKey:title_classifier] intValue];
|
||||
story_title = [story_title
|
||||
stringByReplacingOccurrencesOfString:title_classifier
|
||||
withString:[NSString stringWithFormat:@"<span class=\"NB-story-title-%@\">%@</span>",
|
||||
title_score > 0 ? @"positive" : title_score < 0 ? @"negative" : @"",
|
||||
title_classifier]];
|
||||
NSString *storyTitle = [self.activeStory objectForKey:@"story_title"];
|
||||
NSMutableDictionary *titleClassifiers;
|
||||
if (appDelegate.isRiverView || appDelegate.isSocialRiverView || appDelegate.isSocialView) {
|
||||
titleClassifiers = [[appDelegate.activeClassifiers objectForKey:feedId]
|
||||
objectForKey:@"titles"];
|
||||
} else {
|
||||
titleClassifiers = [appDelegate.activeClassifiers objectForKey:@"titles"];
|
||||
}
|
||||
for (NSString *titleClassifier in titleClassifiers) {
|
||||
if ([storyTitle containsString:titleClassifier]) {
|
||||
int titleScore = [[titleClassifiers objectForKey:titleClassifier] intValue];
|
||||
storyTitle = [storyTitle
|
||||
stringByReplacingOccurrencesOfString:titleClassifier
|
||||
withString:[NSString stringWithFormat:@"<span class=\"NB-story-title-%@\">%@</span>",
|
||||
titleScore > 0 ? @"positive" : titleScore < 0 ? @"negative" : @"",
|
||||
titleClassifier]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -333,21 +358,21 @@
|
|||
"%@"
|
||||
"%@"
|
||||
"</div></div>",
|
||||
[story_tags length] ?
|
||||
[storyTags length] ?
|
||||
[self.activeStory objectForKey:@"long_parsed_date"] :
|
||||
[self.activeStory objectForKey:@"short_parsed_date"],
|
||||
story_title,
|
||||
story_author,
|
||||
story_tags];
|
||||
storyTitle,
|
||||
storyAuthor,
|
||||
storyTags];
|
||||
return storyHeader;
|
||||
}
|
||||
|
||||
- (NSString *)getAvatars:(NSString *)key {
|
||||
NSString *avatarString = @"";
|
||||
NSArray *share_user_ids = [self.activeStory objectForKey:key];
|
||||
NSArray *shareUserIds = [self.activeStory objectForKey:key];
|
||||
|
||||
for (int i = 0; i < share_user_ids.count; i++) {
|
||||
NSDictionary *user = [self getUser:[[share_user_ids objectAtIndex:i] intValue]];
|
||||
for (int i = 0; i < shareUserIds.count; i++) {
|
||||
NSDictionary *user = [self getUser:[[shareUserIds objectAtIndex:i] intValue]];
|
||||
NSString *avatarClass = @"NB-user-avatar";
|
||||
if ([key isEqualToString:@"commented_by_public"] ||
|
||||
[key isEqualToString:@"shared_by_public"]) {
|
||||
|
@ -356,7 +381,10 @@
|
|||
NSString *avatar = [NSString stringWithFormat:@
|
||||
"<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>"
|
||||
" href=\"http://ios.newsblur.com/show-profile/%@\">"
|
||||
"<div class=\"NB-highlight\"></div>"
|
||||
"<img src=\"%@\" />"
|
||||
"</a>"
|
||||
"</div></div>",
|
||||
avatarClass,
|
||||
[user objectForKey:@"user_id"],
|
||||
|
@ -558,7 +586,12 @@
|
|||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
comment = [NSString stringWithFormat:@
|
||||
"<div class=\"NB-story-comment\" id=\"NB-user-comment-%@\">"
|
||||
"<div class=\"%@\"><a class=\"NB-show-profile\" href=\"http://ios.newsblur.com/show-profile/%@\"><img src=\"%@\" /></a></div>"
|
||||
"<div class=\"%@\">"
|
||||
"<a class=\"NB-show-profile\" href=\"http://ios.newsblur.com/show-profile/%@\">"
|
||||
"<div class=\"NB-highlight\"></div>"
|
||||
"<img src=\"%@\" />"
|
||||
"</a>"
|
||||
"</div>"
|
||||
"<div class=\"NB-story-comment-author-container\">"
|
||||
" %@"
|
||||
" <div class=\"NB-story-comment-username\">%@</div>"
|
||||
|
@ -594,7 +627,12 @@
|
|||
} else {
|
||||
comment = [NSString stringWithFormat:@
|
||||
"<div class=\"NB-story-comment\" id=\"NB-user-comment-%@\">"
|
||||
"<div class=\"%@\"><a class=\"NB-show-profile\" href=\"http://ios.newsblur.com/show-profile/%@\"><img src=\"%@\" /></a></div>"
|
||||
"<div class=\"%@\">"
|
||||
"<a class=\"NB-show-profile\" href=\"http://ios.newsblur.com/show-profile/%@\">"
|
||||
"<div class=\"NB-highlight\"></div>"
|
||||
"<img src=\"%@\" />"
|
||||
"</a>"
|
||||
"</div>"
|
||||
"<div class=\"NB-story-comment-author-container\">"
|
||||
" %@"
|
||||
" <div class=\"NB-story-comment-username\">%@</div>"
|
||||
|
@ -677,6 +715,7 @@
|
|||
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/%@\">"
|
||||
" <div class=\"NB-highlight\"></div>"
|
||||
" <img class=\"NB-story-comment-reply-photo\" src=\"%@\" />"
|
||||
" </a>"
|
||||
" <div class=\"NB-story-comment-username NB-story-comment-reply-username\">%@</div>"
|
||||
|
@ -699,6 +738,7 @@
|
|||
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/%@\">"
|
||||
" <div class=\"NB-highlight\"></div>"
|
||||
" <img class=\"NB-story-comment-reply-photo\" src=\"%@\" />"
|
||||
" </a>"
|
||||
" <div class=\"NB-story-comment-username NB-story-comment-reply-username\">%@</div>"
|
||||
|
@ -1147,6 +1187,8 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
shareBarString];
|
||||
NSString *shareType = appDelegate.activeShareType;
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsString];
|
||||
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:@"attachFastClick();"];
|
||||
|
||||
// HACK to make the scroll event happen after the replace innerHTML event above happens.
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, .15 * NSEC_PER_SEC),
|
||||
|
@ -1229,17 +1271,36 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
#pragma mark Classifiers
|
||||
|
||||
- (void)toggleAuthorClassifier:(NSString *)author {
|
||||
int author_score = [[[appDelegate.activeClassifiers objectForKey:@"authors"] objectForKey:author] intValue];
|
||||
if (author_score > 0) {
|
||||
author_score = -1;
|
||||
} else if (author_score < 0) {
|
||||
author_score = 0;
|
||||
NSString *feedId = [NSString stringWithFormat:@"%@", [appDelegate.activeStory
|
||||
objectForKey:@"story_feed_id"]];
|
||||
int authorScore;
|
||||
if (appDelegate.isRiverView || appDelegate.isSocialRiverView || appDelegate.isSocialView) {
|
||||
authorScore = [[[[appDelegate.activeClassifiers objectForKey:feedId]
|
||||
objectForKey:@"authors"]
|
||||
objectForKey:author] intValue];
|
||||
} else {
|
||||
author_score = 1;
|
||||
authorScore = [[[appDelegate.activeClassifiers objectForKey:@"authors"]
|
||||
objectForKey:author] intValue];
|
||||
}
|
||||
if (authorScore > 0) {
|
||||
authorScore = -1;
|
||||
} else if (authorScore < 0) {
|
||||
authorScore = 0;
|
||||
} else {
|
||||
authorScore = 1;
|
||||
}
|
||||
if (appDelegate.isRiverView || appDelegate.isSocialRiverView || appDelegate.isSocialView) {
|
||||
NSMutableDictionary *feedClassifiers = [[appDelegate.activeClassifiers objectForKey:feedId]
|
||||
mutableCopy];
|
||||
NSMutableDictionary *authors = [[feedClassifiers objectForKey:@"authors"] mutableCopy];
|
||||
[authors setObject:[NSNumber numberWithInt:authorScore] forKey:author];
|
||||
[feedClassifiers setObject:authors forKey:@"authors"];
|
||||
[appDelegate.activeClassifiers setObject:feedClassifiers forKey:feedId];
|
||||
} else {
|
||||
NSMutableDictionary *authors = [[appDelegate.activeClassifiers objectForKey:@"authors"] mutableCopy];
|
||||
[authors setObject:[NSNumber numberWithInt:authorScore] forKey:author];
|
||||
[appDelegate.activeClassifiers setObject:authors forKey:@"authors"];
|
||||
}
|
||||
NSMutableDictionary *authors = [[appDelegate.activeClassifiers objectForKey:@"authors"] mutableCopy];
|
||||
[authors setObject:[NSNumber numberWithInt:author_score] forKey:author];
|
||||
[appDelegate.activeClassifiers setObject:authors forKey:@"authors"];
|
||||
[appDelegate.storyPageControl refreshHeaders];
|
||||
|
||||
NSString *urlString = [NSString stringWithFormat:@"http://%@/classifier/save",
|
||||
|
@ -1247,12 +1308,10 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
[request setPostValue:author
|
||||
forKey:author_score >= 1 ? @"like_author" :
|
||||
author_score <= -1 ? @"dislike_author" :
|
||||
forKey:authorScore >= 1 ? @"like_author" :
|
||||
authorScore <= -1 ? @"dislike_author" :
|
||||
@"remove_like_author"];
|
||||
[request setPostValue:[self.activeStory
|
||||
objectForKey:@"story_feed_id"]
|
||||
forKey:@"feed_id"];
|
||||
[request setPostValue:feedId forKey:@"feed_id"];
|
||||
[request setDidFinishSelector:@selector(finishTrain:)];
|
||||
[request setDidFailSelector:@selector(requestFailed:)];
|
||||
[request setDelegate:self];
|
||||
|
@ -1260,18 +1319,38 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
}
|
||||
|
||||
- (void)toggleTagClassifier:(NSString *)tag {
|
||||
int tag_score = [[[appDelegate.activeClassifiers objectForKey:@"tags"] objectForKey:tag] intValue];
|
||||
if (tag_score > 0) {
|
||||
tag_score = -1;
|
||||
} else if (tag_score < 0) {
|
||||
tag_score = 0;
|
||||
NSString *feedId = [NSString stringWithFormat:@"%@", [appDelegate.activeStory
|
||||
objectForKey:@"story_feed_id"]];
|
||||
int tagScore;
|
||||
if (appDelegate.isRiverView || appDelegate.isSocialRiverView || appDelegate.isSocialView) {
|
||||
tagScore = [[[[appDelegate.activeClassifiers objectForKey:feedId]
|
||||
objectForKey:@"tags"]
|
||||
objectForKey:tag] intValue];
|
||||
} else {
|
||||
tag_score = 1;
|
||||
tagScore = [[[appDelegate.activeClassifiers objectForKey:@"tags"]
|
||||
objectForKey:tag] intValue];
|
||||
}
|
||||
|
||||
if (tagScore > 0) {
|
||||
tagScore = -1;
|
||||
} else if (tagScore < 0) {
|
||||
tagScore = 0;
|
||||
} else {
|
||||
tagScore = 1;
|
||||
}
|
||||
|
||||
NSMutableDictionary *tags = [[appDelegate.activeClassifiers objectForKey:@"tags"] mutableCopy];
|
||||
[tags setObject:[NSNumber numberWithInt:tag_score] forKey:tag];
|
||||
[appDelegate.activeClassifiers setObject:tags forKey:@"tags"];
|
||||
if (appDelegate.isRiverView || appDelegate.isSocialRiverView || appDelegate.isSocialView) {
|
||||
NSMutableDictionary *feedClassifiers = [[appDelegate.activeClassifiers objectForKey:feedId]
|
||||
mutableCopy];
|
||||
NSMutableDictionary *tags = [[feedClassifiers objectForKey:@"tags"] mutableCopy];
|
||||
[tags setObject:[NSNumber numberWithInt:tagScore] forKey:tag];
|
||||
[feedClassifiers setObject:tags forKey:@"tags"];
|
||||
[appDelegate.activeClassifiers setObject:feedClassifiers forKey:feedId];
|
||||
} else {
|
||||
NSMutableDictionary *tags = [[appDelegate.activeClassifiers objectForKey:@"tags"] mutableCopy];
|
||||
[tags setObject:[NSNumber numberWithInt:tagScore] forKey:tag];
|
||||
[appDelegate.activeClassifiers setObject:tags forKey:@"tags"];
|
||||
}
|
||||
[appDelegate.storyPageControl refreshHeaders];
|
||||
|
||||
NSString *urlString = [NSString stringWithFormat:@"http://%@/classifier/save",
|
||||
|
@ -1279,12 +1358,10 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
[request setPostValue:tag
|
||||
forKey:tag_score >= 1 ? @"like_tag" :
|
||||
tag_score <= -1 ? @"dislike_tag" :
|
||||
forKey:tagScore >= 1 ? @"like_tag" :
|
||||
tagScore <= -1 ? @"dislike_tag" :
|
||||
@"remove_like_tag"];
|
||||
[request setPostValue:[self.activeStory
|
||||
objectForKey:@"story_feed_id"]
|
||||
forKey:@"feed_id"];
|
||||
[request setPostValue:feedId forKey:@"feed_id"];
|
||||
[request setDidFinishSelector:@selector(finishTrain:)];
|
||||
[request setDidFailSelector:@selector(requestFailed:)];
|
||||
[request setDelegate:self];
|
||||
|
|
|
@ -441,7 +441,7 @@
|
|||
43763AD0158F90B100B3DBE2 /* FontSettingsViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = FontSettingsViewController.xib; path = ../Classes/FontSettingsViewController.xib; sourceTree = "<group>"; };
|
||||
437AA8B815929D51005463F5 /* zepto.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = zepto.js; path = ../zepto.js; sourceTree = "<group>"; };
|
||||
437AA8BD15929DA7005463F5 /* storyDetailView.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = storyDetailView.js; path = ../storyDetailView.js; sourceTree = "<group>"; };
|
||||
437AA8BF15929DFA005463F5 /* storyDetailView.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = storyDetailView.css; path = ../storyDetailView.css; sourceTree = "<group>"; };
|
||||
437AA8BF15929DFA005463F5 /* storyDetailView.css */ = {isa = PBXFileReference; explicitFileType = text.css; fileEncoding = 4; name = storyDetailView.css; path = ../storyDetailView.css; sourceTree = "<group>"; };
|
||||
437AA8C7159394E2005463F5 /* ShareViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShareViewController.h; sourceTree = "<group>"; };
|
||||
437AA8C8159394E2005463F5 /* ShareViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShareViewController.m; sourceTree = "<group>"; };
|
||||
437AA8C9159394E2005463F5 /* ShareViewController~ipad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = "ShareViewController~ipad.xib"; path = "Classes/ShareViewController~ipad.xib"; sourceTree = "<group>"; };
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -194,19 +194,22 @@ body.NB-iphone {
|
|||
text-shadow: 0 1px 0 #986064;
|
||||
}
|
||||
.NB-story-tag .NB-highlight,
|
||||
.NB-story-author .NB-highlight {
|
||||
.NB-story-author .NB-highlight,
|
||||
.NB-show-profile .NB-highlight {
|
||||
position: absolute;
|
||||
top: -2px;
|
||||
left: -2px;
|
||||
bottom: -2px;
|
||||
right: -2px;
|
||||
background-color: #000;
|
||||
background-color: #040;
|
||||
opacity: .25;
|
||||
border-radius: 4px;
|
||||
display: none;
|
||||
}
|
||||
.NB-story-tag.pressed .NB-highlight,
|
||||
.NB-story-author.pressed .NB-highlight {
|
||||
.NB-story-author.pressed .NB-highlight,
|
||||
.pressed .NB-show-profile .NB-highlight,
|
||||
.NB-show-profile.pressed .NB-highlight {
|
||||
display: block;
|
||||
|
||||
}
|
||||
|
@ -418,13 +421,14 @@ del {
|
|||
|
||||
.nb-story-comments-label {
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
margin-right: 2px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.nb-story-share-label {
|
||||
float: right;
|
||||
margin-top: 6px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
/* Sharing */
|
||||
|
@ -434,12 +438,14 @@ del {
|
|||
}
|
||||
|
||||
a.NB-show-profile {
|
||||
margin: 0 0 0 2px;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Disable certain interactions on touch devices */
|
||||
.NB-button,
|
||||
.NB-show-profile.a {
|
||||
a.NB-show-profile {
|
||||
-webkit-text-size-adjust: none;
|
||||
-webkit-user-select: none;
|
||||
-webkit-highlight: none;
|
||||
|
@ -447,7 +453,8 @@ a.NB-show-profile {
|
|||
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
||||
}
|
||||
|
||||
.NB-header {
|
||||
.NB-header,
|
||||
#NB-share-bar-wrapper {
|
||||
-webkit-user-select: none;
|
||||
-webkit-highlight: none;
|
||||
-webkit-touch-callout: none;
|
||||
|
|
|
@ -12,8 +12,7 @@ $('a.NB-show-profile').live('click', function () {
|
|||
var url = $(this).attr('href') + "/" + offset.left + "/" + (offset.top - window.pageYOffset) + "/" + offset.width + "/" + offset.height;
|
||||
window.location = url;
|
||||
return false;
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
$('.NB-button').live('touchstart', function () {
|
||||
$(this).addClass('selected');
|
||||
|
@ -95,11 +94,6 @@ function findPos(obj) {
|
|||
}
|
||||
}
|
||||
|
||||
function NoClickDelay(el) {
|
||||
this.element = el;
|
||||
if( window.Touch ) this.element.addEventListener('touchstart', this, false);
|
||||
}
|
||||
|
||||
function NoClickDelay(el) {
|
||||
this.element = typeof el == 'object' ? el : document.getElementById(el);
|
||||
if( window.Touch ) this.element.addEventListener('touchstart', this, false);
|
||||
|
@ -118,7 +112,8 @@ onTouchStart: function(e) {
|
|||
this.x = e.targetTouches[0].clientX;
|
||||
this.y = e.targetTouches[0].clientY;
|
||||
this.theTarget = document.elementFromPoint(e.targetTouches[0].clientX, e.targetTouches[0].clientY);
|
||||
if(this.theTarget.nodeType == 3) this.theTarget = theTarget.parentNode;
|
||||
this.theTarget = $(this.theTarget).closest('a').get(0);
|
||||
// if(this.theTarget.nodeType == 3) this.theTarget = theTarget.parentNode;
|
||||
this.theTarget.className+= ' pressed';
|
||||
this.element.addEventListener('touchmove', this, false);
|
||||
this.element.addEventListener('touchend', this, false);
|
||||
|
@ -152,16 +147,21 @@ onTouchEnd: function(e) {
|
|||
};
|
||||
|
||||
function attachFastClick() {
|
||||
var avatars = document.getElementsByClassName("NB-show-profile");
|
||||
Array.prototype.slice.call(avatars, 0).forEach(function(avatar) {
|
||||
new NoClickDelay(avatar);
|
||||
});
|
||||
var tags = document.getElementsByClassName("NB-story-tag");
|
||||
Array.prototype.slice.call(tags, 0).forEach(function(tag) {
|
||||
new NoClickDelay(tag);
|
||||
});
|
||||
var authors = document.getElementsByClassName("NB-story-author");
|
||||
Array.prototype.slice.call(authors, 0).forEach(function(author) {
|
||||
new NoClickDelay(author);
|
||||
});
|
||||
new NoClickDelay(tag);
|
||||
});
|
||||
|
||||
var author = document.getElementById("NB-story-author");
|
||||
if (author) {
|
||||
new NoClickDelay(author);
|
||||
}
|
||||
}
|
||||
|
||||
Zepto(function($) {
|
||||
attachFastClick();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue