]>
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 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(cache(api
+ 'package/' + idc
), 'GET', {}, null, {
73 success: function (value
) {
76 if (typeof value
.rating
== "undefined")
77 $(".rating").addClass("deleted");
79 $("#rating-load").addClass("deleted");
80 $("#rating-href").href(value
.reviews
);
82 var none
= $("#rating-none");
83 var done
= $("#rating-done");
85 if (value
.rating
== null) {
86 none
.css("display", "block");
88 done
.css("display", "block");
90 $("#rating-value").css('width', 16 * value
.rating
);
94 if (typeof value
.icon
!= "undefined" && value
.icon
!= null) {
95 var icon
= $("#icon");
96 var thumb
= $("#thumb");
98 icon
[0].className
= 'flip-180';
99 thumb
[0].className
= 'flip-360';
101 thumb
.css("background-image", 'url("' + value
.icon
+ '")');
103 setTimeout(function () {
104 icon
.addClass("deleted");
105 thumb
[0].className
= 'flip-0';
110 failure: function (status
) {
111 $(".rating").addClass("deleted");
115 $("#settings").href("cydia://package-settings/" + idc
);
117 var mode
= package.mode
;
119 $(".mode").addClass("deleted");
121 $("#mode").html(cydia
.localize(mode
));
122 $("#mode-src").src("Modes/" + mode
+ ".png");
125 var warnings
= package.warnings
;
126 var length
= warnings
== null ? 0 : warnings
.length
;
128 $(".warnings").addClass("deleted");
130 var parent
= $("#warnings");
131 var child
= $("#warning");
133 for (var i
= 0; i
!= length
; ++i
) {
134 var clone
= child
.clone(true);
135 clone
.addClass("inserted");
136 parent
.append(clone
);
137 clone
.xpath("./div/label").html($.xml(warnings
[i
]));
140 child
.addClass("deleted");
143 var applications
= package.applications
;
144 var length
= applications
== null ? 0 : applications
.length
;
146 var child
= $("#application");
149 var parent = $("#actions");
151 for (var i = 0; i != length; ++i) {
152 var application = applications[i];
153 var clone = child.clone(true);
154 parent.append(clone);
155 clone.href("cydia://launch/" + application[0]);
156 clone.xpath("label").html("Run " + $.xml(application[1]));
157 clone.xpath("img").src(application[2]);
161 child
.addClass("deleted");
163 var commercial
= package.hasTag('cydia::commercial');
165 $(".commercial").addClass("deleted");
167 var _console
= package.hasTag('purpose::console');
169 $(".console").addClass("deleted");
171 var author
= package.author
;
173 $(".author").addClass("deleted");
175 space("#author", author
.name
, 160);
176 if (author
.address
== null)
177 $("#author-icon").addClass("deleted");
179 var support
= package.support
;
181 $("#author-href").href("mailto:" + author
.address
+ "?subject=" + regarding("A"));
183 $("#author-href").href(support
);
187 //$("#notice-src").src("http://saurik.cachefly.net/notice/" + idc + ".html");
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");
250 $("#maintainer-href").href("mailto:" + maintainer
.address
+ "?subject=" + regarding("M"));
253 var sponsor
= package.sponsor
;
255 $(".sponsor").addClass("deleted");
257 space("#sponsor", sponsor
.name
, 152);
258 $("#sponsor-href").href(sponsor
.address
);
261 var source
= package.source
;
262 if (source
== null) {
263 $(".source").addClass("deleted");
264 $(".trusted").addClass("deleted");
266 var host
= source
.host
;
268 $("#source-src").src("cydia://source-icon/" + encodeURIComponent(host
));
269 $("#source-name").html(source
.name
);
272 $("#trusted").href("cydia://package-signature/" + idc
);
274 $(".trusted").addClass("deleted");
276 var description
= source
.description
;
277 if (description
== null)
278 $(".source-description").addClass("deleted");
280 $("#source-description").html(description
);
286 var special = function () {
287 $(".deleted").removeClass("deleted");
288 $(".inserted").remove();
290 $("#icon")[0].className
= 'flip-0';
291 $("#thumb")[0].className
= 'flip-180';
293 /* XXX: this could be better */
294 $("#rating-none").css("display", "none");
295 $("#rating-done").css("display", "none");
297 var depiction
= $("#depiction-src");
299 depiction
[0].outerHTML
= '<iframe' +
300 ' class="depiction"' +
301 ' id="depiction-src"' +
306 ' onload_="loaded()"' +
312 cydia
.setSpecial(special
);