From f4772bd1011235a2bd777ed6236f6f8041335eae Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Tue, 9 Dec 2008 09:18:04 +0000 Subject: [PATCH 1/1] Fixed HTML error handling and enhanced pinstriping. --- Cydia.app/menes/pinstripes.png | Bin 117 -> 0 bytes Cydia.app/menes/style.css | 2 +- UICaboodle/BrowserView.h | 2 ++ UICaboodle/BrowserView.m | 45 +++++++++++++++++++++------------ 4 files changed, 32 insertions(+), 17 deletions(-) delete mode 100644 Cydia.app/menes/pinstripes.png diff --git a/Cydia.app/menes/pinstripes.png b/Cydia.app/menes/pinstripes.png deleted file mode 100644 index c99777512fb135af7dcdf4130e5770072cb39241..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 117 zcmeAS@N?(olHy`uVBq!ia0vp^>_E)O!2~4dW-8AFQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>Jio`u#978H@CD~Lx<6>s|lboE)9K^uL#$fKtT%LaBX8=$M NgQu&X%Q~loCIB>$9?k#& diff --git a/Cydia.app/menes/style.css b/Cydia.app/menes/style.css index 223c975e..b0674588 100644 --- a/Cydia.app/menes/style.css +++ b/Cydia.app/menes/style.css @@ -83,7 +83,7 @@ body { } body.pinstripe { - background: #c7ced5 url(pinstripes.png); + background: #c7ced5 url(cydia://uikit-image/UIPinstripe.png); } dialog { diff --git a/UICaboodle/BrowserView.h b/UICaboodle/BrowserView.h index 3dcdb931..a37d326b 100644 --- a/UICaboodle/BrowserView.h +++ b/UICaboodle/BrowserView.h @@ -41,6 +41,8 @@ UIProgressIndicator *indicator_; IndirectDelegate *indirect_; NSURLAuthenticationChallenge *challenge_; + + bool error_; NSURLRequest *request_; NSNumber *confirm_; diff --git a/UICaboodle/BrowserView.m b/UICaboodle/BrowserView.m index edaa2f2c..b3ed5909 100644 --- a/UICaboodle/BrowserView.m +++ b/UICaboodle/BrowserView.m @@ -95,6 +95,7 @@ - (void) loadRequest:(NSURLRequest *)request { pushed_ = true; + error_ = false; [webview_ loadRequest:request]; } @@ -104,7 +105,7 @@ 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?" @@ -294,7 +295,7 @@ 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]; @@ -592,20 +593,30 @@ bool colored(false); if (DOMCSSPrimitiveValue *color = static_cast([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]; + } } } @@ -627,6 +638,8 @@ [[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"error" ofType:@"html"]] absoluteString], [[error localizedDescription] stringByAddingPercentEscapes] ]]]; + + error_ = true; } - (void) webView:(WebView *)sender addMessageToConsole:(NSDictionary *)dictionary { -- 2.45.2