]>
Commit | Line | Data |
---|---|---|
ad554f10 JF |
1 | /*var package = { |
2 | "name": "MobileTerminal", | |
3 | "latest": "286u-5", | |
4 | "author": { | |
5 | "name": "Allen Porter", | |
6 | "address": "allen.porter@gmail.com" | |
7 | }, | |
853d14d3 JF |
8 | //"depiction": "http://planet-iphones.com/repository/info/chromium1.3.php", |
9 | "depiction": "http://cydia.saurik.com/terminal.html", | |
ad554f10 | 10 | "description": "this is a sample description", |
853d14d3 | 11 | "homepage": "http://cydia.saurik.com/terminal.html", |
ad554f10 JF |
12 | "installed": "286u-4", |
13 | "id": "mobileterminal", | |
14 | "section": "Terminal Support", | |
15 | "size": 552*1024, | |
16 | "maintainer": { | |
17 | "name": "Jay Freeman", | |
18 | "address": "saurik@saurik.com" | |
19 | }, | |
20 | "source": { | |
1eb0c554 JF |
21 | "name": "Telesphoreo Tangelo", |
22 | "description": "Distribution of Unix Software for the iPhone" | |
ad554f10 JF |
23 | } |
24 | };*/ | |
25 | ||
26 | $(function () { | |
27 | var id = package.id; | |
f464053e | 28 | var idc = encodeURIComponent(id); |
ad554f10 JF |
29 | var name = package.name; |
30 | var regarding = encodeURIComponent("Cydia/APT: " + name); | |
31 | ||
f464053e | 32 | $("#icon").src("cydia://package-icon/" + idc); |
dbe0f181 JF |
33 | $("#reflection").src("cydia://package-icon/" + idc); |
34 | ||
ad554f10 JF |
35 | $("#name").html(name); |
36 | $("#latest").html(package.latest); | |
37 | ||
dbe0f181 JF |
38 | $("#settings").href("cydia://package-settings/" + idc); |
39 | ||
f464053e JF |
40 | var warnings = package.warnings; |
41 | var length = warnings == null ? 0 : warnings.length; | |
42 | if (length == 0) | |
43 | $(".warnings").remove(); | |
44 | else { | |
45 | var parent = $("#warnings"); | |
46 | var child = $("#warning"); | |
47 | child.remove(); | |
48 | ||
49 | for (var i = 0; i != length; ++i) { | |
50 | var clone = child.clone(true); | |
51 | parent.append(clone); | |
52 | clone.xpath("label").html($.xml(warnings[i])); | |
53 | } | |
54 | } | |
55 | ||
56 | var applications = package.applications; | |
57 | var length = applications == null ? 0 : applications.length; | |
dbe0f181 JF |
58 | |
59 | var child = $("#application"); | |
60 | child.remove(); | |
61 | ||
62 | /*if (length != 0) { | |
f464053e | 63 | var parent = $("#actions"); |
f464053e JF |
64 | |
65 | for (var i = 0; i != length; ++i) { | |
66 | var application = applications[i]; | |
67 | var clone = child.clone(true); | |
68 | parent.append(clone); | |
69 | clone.href("cydia://launch/" + application[0]); | |
70 | clone.xpath("label").html("Run " + $.xml(application[1])); | |
71 | clone.xpath("img").src(application[2]); | |
f464053e | 72 | } |
dbe0f181 JF |
73 | }*/ |
74 | ||
75 | var purposes = package.purposes; | |
76 | var commercial = false; | |
77 | var _console = false; | |
78 | if (purposes != null) | |
79 | for (var i = 0, e = purposes.length; i != e; ++i) { | |
80 | var purpose = purposes[i]; | |
81 | if (purpose == "commercial") | |
82 | commercial = true; | |
83 | else if (purpose == "console") | |
84 | _console = true; | |
85 | } | |
86 | if (!commercial) | |
87 | $(".commercial").remove(); | |
88 | if (!_console) | |
89 | $(".console").remove(); | |
f464053e | 90 | |
ad554f10 JF |
91 | var author = package.author; |
92 | if (author == null) | |
93 | $(".author").remove(); | |
94 | else { | |
95 | $("#author").html(author.name); | |
f464053e JF |
96 | if (author.address == null) |
97 | $("#author-icon").remove(); | |
98 | else | |
99 | $("#author-href").href("mailto:" + author.address + "?subject=" + regarding); | |
ad554f10 JF |
100 | } |
101 | ||
f464053e | 102 | //$("#notice-src").src("http://saurik.cachefly.net/notice/" + idc + ".html"); |
853d14d3 | 103 | |
0235116c | 104 | var depiction = package.depiction; |
853d14d3 | 105 | if (depiction == null) |
0235116c | 106 | $(".depiction").remove(); |
853d14d3 JF |
107 | else { |
108 | $(".description").display("none"); | |
109 | $("#depiction-src").src(depiction); | |
0235116c | 110 | } |
ad554f10 | 111 | |
853d14d3 JF |
112 | var description = package.description; |
113 | if (description == null) | |
114 | description = package.tagline; | |
115 | else | |
116 | description = description.replace(/\n/g, "<br/>"); | |
117 | $("#description").html(description); | |
118 | ||
ad554f10 JF |
119 | var homepage = package.homepage; |
120 | if (homepage == null) | |
121 | $(".homepage").remove(); | |
122 | else | |
0235116c | 123 | $("#homepage-href").href(homepage); |
ad554f10 JF |
124 | |
125 | var installed = package.installed; | |
126 | if (installed == null) | |
127 | $(".installed").remove(); | |
128 | else { | |
129 | $("#installed").html(installed); | |
f464053e | 130 | $("#files-href").href("cydia://files/" + idc); |
ad554f10 JF |
131 | } |
132 | ||
dbe0f181 JF |
133 | var nid = $("#id"); |
134 | nid.html(id); | |
135 | var width = nid.width(); | |
136 | ||
890c1d38 JF |
137 | var max = 238.0; |
138 | if (width > max) { | |
139 | var spacing = (max - nid.width()) / (id.length - 1) + "px"; | |
dbe0f181 JF |
140 | nid.css("letter-spacing", spacing); |
141 | } | |
ad554f10 JF |
142 | |
143 | var section = package.section; | |
144 | if (section == null) | |
145 | $(".section").remove(); | |
6b4b3bee JF |
146 | else { |
147 | $("#section-src").src("cydia://section-icon/" + encodeURIComponent(section)); | |
148 | $("#section").html(section); | |
149 | } | |
ad554f10 JF |
150 | |
151 | var size = package.size; | |
152 | if (size == 0) | |
153 | $(".size").remove(); | |
154 | else | |
155 | $("#size").html(size / 1024 + " kB"); | |
156 | ||
157 | var maintainer = package.maintainer; | |
158 | if (maintainer == null) | |
159 | $(".maintainer").remove(); | |
160 | else { | |
161 | $("#maintainer").html(maintainer.name); | |
f464053e JF |
162 | if (maintainer.address == null) |
163 | $("#maintainer-icon").remove(); | |
164 | else | |
165 | $("#maintainer-href").href("mailto:" + maintainer.address + "?subject=" + regarding); | |
ad554f10 JF |
166 | } |
167 | ||
1eb0c554 | 168 | var sponsor = package.sponsor; |
6bffd7b7 JF |
169 | if (sponsor == null) |
170 | $(".sponsor").remove(); | |
171 | else { | |
172 | $("#sponsor").html(sponsor.name); | |
0235116c | 173 | $("#sponsor-href").href(sponsor.address); |
6bffd7b7 JF |
174 | } |
175 | ||
ad554f10 | 176 | var source = package.source; |
0235116c | 177 | if (source == null) { |
ad554f10 | 178 | $(".source").remove(); |
0235116c JF |
179 | $(".trusted").remove(); |
180 | } else { | |
1eb0c554 JF |
181 | $("#source-name").html(source.name); |
182 | ||
2f4fac47 | 183 | if (source.trusted) |
dbe0f181 | 184 | $("#trusted").href("cydia://package-signature/" + idc); |
2f4fac47 | 185 | else |
0235116c JF |
186 | $(".trusted").remove(); |
187 | ||
1eb0c554 JF |
188 | var description = source.description; |
189 | if (description == null) | |
190 | $(".source-description").remove(); | |
191 | else | |
192 | $("#source-description").html(description); | |
193 | } | |
ad554f10 | 194 | }); |