Finish look and feel of ios training for both story and feed. Just need to send requests, redraw intelligence, recount and reclassify stories, and update scores. All already written to support inline training.

This commit is contained in:
Samuel Clay 2012-12-27 00:15:26 -08:00
parent f3edf21500
commit a5652da4f1
17 changed files with 272 additions and 5212 deletions

View file

@ -432,7 +432,7 @@
} }
.NB-modal .NB-fieldset { .NB-modal .NB-fieldset {
background-color: #F0F0FF; background-color: #EFF3F6;
border-bottom: 1px solid #D0D0D9; border-bottom: 1px solid #D0D0D9;
margin: 16px 0 0; margin: 16px 0 0;
overflow: hidden; overflow: hidden;

View file

@ -1993,7 +1993,7 @@ background: transparent;
font-size: 9px; font-size: 9px;
padding: 0px 4px 1px; padding: 0px 4px 1px;
margin: 0 2px 2px; margin: 0 2px 2px;
background-color: #DBDBDB; background-color: #D8DEE2;
color: #9D9A95; color: #9D9A95;
text-shadow: 0 1px 0 #E9E9E9; text-shadow: 0 1px 0 #E9E9E9;
border-radius: 4px; border-radius: 4px;
@ -2039,7 +2039,7 @@ background: transparent;
} }
#story_pane .NB-feed-story-tag.NB-score-now-0:hover { #story_pane .NB-feed-story-tag.NB-score-now-0:hover {
/* Grey, active */ /* Grey, active */
background-color: #DBDBDB; background-color: #D8DEE2;
color: #9D9A95; color: #9D9A95;
text-shadow: 0 1px 0 #E9E9E9; text-shadow: 0 1px 0 #E9E9E9;
opacity: 1; opacity: 1;
@ -4163,7 +4163,7 @@ form.opml_import_form input {
padding: 0 30px 0 26px; padding: 0 30px 0 26px;
font-size: 12px; font-size: 12px;
text-transform: uppercase; text-transform: uppercase;
background-color: #F5CD09; background-color: #D8DEE2;
position: relative; position: relative;
border: 1px solid transparent; border: 1px solid transparent;
} }
@ -4183,13 +4183,13 @@ form.opml_import_form input {
} }
.NB-classifiers .NB-classifier label b { .NB-classifiers .NB-classifier label b {
color: #957D09; color: rgba(0,0,0,.4);
text-shadow: none; text-shadow: none;
font-weight: normal; font-weight: normal;
} }
.NB-classifiers .NB-classifier label span { .NB-classifiers .NB-classifier label span {
text-shadow: 1px 1px 0 #F4E576; text-shadow: 1px 1px 0 rgba(255,255,255,0.5);
} }
.NB-classifiers .NB-classifier.NB-classifier-facet-disabled { .NB-classifiers .NB-classifier.NB-classifier-facet-disabled {
@ -4264,7 +4264,7 @@ form.opml_import_form input {
.NB-classifiers .NB-classifier.NB-classifier-like label span, .NB-classifiers .NB-classifier.NB-classifier-like label span,
.NB-classifiers .NB-classifier.NB-classifier-hover-like label span { .NB-classifiers .NB-classifier.NB-classifier-hover-like label span {
color: white; color: white;
text-shadow: 1px 1px 0 #254E18; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
} }
.NB-classifiers .NB-classifier.NB-classifier-like .NB-classifier-icon-dislike, .NB-classifiers .NB-classifier.NB-classifier-like .NB-classifier-icon-dislike,
.NB-classifiers .NB-classifier.NB-classifier-hover-like .NB-classifier-icon-dislike { .NB-classifiers .NB-classifier.NB-classifier-hover-like .NB-classifier-icon-dislike {
@ -4320,7 +4320,7 @@ form.opml_import_form input {
.NB-classifiers .NB-classifier.NB-classifier-dislike label span, .NB-classifiers .NB-classifier.NB-classifier-dislike label span,
.NB-classifiers .NB-classifier.NB-classifier-hover-dislike label span { .NB-classifiers .NB-classifier.NB-classifier-hover-dislike label span {
color: white; color: white;
text-shadow: 1px 1px 0 #7F1012; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
} }
/* =================== */ /* =================== */
/* = Mouse Indicator = */ /* = Mouse Indicator = */

View file

@ -222,6 +222,8 @@
[self.storyTitlesTable reloadData]; [self.storyTitlesTable reloadData];
[storyTitlesTable scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES]; [storyTitlesTable scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];
appDelegate.activeClassifiers = [NSMutableDictionary dictionary]; appDelegate.activeClassifiers = [NSMutableDictionary dictionary];
appDelegate.activePopularAuthors = [NSArray array];
appDelegate.activePopularTags = [NSArray array];
if (appDelegate.isRiverView) { if (appDelegate.isRiverView) {
[self fetchRiverPage:1 withCallback:nil]; [self fetchRiverPage:1 withCallback:nil];
@ -400,6 +402,7 @@
options:kNilOptions options:kNilOptions
error:&error]; error:&error];
id feedId = [results objectForKey:@"feed_id"]; id feedId = [results objectForKey:@"feed_id"];
NSString *feedIdStr = [NSString stringWithFormat:@"%@",feedId];
if (!(appDelegate.isRiverView || appDelegate.isSocialView || appDelegate.isSocialRiverView) if (!(appDelegate.isRiverView || appDelegate.isSocialView || appDelegate.isSocialRiverView)
&& request.tag != [feedId intValue]) { && request.tag != [feedId intValue]) {
@ -422,9 +425,10 @@
[appDelegate.activeClassifiers setObject:[newClassifiers objectForKey:key] forKey:key]; [appDelegate.activeClassifiers setObject:[newClassifiers objectForKey:key] forKey:key];
} }
} else { } else {
NSString *feedIdStr = [NSString stringWithFormat:@"%@",feedId];
[appDelegate.activeClassifiers setObject:newClassifiers forKey:feedIdStr]; [appDelegate.activeClassifiers setObject:newClassifiers forKey:feedIdStr];
} }
appDelegate.activePopularAuthors = [results objectForKey:@"feed_authors"];
appDelegate.activePopularTags = [results objectForKey:@"feed_tags"];
NSArray *newStories = [results objectForKey:@"stories"]; NSArray *newStories = [results objectForKey:@"stories"];
NSMutableArray *confirmedNewStories = [[NSMutableArray alloc] init]; NSMutableArray *confirmedNewStories = [[NSMutableArray alloc] init];

View file

@ -127,7 +127,7 @@
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ {
return 6; return 7;
} }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
@ -136,9 +136,9 @@
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIndentifier]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIndentifier];
if (indexPath.row == 4) { if (indexPath.row == 5) {
return [self makeFontSelectionTableCell]; return [self makeFontSelectionTableCell];
} else if (indexPath.row == 5) { } else if (indexPath.row == 6) {
return [self makeFontSizeTableCell]; return [self makeFontSizeTableCell];
} }
@ -168,6 +168,9 @@
cell.textLabel.text = [@"Send to..." uppercaseString]; cell.textLabel.text = [@"Send to..." uppercaseString];
cell.imageView.image = [UIImage imageNamed:@"email"]; cell.imageView.image = [UIImage imageNamed:@"email"];
} else if (indexPath.row == 3) { } else if (indexPath.row == 3) {
cell.textLabel.text = [@"Train this story" uppercaseString];
cell.imageView.image = [UIImage imageNamed:@"bricks"];
} else if (indexPath.row == 4) {
cell.textLabel.text = [@"Share this story" uppercaseString]; cell.textLabel.text = [@"Share this story" uppercaseString];
cell.imageView.image = [UIImage imageNamed:@"rainbow"]; cell.imageView.image = [UIImage imageNamed:@"rainbow"];
} }
@ -180,7 +183,7 @@
} }
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath { - (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row >= 4) { if (indexPath.row >= 5) {
return nil; return nil;
} }
return indexPath; return indexPath;
@ -206,6 +209,8 @@
} else if (indexPath.row == 2) { } else if (indexPath.row == 2) {
[appDelegate.storyPageControl openSendToDialog]; [appDelegate.storyPageControl openSendToDialog];
} else if (indexPath.row == 3) { } else if (indexPath.row == 3) {
[appDelegate openTrainStory];
} else if (indexPath.row == 4) {
[appDelegate.storyPageControl.currentPage openShareDialog]; [appDelegate.storyPageControl.currentPage openShareDialog];
} }

