]> git.saurik.com Git - cydia.git/commitdiff
Added support for JavaScript alert().
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 20 Oct 2008 17:50:42 +0000 (17:50 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 30 Sep 2010 07:08:51 +0000 (07:08 +0000)
Cydia.mm

index b7622dfe7657ea5387a36799d2b2e1143a028d95..f59dcc8549592f44686ecd91bd8cd18f8d4f3015 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -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) {