]>
git.saurik.com Git - cydia.git/blob - Cydia.app/package.js
679d1832c42e00e821d76b3b600a1cbb6ebffd77
2 "name": "MobileTerminal",
5 "name": "Allen Porter",
6 "address": "allen.porter@gmail.com"
8 //"depiction": "http://planet-iphones.com/repository/info/chromium1.3.php",
9 "depiction": "http://cydia.saurik.com/terminal.html",
10 "description": "this is a sample description",
11 "homepage": "http://cydia.saurik.com/terminal.html",
12 "installed": "286u-4",
13 "id": "mobileterminal",
14 "section": "Terminal Support",
17 "name": "Jay Freeman",
18 "address": "saurik@saurik.com"
21 "name": "Telesphoreo Tangelo",
22 "description": "Distribution of Unix Software for the iPhone"
26 function space(selector
, html
, max
) {
27 var node
= $(selector
);
29 var width
= node
.width();
31 var spacing
= (max
- node
.width()) / (html
.length
- 1) + "px";
32 console
.log(width
+ " " + max
+ " " + spacing
);
33 node
.css("letter-spacing", spacing
);
39 var rating = function () {
40 var rating
= package.rating
;
42 $(".rating").remove();
45 $.xhr('_' + rating
, 'GET', {}, null, {
46 success: function (value
) {
47 document
.getElementById("rating").contentWindow
.document
.write(value
);
50 failure: function (status
) {
51 $(".rating").remove();
57 var rating_ = function() {
60 else if (rated
== 1) {
68 var idc
= encodeURIComponent(id
);
69 var name
= package.name
;
70 var regarding
= encodeURIComponent("Cydia/APT: " + name
);
72 $("#icon").src("cydia://package-icon/" + idc
);
73 $("#reflection").src("cydia://package-icon/" + idc
);
75 $("#name").html(name
);
76 space("#latest", package.latest
, 93);
80 $("#settings").href("cydia://package-settings/" + idc
);
82 var warnings
= package.warnings
;
83 var length
= warnings
== null ? 0 : warnings
.length
;
85 $(".warnings").remove();
87 var parent
= $("#warnings");
88 var child
= $("#warning");
91 for (var i
= 0; i
!= length
; ++i
) {
92 var clone
= child
.clone(true);
94 clone
.xpath("./div/label").html($.xml(warnings
[i
]));
98 var applications
= package.applications
;
99 var length
= applications
== null ? 0 : applications
.length
;
101 var child
= $("#application");
105 var parent = $("#actions");
107 for (var i = 0; i != length; ++i) {
108 var application = applications[i];
109 var clone = child.clone(true);
110 parent.append(clone);
111 clone.href("cydia://launch/" + application[0]);
112 clone.xpath("label").html("Run " + $.xml(application[1]));
113 clone.xpath("img").src(application[2]);
117 var purposes
= package.purposes
;
118 var commercial
= false;
119 var _console
= false;
120 if (purposes
!= null)
121 for (var i
= 0, e
= purposes
.length
; i
!= e
; ++i
) {
122 var purpose
= purposes
[i
];
123 if (purpose
== "commercial")
125 else if (purpose
== "console")
129 $(".commercial").remove();
131 $(".console").remove();
133 var author
= package.author
;
135 $(".author").remove();
137 space("#author", author
.name
, 160);
138 if (author
.address
== null)
139 $("#author-icon").remove();
141 $("#author-href").href("mailto:" + author
.address
+ "?subject=" + regarding
);
144 //$("#notice-src").src("http://saurik.cachefly.net/notice/" + idc + ".html");
146 var depiction
= package.depiction
;
147 if (depiction
== null)
148 $(".depiction").remove();
150 $(".description").display("none");
151 $("#depiction-src").src(depiction
);
154 var description
= package.description
;
155 if (description
== null)
156 description
= package.tagline
;
158 description
= description
.replace(/\n/g, "<br/>");
159 $("#description").html(description
);
161 var homepage
= package.homepage
;
162 if (homepage
== null)
163 $(".homepage").remove();
165 $("#homepage-href").href(homepage
);
167 var installed
= package.installed
;
168 if (installed
== null)
169 $(".installed").remove();
171 $("#installed").html(installed
);
172 $("#files-href").href("cydia://files/" + idc
);
175 space("#id", id
, 220);
177 var section
= package.section
;
179 $(".section").remove();
181 $("#section-src").src("cydia://section-icon/" + encodeURIComponent(section
));
182 $("#section").html(section
);
185 var size
= package.size
;
189 $("#size").html(size
/ 1024 + " kB");
191 var maintainer
= package.maintainer
;
192 if (maintainer
== null)
193 $(".maintainer").remove();
195 space("#maintainer", maintainer
.name
, 153);
196 if (maintainer
.address
== null)
197 $("#maintainer-icon").remove();
199 $("#maintainer-href").href("mailto:" + maintainer
.address
+ "?subject=" + regarding
);
202 var sponsor
= package.sponsor
;
204 $(".sponsor").remove();
206 space("#sponsor", sponsor
.name
, 152);
207 $("#sponsor-href").href(sponsor
.address
);
210 var source
= package.source
;
211 if (source
== null) {
212 $(".source").remove();
213 $(".trusted").remove();
215 var host
= source
.host
;
217 $("#source-src").src("cydia://source-icon/" + encodeURIComponent(host
));
218 $("#source-name").html(source
.name
);
221 $("#trusted").href("cydia://package-signature/" + idc
);
223 $(".trusted").remove();
225 var description
= source
.description
;
226 if (description
== null)
227 $(".source-description").remove();
229 $("#source-description").html(description
);