View file

@ -298,7 +298,7 @@
popoverController.delegate = self; popoverController.delegate = self;
[popoverController setPopoverContentSize:CGSizeMake(240, 228)]; [popoverController setPopoverContentSize:CGSizeMake(240, 38*7)];
// UIBarButtonItem *settingsButton = [[UIBarButtonItem alloc] // UIBarButtonItem *settingsButton = [[UIBarButtonItem alloc]
// initWithCustomView:sender]; // initWithCustomView:sender];
[popoverController presentPopoverFromBarButtonItem:sender [popoverController presentPopoverFromBarButtonItem:sender

View file

@ -91,6 +91,8 @@
NSString *tryFeedStoryId; NSString *tryFeedStoryId;
NSDictionary * activeFeed; NSDictionary * activeFeed;
NSMutableDictionary * activeClassifiers; NSMutableDictionary * activeClassifiers;
NSArray * activePopularTags;
NSArray * activePopularAuthors;
NSString * activeFolder; NSString * activeFolder;
NSDictionary * activeComment; NSDictionary * activeComment;
NSString * activeShareType; NSString * activeShareType;
@ -175,6 +177,8 @@
@property (nonatomic, readwrite) BOOL inStoryDetail; @property (nonatomic, readwrite) BOOL inStoryDetail;
@property (readwrite) NSDictionary * activeFeed; @property (readwrite) NSDictionary * activeFeed;
@property (strong, readwrite) NSMutableDictionary * activeClassifiers; @property (strong, readwrite) NSMutableDictionary * activeClassifiers;
@property (strong, readwrite) NSArray * activePopularTags;
@property (strong, readwrite) NSArray * activePopularAuthors;
@property (readwrite) NSString * activeFolder; @property (readwrite) NSString * activeFolder;
@property (readwrite) NSDictionary * activeComment; @property (readwrite) NSDictionary * activeComment;
@property (readwrite) NSString * activeShareType; @property (readwrite) NSString * activeShareType;
@ -224,6 +228,7 @@
- (void)showAddSiteModal:(id)sender; - (void)showAddSiteModal:(id)sender;
- (void)showMoveSite; - (void)showMoveSite;
- (void)openTrainSite; - (void)openTrainSite;
- (void)openTrainStory;
- (void)loadFeedDetailView; - (void)loadFeedDetailView;
- (void)loadTryFeedDetailView:(NSString *)feedId withStory:(NSString *)contentId isSocial:(BOOL)social withUser:(NSDictionary *)user showFindingStory:(BOOL)showHUD; - (void)loadTryFeedDetailView:(NSString *)feedId withStory:(NSString *)contentId isSocial:(BOOL)social withUser:(NSDictionary *)user showFindingStory:(BOOL)showHUD;
- (void)loadRiverFeedDetailView; - (void)loadRiverFeedDetailView;

View file

@ -95,6 +95,8 @@
@synthesize activeFeed; @synthesize activeFeed;
@synthesize activeClassifiers; @synthesize activeClassifiers;
@synthesize activePopularTags;
@synthesize activePopularAuthors;
@synthesize activeFolder; @synthesize activeFolder;
@synthesize activeFolderFeeds; @synthesize activeFolderFeeds;
@synthesize activeFeedStories; @synthesize activeFeedStories;
@ -408,6 +410,8 @@
- (void)openTrainSite { - (void)openTrainSite {
UINavigationController *navController = self.navigationController; UINavigationController *navController = self.navigationController;
trainerViewController.feedTrainer = YES;
trainerViewController.storyTrainer = NO;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
trainerViewController.modalPresentationStyle=UIModalPresentationFormSheet; trainerViewController.modalPresentationStyle=UIModalPresentationFormSheet;
@ -417,6 +421,18 @@
} }
} }
- (void)openTrainStory {
UINavigationController *navController = self.navigationController;
trainerViewController.feedTrainer = NO;
trainerViewController.storyTrainer = YES;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
trainerViewController.modalPresentationStyle=UIModalPresentationFormSheet;
[navController presentModalViewController:trainerViewController animated:YES];
} else {
[navController presentModalViewController:trainerViewController animated:YES];
}
}
- (void)reloadFeedsView:(BOOL)showLoader { - (void)reloadFeedsView:(BOOL)showLoader {
[feedsViewController fetchFeedList:showLoader]; [feedsViewController fetchFeedList:showLoader];
[loginViewController dismissModalViewControllerAnimated:NO]; [loginViewController dismissModalViewControllerAnimated:NO];

View file

@ -842,7 +842,7 @@
if ([self.popoverController respondsToSelector:@selector(setContainerViewProperties:)]) { if ([self.popoverController respondsToSelector:@selector(setContainerViewProperties:)]) {
[self.popoverController setContainerViewProperties:[self improvedContainerViewProperties]]; [self.popoverController setContainerViewProperties:[self improvedContainerViewProperties]];
} }
[self.popoverController setPopoverContentSize:CGSizeMake(240, 226)]; [self.popoverController setPopoverContentSize:CGSizeMake(240, 38*7-2)];
[self.popoverController presentPopoverFromBarButtonItem:self.fontSettingsButton [self.popoverController presentPopoverFromBarButtonItem:self.fontSettingsButton
permittedArrowDirections:UIPopoverArrowDirectionAny permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES]; animated:YES];

View file

@ -25,19 +25,26 @@
IBOutlet UIBarButtonItem * closeButton; IBOutlet UIBarButtonItem * closeButton;
TrainerWebView *webView; TrainerWebView *webView;
UINavigationBar *navBar; UINavigationBar *navBar;
BOOL feedTrainer;
BOOL storyTrainer;
} }
@property (nonatomic) IBOutlet NewsBlurAppDelegate *appDelegate; @property (nonatomic) IBOutlet NewsBlurAppDelegate *appDelegate;
@property (nonatomic) IBOutlet UIBarButtonItem *closeButton; @property (nonatomic) IBOutlet UIBarButtonItem *closeButton;
@property (nonatomic) IBOutlet TrainerWebView *webView; @property (nonatomic) IBOutlet TrainerWebView *webView;
@property (nonatomic) IBOutlet UINavigationBar *navBar; @property (nonatomic) IBOutlet UINavigationBar *navBar;
@property (nonatomic, assign) BOOL feedTrainer;
@property (nonatomic, assign) BOOL storyTrainer;
- (NSString *)makeTrainerSections; - (NSString *)makeTrainerSections;
- (NSString *)makeAuthor; - (NSString *)makeStoryAuthor;
- (NSString *)makeTags; - (NSString *)makeFeedAuthors;
- (NSString *)makeStoryTags;
- (NSString *)makeFeedTags;
- (NSString *)makePublisher; - (NSString *)makePublisher;
- (NSString *)makeTitle; - (NSString *)makeTitle;
- (NSString *)makeClassifier:(NSString *)classifierName withType:(NSString *)classifierType; - (NSString *)makeClassifier:(NSString *)classifierName withType:(NSString *)classifierType score:(int)score;
- (IBAction)doCloseDialog:(id)sender; - (IBAction)doCloseDialog:(id)sender;
- (void)changeTitle:(id)sender; - (void)changeTitle:(id)sender;

