]>
git.saurik.com Git - cydia.git/blob - MobileCydia.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 "longDescription": "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
);
36 var swap_
, swap = function (on
, off
, time
) {
37 setTimeout(swap_(on
, off
, time
), time
);
40 swap_ = function (on
, off
, time
) {
42 on
.className
= 'fade-out';
43 off
.className
= 'fade-in';
53 var idc
= encodeURIComponent(id
);
54 var name
= package.name
;
55 var icon
= 'cydia://package-icon/' + idc
;
57 var api
= 'http://cydia.saurik.com/api/';
58 var capi
= 'http://cache.cydia.saurik.com/api/';
60 var support
= package.support
;
62 var regarding = function (type
) {
63 return encodeURIComponent("Cydia/APT(" + type
+ "): " + name
);
66 $("#icon").css("background-image", 'url("' + icon
+ '")');
67 //$("#reflection").src("cydia://package-icon/" + idc);
69 $("#name").html($.xml(name
));
70 space("#latest", $.xml(package.latest
), 96);
72 $.xhr(capi
+ 'package/' + idc
, 'GET', {}, null, {
73 success: function (value
) {
76 if (typeof value
.notice
== "undefined")
77 $(".notice").addClass("deleted");
79 $("#notice-src").src(value
.notice
);
81 if (typeof value
.rating
== "undefined")
82 $(".rating").addClass("deleted");
84 $("#rating-load").addClass("deleted");
85 $("#rating-href").href(value
.reviews
);
87 var none
= $("#rating-none");
88 var done
= $("#rating-done");
90 if (value
.rating
== null) {
91 none
.css("display", "block");
93 done
.css("display", "block");
95 $("#rating-value").css('width', 16 * value
.rating
);
99 if (typeof value
.icon
!= "undefined" && value
.icon
!= null) {
100 var icon
= $("#icon");
101 var thumb
= $("#thumb");
103 icon
[0].className
= 'flip-180';
104 thumb
[0].className
= 'flip-360';
106 thumb
.css("background-image", 'url("' + value
.icon
+ '")');
108 setTimeout(function () {
109 icon
.addClass("deleted");
110 thumb
[0].className
= 'flip-0';
115 failure: function (status
) {
116 $(".rating").addClass("deleted");
120 $("#settings").href("cydia://package-settings/" + idc
);
122 var mode
= package.mode
;
124 $(".mode").addClass("deleted");
126 $("#mode").html(cydia
.localize(mode
));
127 $("#mode-src").src("Modes/" + mode
+ ".png");
130 var warnings
= package.warnings
;
131 var length
= warnings
== null ? 0 : warnings
.length
;
133 $(".warnings").addClass("deleted");
135 var parent
= $("#warnings");
136 var child
= $("#warning");
138 for (var i
= 0; i
!= length
; ++i
) {
139 var clone
= child
.clone(true);
140 clone
.addClass("inserted");
141 parent
.append(clone
);
142 clone
.xpath("./div/label").html($.xml(warnings
[i
]));
145 child
.addClass("deleted");
148 var applications
= package.applications
;
149 var length
= applications
== null ? 0 : applications
.length
;
151 var child
= $("#application");
154 var parent = $("#actions");
156 for (var i = 0; i != length; ++i) {
157 var application = applications[i];
158 var clone = child.clone(true);
159 parent.append(clone);
160 clone.href("cydia://launch/" + application[0]);
161 clone.xpath("label").html("Run " + $.xml(application[1]));
162 clone.xpath("img").src(application[2]);
166 child
.addClass("deleted");
168 var commercial
= package.hasTag('cydia::commercial');
170 $(".commercial").addClass("deleted");
172 var _console
= package.hasTag('purpose::console');
174 $(".console").addClass("deleted");
176 var author
= package.author
;
178 $(".author").addClass("deleted");
180 space("#author", $.xml(author
.name
), 160);
181 if (author
.address
== null)
182 $("#author-icon").addClass("deleted");
183 else if (support
== null)
184 $("#author-href").href("mailto:" + author
.address
+ "?subject=" + regarding("A"));
186 $("#author-href").href(support
);
189 /*var store = commercial;
191 $(".activation").addClass("deleted");
193 var activation = api + 'activation/' + idc;
194 $("#activation-src").src(activation);
197 var depiction
= package.depiction
;
198 if (depiction
!= null) {
199 $(".description").addClass("deleted");
200 $("#depiction-src").src(depiction
);
202 $(".depiction").addClass("deleted");
204 var description
= package.longDescription
;
205 if (description
== null)
206 description
= package.shortDescription
;
208 if (description
== null)
209 $(".description").addClass("deleted");
211 description
= $.xml(description
).replace(/\n/g, "<br/>");
212 $("#description").html(description
);
216 var homepage
= package.homepage
;
217 if (homepage
== null)
218 $(".homepage").addClass("deleted");
220 $("#homepage-href").href(homepage
);
222 var installed
= package.installed
;
223 if (installed
== null)
224 $(".installed").addClass("deleted");
226 $("#installed").html($.xml(installed
));
227 $("#files-href").href("cydia://files/" + idc
);
230 space("#id", $.xml(id
), 220);
232 var section
= package.longSection
;
234 $(".section").addClass("deleted");
236 $("#section-src").src("cydia://section-icon/" + encodeURIComponent(section
));
237 $("#section").html($.xml(section
));
240 var size
= package.size
;
242 $(".size").addClass("deleted");
244 $("#size").html(size
/ 1024 + " kB");
246 var maintainer
= package.maintainer
;
247 if (maintainer
== null)
248 $(".maintainer").addClass("deleted");
250 space("#maintainer", $.xml(maintainer
.name
), 153);
251 if (maintainer
.address
== null)
252 $("#maintainer-icon").addClass("deleted");
253 else if (support
== null)
254 $("#maintainer-href").href("mailto:" + maintainer
.address
+ "?subject=" + regarding("M"));
256 $("#maintainer-href").href(support
);
259 var sponsor
= package.sponsor
;
261 $(".sponsor").addClass("deleted");
263 space("#sponsor", $.xml(sponsor
.name
), 152);
264 $("#sponsor-href").href(sponsor
.address
);
267 var source
= package.source
;
268 if (source
== null) {
269 $(".source").addClass("deleted");
270 $(".trusted").addClass("deleted");
272 var host
= source
.host
;
274 $("#source-src").src("cydia://source-icon/" + encodeURIComponent(host
));
275 $("#source-name").html($.xml(source
.name
));
278 $("#trusted").href("cydia://package-signature/" + idc
);
280 $(".trusted").addClass("deleted");
282 var description
= source
.description
;
283 if (description
== null)
284 $(".source-description").addClass("deleted");
286 $("#source-description").html($.xml(description
));