Fixing bug around training stories with a newline in the title.

This commit is contained in:
Samuel Clay 2012-12-13 12:40:05 -08:00
parent ec5a93ba56
commit a16813648d
3 changed files with 12 additions and 4 deletions

View file

@ -809,7 +809,7 @@
}
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {
NSURL *url = [request URL];
NSArray *urlComponents = [url pathComponents];
@ -817,7 +817,8 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
if ([urlComponents count] > 1) {
action = [NSString stringWithFormat:@"%@", [urlComponents objectAtIndex:1]];
}
NSLog(@"Tapped url: %@", url);
// HACK: Using ios.newsblur.com to intercept the javascript share, reply, and edit events.
// the pathComponents do not work correctly unless it is a correctly formed url
// Is there a better way? Someone show me the light
@ -1289,6 +1290,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
}
- (void)toggleTagClassifier:(NSString *)tag {
NSLog(@"toggleTagClassifier: %@", tag);
NSString *feedId = [NSString stringWithFormat:@"%@", [appDelegate.activeStory
objectForKey:@"story_feed_id"]];
int tagScore = [[[[appDelegate.activeClassifiers objectForKey:feedId]
@ -1335,9 +1337,11 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
}
- (void)refreshHeader {
NSString *headerString = [[self getHeader] stringByReplacingOccurrencesOfString:@"\'" withString:@"\\'"];
NSString *headerString = [[[self getHeader] stringByReplacingOccurrencesOfString:@"\'" withString:@"\\'"]
stringByReplacingOccurrencesOfString:@"\n" withString:@" "];
NSString *jsString = [NSString stringWithFormat:@"document.getElementById('NB-header-container').innerHTML = '%@';",
headerString];
[self.webView stringByEvaluatingJavaScriptFromString:jsString];
[self.webView stringByEvaluatingJavaScriptFromString:@"attachFastClick();"];

Binary file not shown.

View file

@ -96,7 +96,11 @@ function findPos(obj) {
function NoClickDelay(el) {
this.element = typeof el == 'object' ? el : document.getElementById(el);
if( window.Touch ) this.element.addEventListener('touchstart', this, false);
if( window.Touch ) {
this.element.removeEventListener('touchstart', this.element.notouch, false);
this.element.notouch = this;
this.element.addEventListener('touchstart', this.element.notouch, false);
}
}
NoClickDelay.prototype = {
handleEvent: function(e) {