View file

@ -15,6 +15,8 @@
@synthesize webView; @synthesize webView;
@synthesize navBar; @synthesize navBar;
@synthesize appDelegate; @synthesize appDelegate;
@synthesize feedTrainer;
@synthesize storyTrainer;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{ {
@ -73,9 +75,9 @@
#pragma mark Story layout #pragma mark Story layout
- (NSString *)makeTrainerSections { - (NSString *)makeTrainerSections {
NSString *storyAuthor = [self makeAuthor]; NSString *storyAuthor = self.feedTrainer ? [self makeFeedAuthors] : [self makeStoryAuthor];
NSString *storyTags = [self makeTags]; NSString *storyTags = self.feedTrainer ? [self makeFeedTags] : [self makeStoryTags];
NSString *storyTitle = [self makeTitle]; NSString *storyTitle = self.feedTrainer ? @"" : [self makeTitle];
NSString *storyPublisher = [self makePublisher]; NSString *storyPublisher = [self makePublisher];
int contentWidth = self.view.frame.size.width; int contentWidth = self.view.frame.size.width;
@ -126,10 +128,11 @@
return htmlString; return htmlString;
} }
- (NSString *)makeAuthor { - (NSString *)makeStoryAuthor {
NSString *feedId = [NSString stringWithFormat:@"%@", [appDelegate.activeStory NSString *feedId = [NSString stringWithFormat:@"%@", [appDelegate.activeStory
objectForKey:@"story_feed_id"]]; objectForKey:@"story_feed_id"]];
NSString *storyAuthor = @""; NSString *storyAuthor = @"";
if ([[appDelegate.activeStory objectForKey:@"story_authors"] class] != [NSNull class] && if ([[appDelegate.activeStory objectForKey:@"story_authors"] class] != [NSNull class] &&
[[appDelegate.activeStory objectForKey:@"story_authors"] length]) { [[appDelegate.activeStory objectForKey:@"story_authors"] length]) {
NSString *author = [NSString stringWithFormat:@"%@", NSString *author = [NSString stringWithFormat:@"%@",
@ -142,22 +145,62 @@
" <div class=\"NB-trainer-section-title\">Story Authors</div>" " <div class=\"NB-trainer-section-title\">Story Authors</div>"
" <div class=\"NB-trainer-section-body\">" " <div class=\"NB-trainer-section-body\">"
" <a href=\"http://ios.newsblur.com/classify-author/%@\" " " <a href=\"http://ios.newsblur.com/classify-author/%@\" "
" class=\"NB-story-author %@\" id=\"NB-story-author\"><div class=\"NB-highlight\"></div>%@</a>" " class=\"NB-story-author %@\">%@</a>"
" </div>" " </div>"
"</div>", "</div>",
author, author,
authorScore > 0 ? @"NB-story-author-positive" : authorScore < 0 ? @"NB-story-author-negative" : @"", authorScore > 0 ? @"NB-story-author-positive" : authorScore < 0 ? @"NB-story-author-negative" : @"",
[self makeClassifier:author withType:@"Author"]]; [self makeClassifier:author withType:@"Author" score:authorScore]];
} }
} }
return storyAuthor; return storyAuthor;
} }
- (NSString *)makeTags { - (NSString *)makeFeedAuthors {
NSString *feedId = [NSString stringWithFormat:@"%@", [appDelegate.activeFeed objectForKey:@"id"]];
NSString *feedAuthors = @"";
NSArray *authorArray = appDelegate.activePopularAuthors;
if ([authorArray count] > 0) {
NSMutableArray *authorStrings = [NSMutableArray array];
for (NSArray *authorObj in authorArray) {
NSString *author = [authorObj objectAtIndex:0];
int authorCount = [[authorObj objectAtIndex:1] intValue];
int authorScore = [[[[appDelegate.activeClassifiers objectForKey:feedId]
objectForKey:@"authors"]
objectForKey:author] intValue];
NSString *authorHtml = [NSString stringWithFormat:@"<div class=\"NB-classifier-container\">"
" <a href=\"http://ios.newsblur.com/classify-author/%@\" "
" class=\"NB-story-author %@\">%@</a>"
" <span class=\"NB-classifier-count\">&times;&nbsp; %d</span>"
"</div>",
author,
authorScore > 0 ? @"NB-story-author-positive" : authorScore < 0 ? @"NB-story-author-negative" : @"",
[self makeClassifier:author withType:@"author" score:authorScore],
authorCount];
[authorStrings addObject:authorHtml];
}
feedAuthors = [NSString
stringWithFormat:@"<div class=\"NB-trainer-section-inner\">"
" <div class=\"NB-trainer-section-title\">Authors</div>"
" <div class=\"NB-trainer-section-body\">"
" <div class=\"NB-story-authors\">"
" %@"
" </div>"
" </div>"
"</div>",
[authorStrings componentsJoinedByString:@""]];
}
return feedAuthors;
}
- (NSString *)makeStoryTags {
NSString *feedId = [NSString stringWithFormat:@"%@", [appDelegate.activeStory NSString *feedId = [NSString stringWithFormat:@"%@", [appDelegate.activeStory
objectForKey:@"story_feed_id"]]; objectForKey:@"story_feed_id"]];
NSString *storyTags = @""; NSString *storyTags = @"";
if ([appDelegate.activeStory objectForKey:@"story_tags"]) { if ([appDelegate.activeStory objectForKey:@"story_tags"]) {
NSArray *tagArray = [appDelegate.activeStory objectForKey:@"story_tags"]; NSArray *tagArray = [appDelegate.activeStory objectForKey:@"story_tags"];
if ([tagArray count] > 0) { if ([tagArray count] > 0) {
@ -166,20 +209,20 @@
int tagScore = [[[[appDelegate.activeClassifiers objectForKey:feedId] int tagScore = [[[[appDelegate.activeClassifiers objectForKey:feedId]
objectForKey:@"tags"] objectForKey:@"tags"]
objectForKey:tag] intValue]; objectForKey:tag] intValue];
NSString *tagHtml = [NSString stringWithFormat:@"<div class=\"NB-trainer-tag\">" NSString *tagHtml = [NSString stringWithFormat:@"<div class=\"NB-classifier-container\">"
" <a href=\"http://ios.newsblur.com/classify-tag/%@\" " " <a href=\"http://ios.newsblur.com/classify-tag/%@\" "
" class=\"NB-story-tag %@\"><div class=\"NB-highlight\"></div>%@</a>" " class=\"NB-story-tag %@\">%@</a>"
"</div>", "</div>",
tag, tag,
tagScore > 0 ? @"NB-story-tag-positive" : tagScore < 0 ? @"NB-story-tag-negative" : @"", tagScore > 0 ? @"NB-story-tag-positive" : tagScore < 0 ? @"NB-story-tag-negative" : @"",
[self makeClassifier:tag withType:@"Tag"]]; [self makeClassifier:tag withType:@"Tag" score:tagScore]];
[tagStrings addObject:tagHtml]; [tagStrings addObject:tagHtml];
} }
storyTags = [NSString storyTags = [NSString
stringWithFormat:@"<div class=\"NB-trainer-section-inner\">" stringWithFormat:@"<div class=\"NB-trainer-section-inner\">"
" <div class=\"NB-trainer-section-title\">Story Tags</div>" " <div class=\"NB-trainer-section-title\">Story Tags</div>"
" <div class=\"NB-trainer-section-body\">" " <div class=\"NB-trainer-section-body\">"
" <div id=\"NB-story-tags\" class=\"NB-story-tags\">" " <div class=\"NB-story-tags\">"
" %@" " %@"
" </div>" " </div>"
" </div>" " </div>"
@ -190,18 +233,73 @@
return storyTags; return storyTags;
} }
- (NSString *)makeFeedTags {
NSString *feedId = [NSString stringWithFormat:@"%@", [appDelegate.activeFeed objectForKey:@"id"]];
NSString *feedTags = @"";
NSArray *tagArray = appDelegate.activePopularTags;
if ([tagArray count] > 0) {
NSMutableArray *tagStrings = [NSMutableArray array];
for (NSArray *tagObj in tagArray) {
NSString *tag = [tagObj objectAtIndex:0];
int tagCount = [[tagObj objectAtIndex:1] intValue];
int tagScore = [[[[appDelegate.activeClassifiers objectForKey:feedId]
objectForKey:@"tags"]
objectForKey:tag] intValue];
NSString *tagHtml = [NSString stringWithFormat:@"<div class=\"NB-classifier-container\">"
" <a href=\"http://ios.newsblur.com/classify-tag/%@\" "
" class=\"NB-story-tag %@\">%@</a>"
" <span class=\"NB-classifier-count\">&times;&nbsp; %d</span>"
"</div>",
tag,
tagScore > 0 ? @"NB-story-tag-positive" : tagScore < 0 ? @"NB-story-tag-negative" : @"",
[self makeClassifier:tag withType:@"Tag" score:tagScore],
tagCount];
[tagStrings addObject:tagHtml];
}
feedTags = [NSString
stringWithFormat:@"<div class=\"NB-trainer-section-inner\">"
" <div class=\"NB-trainer-section-title\">Story Tags</div>"
" <div class=\"NB-trainer-section-body\">"
" <div class=\"NB-story-tags\">"
" %@"
" </div>"
" </div>"
"</div>",
[tagStrings componentsJoinedByString:@""]];
}
return feedTags;
}
- (NSString *)makePublisher { - (NSString *)makePublisher {
NSString *feedId = [NSString stringWithFormat:@"%@", [appDelegate.activeStory NSString *feedId;
objectForKey:@"story_feed_id"]]; NSString *feedTitle;
NSString *feedTitle = [[appDelegate.dictFeeds objectForKey:feedId] objectForKey:@"feed_title"];
if (self.feedTrainer) {
feedId = [NSString stringWithFormat:@"%@", [appDelegate.activeFeed objectForKey:@"id"]];
feedTitle = [appDelegate.activeFeed objectForKey:@"feed_title"];
} else {
feedId = [NSString stringWithFormat:@"%@", [appDelegate.activeStory
objectForKey:@"story_feed_id"]];
feedTitle = [[appDelegate.dictFeeds objectForKey:feedId] objectForKey:@"feed_title"];
}
int publisherScore = [[[[appDelegate.activeClassifiers objectForKey:feedId]
objectForKey:@"feeds"] objectForKey:feedId] intValue];
NSString *storyPublisher = [NSString stringWithFormat:@"<div class=\"NB-trainer-section-inner\">" NSString *storyPublisher = [NSString stringWithFormat:@"<div class=\"NB-trainer-section-inner\">"
" <div class=\"NB-trainer-section-title\">Publisher</div>" " <div class=\"NB-trainer-section-title\">Publisher</div>"
" <div class=\"NB-trainer-section-body\">" " <div class=\"NB-trainer-section-body\">"
" %@" " <div class=\"NB-classifier-container\">"
" <a href=\"http://ios.newsblur.com/classify-publisher/%@\" "
" class=\"NB-story-publisher %@\">%@</a>"
" </div>"
" </div>" " </div>"
"</div", "</div",
[self makeClassifier:feedTitle withType:@"Publisher"]]; feedId,
publisherScore > 0 ? @"NB-story-publisher-positive" : publisherScore < 0 ? @"NB-story-publisher-negative" : @"",
[self makeClassifier:feedTitle withType:@"publisher" score:publisherScore]];
return storyPublisher; return storyPublisher;
} }
@ -231,15 +329,15 @@
NSString *titleTrainer = [NSString stringWithFormat:@"<div class=\"NB-trainer-section-inner\">" NSString *titleTrainer = [NSString stringWithFormat:@"<div class=\"NB-trainer-section-inner\">"
" <div class=\"NB-trainer-section-title\">Story Title</div>" " <div class=\"NB-trainer-section-title\">Story Title</div>"
" <div class=\"NB-trainer-section-body NB-title\">" " <div class=\"NB-trainer-section-body NB-title\">"
" <div class=\"NB-title-info\">Tap and hold the title below</div>"
" <div class=\"NB-title-trainer\">%@</div>" " <div class=\"NB-title-trainer\">%@</div>"
" <div class=\"NB-title-info\">Tap and hold the title</div>"
" </div>" " </div>"
"</div>", storyTitle]; "</div>", storyTitle];
return titleTrainer; return titleTrainer;
} }
- (NSString *)makeClassifier:(NSString *)classifierName withType:(NSString *)classifierType { - (NSString *)makeClassifier:(NSString *)classifierName withType:(NSString *)classifierType score:(int)score {
NSString *classifier = [NSString stringWithFormat:@"<span class=\"NB-classifier NB-classifier-%@\">" NSString *classifier = [NSString stringWithFormat:@"<span class=\"NB-classifier NB-classifier-%@ NB-classifier-%@\">"
"<div class=\"NB-classifier-icon-like\"></div>" "<div class=\"NB-classifier-icon-like\"></div>"
"<div class=\"NB-classifier-icon-dislike\">" "<div class=\"NB-classifier-icon-dislike\">"
" <div class=\"NB-classifier-icon-dislike-inner\"></div>" " <div class=\"NB-classifier-icon-dislike-inner\"></div>"
@ -247,6 +345,7 @@
"<label><b>%@: </b><span>%@</span></label>" "<label><b>%@: </b><span>%@</span></label>"
"</span>", "</span>",
classifierType, classifierType,
score > 0 ? @"like" : score < 0 ? @"dislike" : @"",
classifierType, classifierType,
classifierName]; classifierName];
@ -269,7 +368,8 @@
} }
- (void)changeTitle:(id)sender { - (void)changeTitle:(id)sender {
NSLog(@"changeTitle: %@", sender); NSString *selectedTitle = [self.webView stringByEvaluatingJavaScriptFromString:@"window.getSelection().toString()"];
NSLog(@"Selected: %@", selectedTitle);
} }
@end @end

View file

@ -16,19 +16,6 @@
landmarkName = "-applyNewIndex:pageController:" landmarkName = "-applyNewIndex:pageController:"
landmarkType = "5"> landmarkType = "5">
</FileBreakpoint> </FileBreakpoint>
<FileBreakpoint
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes/TrainerViewController.m"
timestampString = "378184717.887918"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "272"
endingLineNumber = "272"
landmarkName = "-changeTitle:"
landmarkType = "5">
</FileBreakpoint>
</FileBreakpoints> </FileBreakpoints>
<SymbolicBreakpoints> <SymbolicBreakpoints>
<SymbolicBreakpoint <SymbolicBreakpoint

View file

@ -10,8 +10,8 @@
// #define BACKGROUND_REFRESH_SECONDS -5 // #define BACKGROUND_REFRESH_SECONDS -5
#define BACKGROUND_REFRESH_SECONDS -10*60 #define BACKGROUND_REFRESH_SECONDS -10*60
// #define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.com"] #define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.com"]
#define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"] // #define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
#define NEWSBLUR_LINK_COLOR 0x405BA8 #define NEWSBLUR_LINK_COLOR 0x405BA8
#define NEWSBLUR_HIGHLIGHT_COLOR 0xd2e6fd #define NEWSBLUR_HIGHLIGHT_COLOR 0xd2e6fd

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -64,6 +64,18 @@ function attachFastClick() {
Array.prototype.slice.call(tags, 0).forEach(function(tag) { Array.prototype.slice.call(tags, 0).forEach(function(tag) {
new NoClickDelay(tag); new NoClickDelay(tag);
}); });
var authors = document.getElementsByClassName("NB-story-author");
Array.prototype.slice.call(authors, 0).forEach(function(author) {
new NoClickDelay(author);
});
var publishers = document.getElementsByClassName("NB-story-publisher");
Array.prototype.slice.call(publishers, 0).forEach(function(publisher) {
new NoClickDelay(publisher);
});
var titles = document.getElementsByClassName("NB-story-title");
Array.prototype.slice.call(titles, 0).forEach(function(title) {
new NoClickDelay(title);
});
var author = document.getElementById("NB-story-author"); var author = document.getElementById("NB-story-author");
if (author) { if (author) {

View file

@ -33,14 +33,14 @@
padding: 4px 12px; padding: 4px 12px;
background-color: #F0F8F2; background-color: #F0F8F2;
padding: 8px 12px 6px; padding: 8px 12px 8px;
background-color: #E3ECF8; background-color: #E3ECF8;
background-image: -webkit-gradient(linear, left top, left bottom, from(#E3ECF8), to(#CBDBF5)); background-image: -webkit-gradient(linear, left top, left bottom, from(#E3ECF8), to(#CBDBF5));
text-shadow: 0 1px 0 #F2F6FE; text-shadow: 0 1px 0 #F2F6FE;
border-top: 1px solid #D1DAF7; border-top: 1px solid #D1DAF7;
border-bottom: 1px solid #A1A9CF; border-bottom: 1px solid #A1A9CF;
color: #505050; color: #505050;
font-family: "Gill Sans", "Lucida Sans", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif, inherit; font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif, inherit;
font-weight: normal; font-weight: normal;
position: relative; position: relative;
} }
@ -48,13 +48,14 @@
.NB-trainer-section-body { .NB-trainer-section-body {
padding: 12px 12px; padding: 12px 12px;
overflow: hidden; overflow: hidden;
background-color: #F0F0FF; background-color: #EFF3F6;
border-bottom: 1px solid #D0D0D9; border-bottom: 1px solid #D0D0D9;
} }
.NB-trainer-title .NB-title-trainer { .NB-trainer-title .NB-title-trainer {
padding: 12px 0; padding: 12px 0;
line-height: 20px; font-size: 18px;
line-height: 22px;
-webkit-user-select: auto; -webkit-user-select: auto;
-webkit-touch-callout: default; -webkit-touch-callout: default;
-webkit-highlight: auto; -webkit-highlight: auto;
@ -78,6 +79,12 @@
text-shadow: 0 1px 0 #F6E9E9; text-shadow: 0 1px 0 #F6E9E9;
} }
.NB-classifier-container {
white-space: nowrap;
float: left;
display: block;
}
/* /*
* Classifiers * Classifiers
*/ */
@ -92,7 +99,7 @@
padding: 0 8px 0 26px; padding: 0 8px 0 26px;
font-size: 12px; font-size: 12px;
text-transform: uppercase; text-transform: uppercase;
background-color: #F5CD09; background-color: #D8DEE2;
position: relative; position: relative;
border: 1px solid transparent; border: 1px solid transparent;
border-radius: 12px; border-radius: 12px;
@ -113,13 +120,13 @@
} }
.NB-classifier label b { .NB-classifier label b {
color: #957D09; color: rgba(0,0,0,.4);
text-shadow: none; text-shadow: none;
font-weight: normal; font-weight: normal;
} }
.NB-classifier label span { .NB-classifier label span {
text-shadow: 1px 1px 0 #F4E576; text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);
} }
.NB-classifier.NB-classifier-facet-disabled { .NB-classifier.NB-classifier-facet-disabled {
@ -145,13 +152,24 @@
top: 2px; top: 2px;
opacity: .2; opacity: .2;
} }
.pressed .NB-classifier .NB-classifier-icon-like,
.pressed .NB-classifier.NB-classifier-dislike .NB-classifier-icon-like {
opacity: 1;
}
.pressed .NB-classifier.NB-classifier-like .NB-classifier-icon-like {
opacity: 0;
}
.pressed .NB-classifier.NB-classifier-dislike .NB-classifier-icon-like {
opacity: .2;
display: block;
}
.NB-classifier .NB-classifier-icon-dislike { .NB-classifier .NB-classifier-icon-dislike {
width: 27px; width: 27px;
height: 22px; height: 22px;
position: absolute; position: absolute;
top: -1px; top: -2px;
left: 6px; left: 2px;
background: transparent url('data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAUCAMAAACK2/weAAAAWlBMVEX////+/v79/f3x8fHw8PD97Nj76tb66dX56NT35M/2487u3Mfl1MDaybbRwa/QwK+/v7++vr62tra1tbW+sJ+1qJi0p5ezppd7e3t6enp4eHgCAgIBAQEAAABkZKaJAAAAHnRSTlMA///////////////////////////////////////0OBo3AAAAaklEQVR42rXMyRKDMAwDUIe2kELLFhqWSP//myQmOfbIO3ik0YzlPjsgKEToHP1PLalOM1cfLTrjOXLoo++na2M1D7bvBCSFVcWmziA4DKxNWdcNkBCaC0QFa3d9nKHOscwv7f/m/Kag3hMwawmoH/Rk6gAAAABJRU5ErkJggg==') no-repeat 5px -1px; background: transparent url('data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAUCAMAAACK2/weAAAAWlBMVEX////+/v79/f3x8fHw8PD97Nj76tb66dX56NT35M/2487u3Mfl1MDaybbRwa/QwK+/v7++vr62tra1tbW+sJ+1qJi0p5ezppd7e3t6enp4eHgCAgIBAQEAAABkZKaJAAAAHnRSTlMA///////////////////////////////////////0OBo3AAAAaklEQVR42rXMyRKDMAwDUIe2kELLFhqWSP//myQmOfbIO3ik0YzlPjsgKEToHP1PLalOM1cfLTrjOXLoo++na2M1D7bvBCSFVcWmziA4DKxNWdcNkBCaC0QFa3d9nKHOscwv7f/m/Kag3hMwawmoH/Rk6gAAAABJRU5ErkJggg==') no-repeat 5px -1px;
display: none; display: none;
} }
@ -160,9 +178,7 @@
margin: 4px 4px 0 0; margin: 4px 4px 0 0;
width: 18px; width: 18px;
height: 13px; height: 13px;
border-left: 1px solid #EBEBE1;
} }
.NB-classifier.NB-classifier-like { .NB-classifier.NB-classifier-like {
background-color: #34912E; background-color: #34912E;
border: 1px solid #202020; border: 1px solid #202020;
@ -178,12 +194,58 @@
box-shadow: 1px 1px 1px #BDC0D7; box-shadow: 1px 1px 1px #BDC0D7;
} }
.NB-classifier.NB-classifier-like .NB-classifier-icon-like {
opacity: 1;
}
.NB-classifier.NB-classifier-dislike .NB-classifier-icon-like { .NB-classifier.NB-classifier-dislike .NB-classifier-icon-like {
display: none; display: none;
} }
.NB-classifier.NB-classifier-dislike .NB-classifier-icon-dislike { .NB-classifier.NB-classifier-dislike .NB-classifier-icon-dislike {
display: block; display: block;
} }
.NB-classifier.NB-classifier-like label b,
.pressed .NB-classifier label b {
color: white;
}
.NB-classifier.NB-classifier-like label span,
.pressed .NB-classifier label span {
color: white;
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}
.pressed .NB-classifier.NB-classifier-like .NB-classifier-icon-like,
.pressed .NB-classifier.NB-classifier-dislike .NB-classifier-icon-dislike {
display: none;
}
.pressed .NB-classifier.NB-classifier-like .NB-classifier-icon-dislike,
.pressed .NB-classifier.NB-classifier-like .NB-classifier-icon-like {
display: block;
}
.pressed .NB-classifier {
background-color: #54A54E;
border: 1px solid transparent;
box-shadow: none;
}
.pressed .NB-classifier.NB-classifier-like {
background-color: #C92123;
border: 1px solid transparent;
box-shadow: none;
}
.pressed .NB-classifier.NB-classifier-dislike {
border: 1px solid transparent;
background-color: #C6C6C6;
box-shadow: none;
}
.NB-classifier.NB-classifier-dislike label b,
.pressed .NB-classifier.NB-classifier-like label b {
color: white;
}
.NB-classifier.NB-classifier-dislike label span,
.pressed .NB-classifier.NB-classifier-like label span {
color: white;
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}
.NB-classifier-count {
font-size: 10px;
margin: 0 6px 0 -2px;
line-height: 26px;
color: #A0A0A0;
}