]>
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
);
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';
52 var special_ = function () {
57 var idc
= encodeURIComponent(id
);
58 var name
= package.name
;
59 var icon
= 'cydia://package-icon/' + idc
;
60 var api
= 'http://cydia.saurik.com/api/';
62 var support
= package.support
;
64 var regarding = function (type
) {
65 return encodeURIComponent("Cydia/APT(" + type
+ "): " + name
);
68 $("#icon").css("background-image", 'url("' + icon
+ '")');
69 //$("#reflection").src("cydia://package-icon/" + idc);
71 $("#name").html(name
);
72 space("#latest", package.latest
, 96);
74 $.xhr(cache(api
+ 'package/' + idc
), 'GET', {}, null, {
75 success: function (value
) {
78 if (typeof value
.notice
== "undefined")
79 $(".notice").addClass("deleted");
81 $("#notice-src").src(value
.notice
);
83 if (typeof value
.rating
== "undefined")
84 $(".rating").addClass("deleted");
86 $("#rating-load").addClass("deleted");
87 $("#rating-href").href(value
.reviews
);
89 var none
= $("#rating-none");
90 var done
= $("#rating-done");
92 if (value
.rating
== null) {
93 none
.css("display", "block");
95 done
.css("display", "block");
97 $("#rating-value").css('width', 16 * value
.rating
);
101 if (typeof value
.icon
!= "undefined" && value
.icon
!= null) {
102 var icon
= $("#icon");
103 var thumb
= $("#thumb");
105 icon
[0].className
= 'flip-180';
106 thumb
[0].className
= 'flip-360';
108 thumb
.css("background-image", 'url("' + value
.icon
+ '")');
110 setTimeout(function () {
111 icon
.addClass("deleted");
112 thumb
[0].className
= 'flip-0';
117 failure: function (status
) {
118 $(".rating").addClass("deleted");
122 $("#settings").href("cydia://package-settings/" + idc
);
124 var mode
= package.mode
;
126 $(".mode").addClass("deleted");
128 $("#mode").html(cydia
.localize(mode
));
129 $("#mode-src").src("Modes/" + mode
+ ".png");
132 var warnings
= package.warnings
;
133 var length
= warnings
== null ? 0 : warnings
.length
;
135 $(".warnings").addClass("deleted");
137 var parent
= $("#warnings");
138 var child
= $("#warning");
140 for (var i
= 0; i
!= length
; ++i
) {
141 var clone
= child
.clone(true);
142 clone
.addClass("inserted");
143 parent
.append(clone
);
144 clone
.xpath("./div/label").html($.xml(warnings
[i
]));
147 child
.addClass("deleted");
150 var applications
= package.applications
;
151 var length
= applications
== null ? 0 : applications
.length
;
153 var child
= $("#application");
156 var parent = $("#actions");
158 for (var i = 0; i != length; ++i) {
159 var application = applications[i];
160 var clone = child.clone(true);
161 parent.append(clone);
162 clone.href("cydia://launch/" + application[0]);
163 clone.xpath("label").html("Run " + $.xml(application[1]));
164 clone.xpath("img").src(application[2]);
168 child
.addClass("deleted");
170 var commercial
= package.hasTag('cydia::commercial');
172 $(".commercial").addClass("deleted");
174 var _console
= package.hasTag('purpose::console');
176 $(".console").addClass("deleted");
178 var author
= package.author
;
180 $(".author").addClass("deleted");
182 space("#author", author
.name
, 160);
183 if (author
.address
== null)
184 $("#author-icon").addClass("deleted");
185 else if (support
== null)
186 $("#author-href").href("mailto:" + author
.address
+ "?subject=" + regarding("A"));
188 $("#author-href").href(support
);
191 /*var store = commercial;
193 $(".activation").addClass("deleted");
195 var activation = api + 'activation/' + idc;
196 $("#activation-src").src(activation);
199 var depiction
= package.depiction
;
200 if (depiction
== null)
201 $(".depiction").addClass("deleted");
203 $(".description").addClass("deleted");
204 $("#depiction-src").src(depiction
);
207 var description
= package.longDescription
;
208 if (description
== null)
209 description
= package.shortDescription
;
211 description
= description
.replace(/\n/g, "<br/>");
212 $("#description").html(description
);
214 var homepage
= package.homepage
;
215 if (homepage
== null)
216 $(".homepage").addClass("deleted");
218 $("#homepage-href").href(homepage
);
220 var installed
= package.installed
;
221 if (installed
== null)
222 $(".installed").addClass("deleted");
224 $("#installed").html(installed
);
225 $("#files-href").href("cydia://files/" + idc
);
228 space("#id", id
, 220);
230 var section
= package.longSection
;
232 $(".section").addClass("deleted");
234 $("#section-src").src("cydia://section-icon/" + encodeURIComponent(section
));
235 $("#section").html(section
);
238 var size
= package.size
;
240 $(".size").addClass("deleted");
242 $("#size").html(size
/ 1024 + " kB");
244 var maintainer
= package.maintainer
;
245 if (maintainer
== null)
246 $(".maintainer").addClass("deleted");
248 space("#maintainer", maintainer
.name
, 153);
249 if (maintainer
.address
== null)
250 $("#maintainer-icon").addClass("deleted");
251 else if (support
== null)
252 $("#maintainer-href").href("mailto:" + maintainer
.address
+ "?subject=" + regarding("M"));
254 $("#maintainer-href").href(support
);
257 var sponsor
= package.sponsor
;
259 $(".sponsor").addClass("deleted");
261 space("#sponsor", sponsor
.name
, 152);
262 $("#sponsor-href").href(sponsor
.address
);
265 var source
= package.source
;
266 if (source
== null) {
267 $(".source").addClass("deleted");
268 $(".trusted").addClass("deleted");
270 var host
= source
.host
;
272 $("#source-src").src("cydia://source-icon/" + encodeURIComponent(host
));
273 $("#source-name").html(source
.name
);
276 $("#trusted").href("cydia://package-signature/" + idc
);
278 $(".trusted").addClass("deleted");
280 var description
= source
.description
;
281 if (description
== null)
282 $(".source-description").addClass("deleted");
284 $("#source-description").html(description
);
290 var special = function () {
291 $(".deleted").removeClass("deleted");
292 $(".inserted").remove();
294 $("#icon")[0].className
= 'flip-0';
295 $("#thumb")[0].className
= 'flip-180';
297 /* XXX: this could be better */
298 $("#rating-href").href(null);
299 $("#rating-none").css("display", "none");
300 $("#rating-done").css("display", "none");
302 var notice
= $("#notice-src");
304 notice
[0].outerHTML
= '<iframe' +
313 var depiction
= $("#depiction-src");
315 depiction
[0].outerHTML
= '<iframe' +
316 ' class="depiction"' +
317 ' id="depiction-src"' +
322 ' onload_="loaded()"' +
328 cydia
.setSpecial(special
);