]> git.saurik.com Git - cydia.git/commitdiff
Fixed HTML error handling and enhanced pinstriping.
authorJay Freeman (saurik) <saurik@saurk.com>
Tue, 9 Dec 2008 09:18:04 +0000 (09:18 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 30 Sep 2010 07:09:05 +0000 (07:09 +0000)
Cydia.app/menes/pinstripes.png [deleted file]
Cydia.app/menes/style.css
UICaboodle/BrowserView.h
UICaboodle/BrowserView.m

diff --git a/Cydia.app/menes/pinstripes.png b/Cydia.app/menes/pinstripes.png
deleted file mode 100644 (file)
index c997775..0000000
Binary files a/Cydia.app/menes/pinstripes.png and /dev/null differ
index 223c975e310214bb3e13ab9e3134a854b07addd9..b0674588fb79707e9ecc0a3e4ddc6679bb059a7f 100644 (file)
@@ -83,7 +83,7 @@ body {
 }
 
 body.pinstripe {
-    background: #c7ced5 url(pinstripes.png);
+    background: #c7ced5 url(cydia://uikit-image/UIPinstripe.png);
 }
 
 dialog {
index 3dcdb931208470e859bc91885dd1dfcb293d5942..a37d326b931bee04fab0d079d8e6e623f8cd6e26 100644 (file)
@@ -41,6 +41,8 @@
     UIProgressIndicator *indicator_;
     IndirectDelegate *indirect_;
     NSURLAuthenticationChallenge *challenge_;
+
+    bool error_;
     NSURLRequest *request_;
 
     NSNumber *confirm_;
index edaa2f2c2a7a07a6eb1195f33ae45d5b2738fd93..b3ed5909f23208b4d6eb3a80c267addbeb50af4b 100644 (file)
@@ -95,6 +95,7 @@
 
 - (void) loadRequest:(NSURLRequest *)request {
     pushed_ = true;
+    error_ = false;
     [webview_ loadRequest:request];
 }
 
         return;
 
     if ([request_ HTTPBody] == nil && [request_ HTTPBodyStream] == nil)
-        [webview_ loadRequest:request_];
+        [self loadRequest:request_];
     else {
         UIActionSheet *sheet = [[[UIActionSheet alloc]
             initWithTitle:@"Are you sure you want to submit this form again?"
     NSURL *url([request URL]);
 
     if (url == nil) use: {
-        if ([frame parentFrame] == nil) {
+        if (!error_ && [frame parentFrame] == nil) {
             if (request_ != nil)
                 [request_ autorelease];
             request_ = [request retain];
                     bool colored(false);
 
                     if (DOMCSSPrimitiveValue *color = static_cast<DOMCSSPrimitiveValue *>([style getPropertyCSSValue:@"background-color"])) {
-                        DOMRGBColor *rgb([color getRGBColorValue]);
-
-                        float alpha([[rgb alpha] getFloatValue:DOM_CSS_NUMBER]);
-                        NSLog(@"alpha:%g", alpha);
-
-                        if (alpha != 0) {
-                            colored = true;
-
-                            [scroller_ setBackgroundColor:[UIColor
-                                colorWithRed:([[rgb red] getFloatValue:DOM_CSS_NUMBER] / 255)
-                                green:([[rgb green] getFloatValue:DOM_CSS_NUMBER] / 255)
-                                blue:([[rgb blue] getFloatValue:DOM_CSS_NUMBER] / 255)
-                                alpha:alpha
-                            ]];
+                        if ([color primitiveType] == DOM_CSS_RGBCOLOR) {
+                            DOMRGBColor *rgb([color getRGBColorValue]);
+
+                            float red([[rgb red] getFloatValue:DOM_CSS_NUMBER]);
+                            float green([[rgb green] getFloatValue:DOM_CSS_NUMBER]);
+                            float blue([[rgb blue] getFloatValue:DOM_CSS_NUMBER]);
+                            float alpha([[rgb alpha] getFloatValue:DOM_CSS_NUMBER]);
+
+                            UIColor *uic(nil);
+
+                            if (red == 0xc7 && green == 0xce && blue == 0xd5)
+                                uic = [UIColor pinStripeColor];
+                            else if (alpha != 0)
+                                uic = [UIColor
+                                    colorWithRed:(red / 255)
+                                    green:(green / 255)
+                                    blue:(blue / 255)
+                                    alpha:alpha
+                                ];
+
+                            if (uic != nil) {
+                                colored = true;
+                                [scroller_ setBackgroundColor:uic];
+                            }
                         }
                     }
 
         [[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"error" ofType:@"html"]] absoluteString],
         [[error localizedDescription] stringByAddingPercentEscapes]
     ]]];
+
+    error_ = true;
 }
 
 - (void) webView:(WebView *)sender addMessageToConsole:(NSDictionary *)dictionary {