summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cydia.app/confirm.html45
-rw-r--r--Cydia.app/menes/style.css169
-rw-r--r--Cydia.app/package.html11
-rw-r--r--Cydia.app/package.js6
-rw-r--r--Cydia.mm108
5 files changed, 241 insertions, 98 deletions
diff --git a/Cydia.app/confirm.html b/Cydia.app/confirm.html
index a98a8d6..55fec23 100644
--- a/Cydia.app/confirm.html
+++ b/Cydia.app/confirm.html
@@ -6,31 +6,30 @@
<link rel="stylesheet" type="text/css" href="menes/style.css"/>
<script type="text/javascript" src="menes/menes.js"></script>
<script type="text/javascript" src="confirm.js"></script>
-</head><body><div class="page">
-<div class="dialog">
- <div class="panel" id="panel">
- <label>Statistics</label>
- <fieldset>
- <div class="downloading">
- <label>Downloading</label>
- <div id="downloading"></div>
- </div>
+</head><body>
+<dialog><panel>
- <div class="resuming">
- <label>Resuming At</label>
- <div id="resuming"></div>
- </div>
+<label>Statistics</label>
+<fieldset>
+ <div class="downloading">
+ <label>Downloading</label>
+ <div id="downloading"></div>
+ </div>
- <div>
- <label id="disk-key"></label>
- <div id="disk-value"></div>
- </div>
- </fieldset>
+ <div class="resuming">
+ <label>Resuming At</label>
+ <div id="resuming"></div>
+ </div>
- <label>Modifications</label>
- <fieldset id="modifications">
- </fieldset>
+ <div>
+ <label id="disk-key"></label>
+ <div id="disk-value"></div>
</div>
-</div>
+</fieldset>
+
+<label>Modifications</label>
+<fieldset id="modifications">
+</fieldset>
-</div></body></html>
+</panel></dialog>
+</body></html>
diff --git a/Cydia.app/menes/style.css b/Cydia.app/menes/style.css
index 5d1faa7..a0bb3d2 100644
--- a/Cydia.app/menes/style.css
+++ b/Cydia.app/menes/style.css
@@ -51,63 +51,76 @@
/* }}} */
* {
+ border: 0;
+ -webkit-border-radius: 0;
box-sizing: border-box;
-moz-box-sizing: border-box;
+ font-family: inherit;
+ font-size: 100%;
+ font-style: inherit;
+ font-weight: inherit;
+ margin: 0;
+ outline: 0;
+ padding: 0;
+ vertical-align: baseline;
+}
+
+select {
+ border: 1px solid #999999;
}
body {
font-family: Helvetica;
- margin: 0;
- padding: 0;
-webkit-text-size-adjust: none;
-webkit-user-select: none;
}
-#page {
- position: relative;
+body.pinstripe {
+ background: #c7ced5 url(pinstripes.png);
}
-.dialog {
+dialog {
+ display: block;
position: absolute;
width: 100%;
}
-hr {
- margin: 0;
-}
-
-.dialog > .panel {
- background: #c7ced5 url(pinstripes.png);
- padding: 1px 0 1px 0;
-}
-
-p {
- margin: 0px;
- padding: 0px;
+dialog > panel {
+ display: block;
+ padding: 1px 0;
}
a {
+ color: inherit;
text-decoration: none;
text-underline-style: dotted;
}
+a {
+ color: blue;
+}
+
strong {
font-weight: bold
}
+pre, tt {
+ font-family: monospace;
+}
+
pre {
letter-spacing: -2px;
}
/* #toolbar {{{ */
-.dialog > .toolbar {
+dialog > toolbar {
background: url(toolbar.png) #6d84a2 repeat-x;
border-bottom: 1px solid #2d3642;
height: 45px;
padding: 10px;
}
-.dialog > .toolbar > h1 {
+dialog > toolbar > h1 {
color: #ffffff;
font-size: 20px;
font-weight: bold;
@@ -119,8 +132,8 @@ pre {
}
/* }}} */
/* (back|forward)-button {{{ */
-.dialog > .toolbar > a.back-button,
-.dialog > .toolbar > a.forward-button {
+dialog > toolbar > a.back-button,
+dialog > toolbar > a.forward-button {
color: #ffffff;
font-size: 12px;
font-weight: bold;
@@ -133,20 +146,20 @@ pre {
white-space: nowrap;
}
-.dialog > .toolbar > a.back-button {
+dialog > toolbar > a.back-button {
-webkit-border-image: url(backButton.png) 0 8 0 14;
border-width: 0 8px 0 14px;
float: left;
}
-.dialog > .toolbar > a.forward-button {
+dialog > toolbar > a.forward-button {
-webkit-border-image: url(toolButton.png) 0 5 0 5;
border-width: 0 5px;
float: right;
}
/* }}} */
/* fieldset {{{ */
-.dialog > .panel > block {
+dialog > panel > block {
background-color: #c7ced5;
border-bottom: 1px solid #999999;
border-top: 1px solid #999999;
@@ -156,20 +169,19 @@ pre {
padding: 0 10px;
}
-.dialog > .panel > block > hr {
+dialog > panel > block > hr {
border-width: 1px 0 0 0;
}
-.dialog > .panel > fieldset {
+dialog > panel > fieldset {
background-color: #ffffff;
border: 1px solid #999999;
-webkit-border-radius: 10px;
font-size: 16px;
margin: 9px;
- padding: 0;
}
-.dialog > .panel > label {
+dialog > panel > label {
display: block;
margin: 13px 0 -4px 27px;
line-height: 24px;
@@ -179,20 +191,21 @@ pre {
text-shadow: rgba(255, 255, 255, 0.75) 1px 1px 0;
}
-.dialog > .panel > fieldset > a,
-.dialog > .panel > fieldset > div {
+fieldset > a,
+fieldset > div,
+fieldset > textarea {
border-top: 1px solid #999999;
min-height: 19px;
padding: 12px 17px 11px 17px;
}
-.dialog > .panel > fieldset > a:first-child,
-.dialog > .panel > fieldset > div:first-child {
+fieldset > a:first-child,
+fieldset > div:first-child {
border-top: none;
}
-.dialog > .panel > fieldset > a img.icon,
-.dialog > .panel > fieldset > div img.icon {
+fieldset > a img.icon,
+fieldset > div img.icon {
height: auto;
margin: -13px 5px -10px -10px;
max-height: 30px;
@@ -200,50 +213,94 @@ pre {
width: 30px;
}
-.dialog > .panel > block > p,
-.dialog > .panel > fieldset > div > p {
+panel > block > p,
+fieldset > div > p {
margin: 11px 0;
text-align: center;
}
-.dialog > .panel > fieldset > div > ul {
+fieldset > div > ul {
margin-left: -20px;
}
-.dialog > .panel > fieldset > div > p:first-child,
-.dialog > .panel > fieldset > div > ul:first-child {
+fieldset > div > p:first-child,
+fieldset > div > ul:first-child {
margin-top: 0;
}
-.dialog > .panel > fieldset > div > p:last-child,
-.dialog > .panel > fieldset > div > ul:last-child {
+fieldset > div > p:last-child,
+fieldset > div > ul:last-child {
margin-bottom: 0;
}
-.dialog > .panel > fieldset > a {
+dialog > fieldset > a {
+ background: 295px 13px no-repeat url(listArrow.png);
+}
+
+dialog > panel > fieldset > a {
background: 275px 13px no-repeat url(listArrow.png);
+}
+
+fieldset > a {
color: inherit;
display: block;
}
-.dialog > .panel > fieldset > div > select {
- font-size: 16px;
+dialog > fieldset > div > select {
+ background: none;
+ margin: -13px -17px -13px 86px;
+ border-left: 0;
+ border-right: 0;
+ height: 44px;
+ width: 217px;
+}
+
+dialog > panel > fieldset > div > select {
margin: -5px -10px -5px 86px;
+ -webkit-border-radius: 5px;
width: 190px;
}
-.dialog > .panel > fieldset > div > input {
+fieldset > textarea,
+fieldset > div > input {
background: none;
- border: none;
+}
+
+fieldset > textarea,
+fieldset > div > input,
+fieldset > div > select,
+fieldset > a > label + div,
+fieldset > div > label + div {
color: #193250;
+}
+
+fieldset > textarea,
+fieldset > div > input,
+fieldset > div > select {
font-size: 16px;
+}
+
+fieldset > div > input {
+ border: none;
height: 45px;
margin: -13px -18px;
padding: 13px 10px 0 111px;
+}
+
+fieldset > textarea {
+ padding: 10px;
+ width: 320px;
+}
+
+dialog > panel > fieldset > div > input {
width: 302px;
}
-.dialog > .panel > fieldset > div > input[type="submit"] {
+dialog > fieldset > div > input {
+ width: 320px;
+}
+
+fieldset > div > input[type="submit"] {
border-width: 0 12px;
color: #000000;
display: block;
@@ -254,25 +311,29 @@ pre {
-webkit-border-image: url(whiteButton.png) 0 12 0 12;
}
-.dialog > .panel > fieldset > a > label,
-.dialog > .panel > fieldset > div > label {
+fieldset > a > label,
+fieldset > div > label {
font-weight: bold;
padding: 1px 0 0 0;
position: absolute;
}
-.dialog > .panel > fieldset > a > label + div {
+fieldset > a > label + div {
margin-right: 16px;
}
-.dialog > .panel > fieldset > a > label + div,
-.dialog > .panel > fieldset > div > label + div {
- color: #335588;
+dialog > fieldset > a > label + div,
+dialog > fieldset > div > label + div {
+ margin-left: 94px;
+}
+
+dialog > panel > fieldset > a > label + div,
+dialog > panel > fieldset > div > label + div {
float: right;
text-align: right;
}
-.dialog > .panel > img {
+dialog > panel > img {
display: block;
margin: 9px auto 4px auto;
height: auto;
diff --git a/Cydia.app/package.html b/Cydia.app/package.html
index 880439d..3b0d7ba 100644
--- a/Cydia.app/package.html
+++ b/Cydia.app/package.html
@@ -142,9 +142,8 @@
padding: 10px;
}
</style>
-</head><body><div class="page">
-<div class="dialog">
- <div class="panel">
+</head><body>
+<dialog><panel>
<fieldset id="header">
<div class="clearfix">
@@ -160,6 +159,7 @@
<div id="latest"></div>
<iframe
+ class="rating"
id="rating"
frameborder="0"
height="0"
@@ -306,6 +306,5 @@
<div class="source-description" id="source-description"></div>
</fieldset>
- </div>
-</div>
-</div></body></html>
+</panel></dialog>
+</body></html>
diff --git a/Cydia.app/package.js b/Cydia.app/package.js
index cd1667e..fc8e218 100644
--- a/Cydia.app/package.js
+++ b/Cydia.app/package.js
@@ -46,7 +46,11 @@ $(function () {
$("#name").html(name);
space("#latest", package.latest, 93);
- $("#rating").src("http://cydia.saurik.com/test_.html");
+ var rating = package.rating;
+ if (rating == null)
+ $(".rating").remove();
+ else
+ $("#rating").src(rating);
$("#settings").href("cydia://package-settings/" + idc);
diff --git a/Cydia.mm b/Cydia.mm
index f59dcc8..0f52d28 100644
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -52,13 +52,18 @@
// XXX: remove
#import <MessageUI/MailComposeController.h>
-#import <WebCore/WebScriptObject.h>
-//#include <WebCore/DOMHTML.h>
+#include <WebKit/DOMCSSPrimitiveValue.h>
+#include <WebKit/DOMCSSStyleDeclaration.h>
+#include <WebKit/DOMDocument.h>
+#include <WebKit/DOMHTMLBodyElement.h>
+#include <WebKit/DOMNodeList.h>
+#include <WebKit/DOMRGBColor.h>
#include <WebKit/WebFrame.h>
#include <WebKit/WebPolicyDelegate.h>
-#include <WebKit/WebView.h>
+#include <WebKit/WebScriptObject.h>
+#import <WebKit/WebView.h>
#import <WebKit/WebView-WebPrivate.h>
#include <sstream>
@@ -261,10 +266,10 @@ extern NSString * const kCAFilterNearest;
#define lprintf(args...) fprintf(stderr, args)
-#define ForRelease 1
-#define ForSaurik 1 && !ForRelease
+#define ForRelease 0
+#define ForSaurik (1 && !ForRelease)
#define RecycleWebViews 0
-#define AlwaysReload 1 && !ForRelease
+#define AlwaysReload (1 && !ForRelease)
/* Radix Sort {{{ */
@interface NSMutableArray (Radix)
@@ -382,6 +387,19 @@ typedef enum {
kUIControlAllEvents = (kUIControlEventMouseDown | kUIControlEventMouseMovedInside | kUIControlEventMouseMovedOutside | kUIControlEventMouseUpInside | kUIControlEventMouseUpOutside)
} UIControlEventMasks;
+NSUInteger DOMNodeList$countByEnumeratingWithState$objects$count$(DOMNodeList *self, SEL sel, NSFastEnumerationState *state, id *objects, NSUInteger count) {
+ size_t length([self length] - state->state);
+ if (length <= 0)
+ return 0;
+ else if (length > count)
+ length = count;
+ for (size_t i(0); i != length; ++i)
+ objects[i] = [self item:state->state++];
+ state->itemsPtr = objects;
+ state->mutationsPtr = (unsigned long *) self;
+ return length;
+}
+
@interface NSString (UIKit)
- (NSString *) stringByAddingPercentEscapes;
- (NSString *) stringByReplacingCharacter:(unsigned short)arg0 withCharacter:(unsigned short)arg1;
@@ -632,6 +650,7 @@ bool reload_;
static NSDictionary *SectionMap_;
static NSMutableDictionary *Metadata_;
+static NSMutableDictionary *Indices_;
static _transient NSMutableDictionary *Settings_;
static _transient NSString *Role_;
static _transient NSMutableDictionary *Packages_;
@@ -1225,6 +1244,7 @@ class Progress :
- (Source *) source;
- (NSString *) role;
+- (NSString *) rating;
- (BOOL) matches:(NSString *)text;
@@ -1287,7 +1307,7 @@ class Progress :
}
+ (NSArray *) _attributeKeys {
- return [NSArray arrayWithObjects:@"applications", @"author", @"depiction", @"description", @"essential", @"homepage", @"icon", @"id", @"installed", @"latest", @"maintainer", @"name", @"purposes", @"section", @"size", @"source", @"sponsor", @"tagline", @"warnings", nil];
+ return [NSArray arrayWithObjects:@"applications", @"author", @"depiction", @"description", @"essential", @"homepage", @"icon", @"id", @"installed", @"latest", @"maintainer", @"name", @"purposes", @"rating", @"section", @"size", @"source", @"sponsor", @"tagline", @"warnings", nil];
}
- (NSArray *) attributeKeys {
@@ -1791,6 +1811,13 @@ class Progress :
return role_;
}
+- (NSString *) rating {
+ if (NSString *pattern = [Indices_ objectForKey:@"Rating"])
+ return [pattern stringByReplacingOccurrencesOfString:@"%@" withString:[id_ stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
+ else
+ return nil;
+}
+
- (BOOL) matches:(NSString *)text {
if (text == nil)
return NO;
@@ -3845,7 +3872,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
- (void) webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
- [[frame windowObject] evaluateWebScript:@"document.base.target = '_top'"];
return [super webView:sender didFinishLoadForFrame:frame];
}
@@ -4777,6 +4803,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
/* }}} */
/* Browser Implementation {{{ */
@implementation BrowserView
+#include "internals.h"
- (void) dealloc {
if (challenge_ != nil)
@@ -4815,6 +4842,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[scroller_ setDelegate:nil];
+ [background_ release];
[scroller_ release];
[urls_ release];
[indicator_ release];
@@ -4917,8 +4945,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[window setValue:delegate_ forKey:@"cydia"];
}
-- (void) webView:(WebView *)sender decidePolicyForNewWindowAction:(NSDictionary *)dictionary request:(NSURLRequest *)request newFrameName:(NSString *)name decisionListener:(id<WebPolicyDecisionListener>)listener {
+- (void) webView:(WebView *)sender decidePolicyForNewWindowAction:(NSDictionary *)action request:(NSURLRequest *)request newFrameName:(NSString *)name decisionListener:(id<WebPolicyDecisionListener>)listener {
if (NSURL *url = [request URL]) {
+ NSLog(@"win:%@:%@", url, [action description]);
if (![self getSpecial:url]) {
NSString *scheme([[url scheme] lowercaseString]);
if ([scheme isEqualToString:@"mailto"])
@@ -4949,6 +4978,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[listener use];
return;
}
+ else NSLog(@"nav:%@:%@", url, [action description]);
const NSArray *capability(reinterpret_cast<const NSArray *>(GSSystemGetCapability(kGSDisplayIdentifiersCapability)));
@@ -5176,9 +5206,53 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
return [webview_ webView:sender didReceiveDocTypeForFrame:frame];
}
+- (void) _clearBackground {
+ [background_ setBackgroundColor:[UIColor pinStripeColor]];
+ [background_ setImage:[UIImage applicationImageNamed:@"pinstripe.png"]];
+ [scroller_ setShowBackgroundShadow:NO];
+}
+
- (void) webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
- if ([frame parentFrame] == nil)
+ if ([frame parentFrame] == nil) {
[self _finishLoading];
+
+ [self _clearBackground];
+
+ if (DOMDocument *document = [frame DOMDocument])
+ if (DOMNodeList<NSFastEnumeration> *bodies = [document getElementsByTagName:@"body"])
+ for (DOMHTMLBodyElement *body in bodies) {
+ DOMCSSStyleDeclaration *style([document getComputedStyle:body pseudoElement:nil]);
+
+ 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]);
+ if (alpha != 0) {
+ colored = true;
+
+ [background_ 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 (DOMCSSPrimitiveValue *image = static_cast<DOMCSSPrimitiveValue *>([style getPropertyCSSValue:@"background-image"])) {
+ NSString *src([image getStringValue]);
+ if ([src isEqualToString:@"none"])
+ goto none;
+ NSLog(@"img:%@", [image getStringValue]);
+ } else none: if (colored)
+ [background_ setImage:nil];
+
+ break;
+ }
+ }
+
return [webview_ webView:sender didFinishLoadForFrame:frame];
}
@@ -5205,9 +5279,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
struct CGRect bounds = [self bounds];
- UIImageView *pinstripe = [[[UIImageView alloc] initWithFrame:bounds] autorelease];
- [pinstripe setImage:[UIImage applicationImageNamed:@"pinstripe.png"]];
- [self addSubview:pinstripe];
+ background_ = [[UIImageView alloc] initWithFrame:bounds];
+ [self _clearBackground];
+ [self addSubview:background_];
scroller_ = [[UIScroller alloc] initWithFrame:bounds];
[self addSubview:scroller_];
@@ -5237,6 +5311,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
#endif
webview_ = [[UIWebDocumentView alloc] initWithFrame:webrect];
webview = [webview_ webView];
+ [webview_ setDrawsBackground:NO];
[webview_ setTileSize:CGSizeMake(webrect.size.width, 500)];
@@ -5295,8 +5370,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
urls_ = [[NSMutableArray alloc] initWithCapacity:16];
[self setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
+ [background_ setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
[scroller_ setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
- [pinstripe setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
} return self;
}
@@ -7452,6 +7527,8 @@ id Dealloc_(id self, SEL selector) {
}*/
int main(int argc, char *argv[]) { _pooled
+ class_addMethod(objc_getClass("DOMNodeList"), @selector(countByEnumeratingWithState:objects:count:), (IMP) &DOMNodeList$countByEnumeratingWithState$objects$count$, "I20@0:4^{NSFastEnumerationState}8^@12I16");
+
bool substrate(false);
if (argc != 0) {
@@ -7529,6 +7606,9 @@ int main(int argc, char *argv[]) { _pooled
/*AddPreferences(@"/Applications/Preferences.app/Settings-iPhone.plist");
AddPreferences(@"/Applications/Preferences.app/Settings-iPod.plist");*/
+ if ((Indices_ = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/var/lib/cydia/indices.plist"]) == NULL)
+ Indices_ = [[NSMutableDictionary alloc] init];
+
if ((Metadata_ = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/var/lib/cydia/metadata.plist"]) == NULL)
Metadata_ = [[NSMutableDictionary alloc] initWithCapacity:2];
else {