diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2008-10-20 17:50:42 +0000 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2010-09-30 07:08:51 +0000 |
commit | ff0210e56e5eefeff6bfba03e5a07694e7aa0008 (patch) | |
tree | 2aff429d8aa2f53467d65a764d423dc0d464ed0b | |
parent | 16f2786b1b8cd214a4557cfe287980d35ed24c1f (diff) |
Added support for JavaScript alert().
-rw-r--r-- | Cydia.mm | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -4900,6 +4900,19 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { return true; } +- (void) webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame { + UIActionSheet *sheet = [[[UIActionSheet alloc] + initWithTitle:@"JavaScript Alert" + buttons:[NSArray arrayWithObjects:@"OK", nil] + defaultButtonIndex:0 + delegate:self + context:@"alert" + ] autorelease]; + + [sheet setBodyText:message]; + [sheet popupAlertAnimated:YES]; +} + - (void) webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame { [window setValue:delegate_ forKey:@"cydia"]; } @@ -4998,7 +5011,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (void) alertSheet:(UIActionSheet *)sheet buttonClicked:(int)button { NSString *context([sheet context]); - if ([context isEqualToString:@"challenge"]) { + if ([context isEqualToString:@"alert"]) + [sheet dismiss]; + else if ([context isEqualToString:@"challenge"]) { id<NSURLAuthenticationChallengeSender> sender([challenge_ sender]); switch (button) { |