]>
git.saurik.com Git - cydia.git/blob - Cydia.app/package.js
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 node
.css("letter-spacing", spacing
);
37 return url
.replace('://', '://ne.edgecastcdn.net/8003A4/');
40 var swap_
, swap = function (on
, off
, time
) {
41 setTimeout(swap_(on
, off
, time
), time
);
44 swap_ = function (on
, off
, time
) {
46 on
.className
= 'fade-out';
47 off
.className
= 'fade-in';
54 var idc
= encodeURIComponent(id
);
55 var name
= package.name
;
56 var regarding
= encodeURIComponent("Cydia/APT: " + name
);
57 var icon
= 'cydia://package-icon/' + idc
;
58 var api
= 'http://cydia.saurik.com/api/';
60 $("#icon").css("background-image", 'url("' + icon
+ '")');
61 $("#reflection").src("cydia://package-icon/" + idc
);
63 $("#name").html(name
);
64 space("#latest", package.latest
, 96);
66 $.xhr((api
+ 'package_/' + idc
), 'GET', {}, null, {
67 success: function (value
) {
70 if (typeof value
.rating
== "undefined")
71 $(".rating").remove();
73 $("#rating-load").remove();
74 $("#rating-href").href(value
.reviews
);
76 var none
= $("#rating-none");
77 var done
= $("#rating-done");
79 if (value
.rating
== null) {
81 none
.css("display", "block");
84 done
.css("display", "block");
86 $("#rating-value").css('width', 16 * value
.rating
);
90 if (typeof value
.icon
!= "undefined" && value
.icon
!= null) {
91 var icon
= $("#icon");
92 var thumb
= $("#thumb");
94 icon
[0].className
= 'flip-180';
95 thumb
[0].className
= 'flip-360';
97 thumb
.css("background-image", 'url("' + value
.icon
+ '")');
99 setTimeout(function () {
100 icon
.css("display", "none");
101 thumb
[0].className
= 'flip-0';
106 failure: function (status
) {
107 $(".rating").remove();
111 $("#settings").href("cydia://package-settings/" + idc
);
113 var warnings
= package.warnings
;
114 var length
= warnings
== null ? 0 : warnings
.length
;
116 $(".warnings").remove();
118 var parent
= $("#warnings");
119 var child
= $("#warning");
122 for (var i
= 0; i
!= length
; ++i
) {
123 var clone
= child
.clone(true);
124 parent
.append(clone
);
125 clone
.xpath("./div/label").html($.xml(warnings
[i
]));
129 var applications
= package.applications
;
130 var length
= applications
== null ? 0 : applications
.length
;
132 var child
= $("#application");
136 var parent = $("#actions");
138 for (var i = 0; i != length; ++i) {
139 var application = applications[i];
140 var clone = child.clone(true);
141 parent.append(clone);
142 clone.href("cydia://launch/" + application[0]);
143 clone.xpath("label").html("Run " + $.xml(application[1]));
144 clone.xpath("img").src(application[2]);
148 var purposes
= package.purposes
;
149 var commercial
= false;
150 var _console
= false;
151 if (purposes
!= null)
152 for (var i
= 0, e
= purposes
.length
; i
!= e
; ++i
) {
153 var purpose
= purposes
[i
];
154 if (purpose
== "commercial")
156 else if (purpose
== "console")
160 $(".commercial").remove();
162 $(".console").remove();
164 var author
= package.author
;
166 $(".author").remove();
168 space("#author", author
.name
, 160);
169 if (author
.address
== null)
170 $("#author-icon").remove();
172 $("#author-href").href("mailto:" + author
.address
+ "?subject=" + regarding
);
175 //$("#notice-src").src("http://saurik.cachefly.net/notice/" + idc + ".html");
177 var depiction
= package.depiction
;
178 if (depiction
== null)
179 $(".depiction").remove();
181 $(".description").css("display", "none");
182 $("#depiction-src").src(depiction
);
185 var description
= package.description
;
186 if (description
== null)
187 description
= package.tagline
;
189 description
= description
.replace(/\n/g, "<br/>");
190 $("#description").html(description
);
192 var homepage
= package.homepage
;
193 if (homepage
== null)
194 $(".homepage").remove();
196 $("#homepage-href").href(homepage
);
198 var installed
= package.installed
;
199 if (installed
== null)
200 $(".installed").remove();
202 $("#installed").html(installed
);
203 $("#files-href").href("cydia://files/" + idc
);
206 space("#id", id
, 220);
208 var section
= package.section
;
210 $(".section").remove();
212 $("#section-src").src("cydia://section-icon/" + encodeURIComponent(section
));
213 $("#section").html(section
);
216 var size
= package.size
;
220 $("#size").html(size
/ 1024 + " kB");
222 var maintainer
= package.maintainer
;
223 if (maintainer
== null)
224 $(".maintainer").remove();
226 space("#maintainer", maintainer
.name
, 153);
227 if (maintainer
.address
== null)
228 $("#maintainer-icon").remove();
230 $("#maintainer-href").href("mailto:" + maintainer
.address
+ "?subject=" + regarding
);
233 var sponsor
= package.sponsor
;
235 $(".sponsor").remove();
237 space("#sponsor", sponsor
.name
, 152);
238 $("#sponsor-href").href(sponsor
.address
);
241 var source
= package.source
;
242 if (source
== null) {
243 $(".source").remove();
244 $(".trusted").remove();
246 var host
= source
.host
;
248 $("#source-src").src("cydia://source-icon/" + encodeURIComponent(host
));
249 $("#source-name").html(source
.name
);
252 $("#trusted").href("cydia://package-signature/" + idc
);
254 $(".trusted").remove();
256 var description
= source
.description
;
257 if (description
== null)
258 $(".source-description").remove();
260 $("#source-description").html(description
);