]>
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 "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';
48 var special_ = function () {
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(name
);
70 space("#latest", 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", 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 $(".depiction").addClass("deleted");
201 $(".description").addClass("deleted");
202 $("#depiction-src").src(depiction
);
205 var description
= package.longDescription
;
206 if (description
== null)
207 description
= package.shortDescription
;
209 description
= description
.replace(/\n/g, "<br/>");
210 $("#description").html(description
);
212 var homepage
= package.homepage
;
213 if (homepage
== null)
214 $(".homepage").addClass("deleted");
216 $("#homepage-href").href(homepage
);
218 var installed
= package.installed
;
219 if (installed
== null)
220 $(".installed").addClass("deleted");
222 $("#installed").html(installed
);
223 $("#files-href").href("cydia://files/" + idc
);
226 space("#id", id
, 220);
228 var section
= package.longSection
;
230 $(".section").addClass("deleted");
232 $("#section-src").src("cydia://section-icon/" + encodeURIComponent(section
));
233 $("#section").html(section
);
236 var size
= package.size
;
238 $(".size").addClass("deleted");
240 $("#size").html(size
/ 1024 + " kB");
242 var maintainer
= package.maintainer
;
243 if (maintainer
== null)
244 $(".maintainer").addClass("deleted");
246 space("#maintainer", maintainer
.name
, 153);
247 if (maintainer
.address
== null)
248 $("#maintainer-icon").addClass("deleted");
249 else if (support
== null)
250 $("#maintainer-href").href("mailto:" + maintainer
.address
+ "?subject=" + regarding("M"));
252 $("#maintainer-href").href(support
);
255 var sponsor
= package.sponsor
;
257 $(".sponsor").addClass("deleted");
259 space("#sponsor", sponsor
.name
, 152);
260 $("#sponsor-href").href(sponsor
.address
);
263 var source
= package.source
;
264 if (source
== null) {
265 $(".source").addClass("deleted");
266 $(".trusted").addClass("deleted");
268 var host
= source
.host
;
270 $("#source-src").src("cydia://source-icon/" + encodeURIComponent(host
));
271 $("#source-name").html(source
.name
);
274 $("#trusted").href("cydia://package-signature/" + idc
);
276 $(".trusted").addClass("deleted");
278 var description
= source
.description
;
279 if (description
== null)
280 $(".source-description").addClass("deleted");
282 $("#source-description").html(description
);
288 var special = function () {
289 $(".deleted").removeClass("deleted");
290 $(".inserted").remove();
292 $("#icon")[0].className
= 'flip-0';
293 $("#thumb")[0].className
= 'flip-180';
295 /* XXX: this could be better */
296 $("#rating-href").href(null);
297 $("#rating-none").css("display", "none");
298 $("#rating-done").css("display", "none");
300 var notice
= $("#notice-src");
302 notice
[0].outerHTML
= '<iframe' +
311 var depiction
= $("#depiction-src");
313 depiction
[0].outerHTML
= '<iframe' +
314 ' class="depiction"' +
315 ' id="depiction-src"' +
320 ' onload_="loaded()"' +
326 cydia
.setSpecial(special
);