Skip to content

Commit

Permalink
Basic Readability support, button in the actions menu. Calling javasc…
Browse files Browse the repository at this point in the history
…ript from bookmarklet.
  • Loading branch information
galonsky committed Apr 8, 2011
1 parent c779b7c commit 320ace6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Classes/Controllers/BrowserController.h
Expand Up @@ -10,6 +10,8 @@
#import "InstapaperSession.h"
#import "InstapaperLoginController.h"

#define kReadabilityJavascript @"(function(){window.baseUrl='https://www.readability.com';window.readabilityToken='';var s=document.createElement('script');s.setAttribute('type','text/javascript');s.setAttribute('charset','UTF-8');s.setAttribute('src',baseUrl+'/bookmarklet/read.js');document.documentElement.appendChild(s);})()"

@interface BrowserController : UIViewController <UIWebViewDelegate, UIActionSheetDelegate, InstapaperRequestDelegate, LoginControllerDelegate> {
UIWebView *webview;
UIToolbar *toolbar;
Expand Down
6 changes: 5 additions & 1 deletion Classes/Controllers/BrowserController.m
Expand Up @@ -144,6 +144,10 @@ - (void)actionSheet:(UIActionSheet *)action clickedButtonAtIndex:(NSInteger)butt
[navigation setViewControllers:[NSArray arrayWithObject:login]];
[self presentModalViewController:[navigation autorelease] animated:YES];
}
} else if (buttonIndex == first + 3) {
NSLog(@"%@", @"here");
NSString *result = [webview stringByEvaluatingJavaScriptFromString:kReadabilityJavascript];
NSLog(@"%@", result);
}
}

Expand All @@ -169,7 +173,7 @@ - (void)showShareMenu {
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Open with Safari", @"Copy Link", @"Read Later", nil
otherButtonTitles:@"Open with Safari", @"Copy Link", @"Read Later", @"Readability", nil
];

[action showInView:[[self navigationController] view]];
Expand Down

0 comments on commit 320ace6

Please sign in to comment.