var width = node.width();
if (width > max) {
var spacing = (max - node.width()) / (html.length - 1) + "px";
- console.log(width + " " + max + " " + spacing);
node.css("letter-spacing", spacing);
}
}
+function cache(url) {
+ return url.replace('://', '://ne.edgecastcdn.net/8003A4/');
+}
+
+var swap_, swap = function (on, off, time) {
+ setTimeout(swap_(on, off, time), time);
+};
+
+swap_ = function (on, off, time) {
+ return function () {
+ on.className = 'fade-out';
+ off.className = 'fade-in';
+ swap(off, on, time);
+ };
+};
+
$(function () {
var id = package.id;
var idc = encodeURIComponent(id);
var name = package.name;
var regarding = encodeURIComponent("Cydia/APT: " + name);
+ var icon = 'cydia://package-icon/' + idc;
+ var api = 'http://cydia.saurik.com/api/';
- $("#icon").src("cydia://package-icon/" + idc);
+ $("#icon").css("background-image", 'url("' + icon + '")');
$("#reflection").src("cydia://package-icon/" + idc);
$("#name").html(name);
- space("#latest", package.latest, 93);
+ space("#latest", package.latest, 96);
- var rating = package.rating;
- if (rating == null)
- $(".rating").remove();
- else {
- $.xhr(rating, 'GET', {}, null, {
- success: function (value) {
- document.getElementById("rating").contentWindow.document.write(value);
+ $.xhr(cache(api + 'package/' + idc), 'GET', {}, null, {
+ success: function (value) {
+ value = eval(value);
+
+ if (typeof value.rating == "undefined")
+ $(".rating").remove();
+ else {
+ $("#rating-load").remove();
+ $("#rating-href").href(value.reviews);
+
+ var none = $("#rating-none");
+ var done = $("#rating-done");
+
+ if (value.rating == null) {
+ done.remove();
+ none.css("display", "block");
+ } else {
+ none.remove();
+ done.css("display", "block");
+
+ $("#rating-value").css('width', 16 * value.rating);
+ }
}
- });
- }
+
+ if (typeof value.icon != "undefined" && value.icon != null) {
+ var icon = $("#icon");
+ var thumb = $("#thumb");
+
+ icon[0].className = 'flip-180';
+ thumb[0].className = 'flip-360';
+
+ thumb.css("background-image", 'url("' + value.icon + '")');
+
+ setTimeout(function () {
+ icon.css("display", "none");
+ thumb[0].className = 'flip-0';
+ }, 2000);
+ }
+ },
+
+ failure: function (status) {
+ $(".rating").remove();
+ }
+ });
$("#settings").href("cydia://package-settings/" + idc);
for (var i = 0; i != length; ++i) {
var clone = child.clone(true);
parent.append(clone);
- clone.xpath("label").html($.xml(warnings[i]));
+ clone.xpath("./div/label").html($.xml(warnings[i]));
}
}
}
}*/
- var purposes = package.purposes;
- var commercial = false;
- var _console = false;
- if (purposes != null)
- for (var i = 0, e = purposes.length; i != e; ++i) {
- var purpose = purposes[i];
- if (purpose == "commercial")
- commercial = true;
- else if (purpose == "console")
- _console = true;
- }
+ var commercial = package.hasTag('cydia::commercial');
if (!commercial)
$(".commercial").remove();
+
+ var _console = package.hasTag('purpose::console');
if (!_console)
$(".console").remove();
if (author == null)
$(".author").remove();
else {
- $("#author").html(author.name);
+ space("#author", author.name, 160);
if (author.address == null)
$("#author-icon").remove();
else
//$("#notice-src").src("http://saurik.cachefly.net/notice/" + idc + ".html");
+ /*var store = commercial;
+ if (!store)
+ $(".activation").remove();
+ else {
+ var activation = api + 'activation/' + idc;
+ $("#activation-src").src(activation);
+ }*/
+
var depiction = package.depiction;
if (depiction == null)
$(".depiction").remove();
else {
- $(".description").display("none");
+ $(".description").css("display", "none");
$("#depiction-src").src(depiction);
}
$("#files-href").href("cydia://files/" + idc);
}
- space("#id", id, 238);
+ space("#id", id, 220);
var section = package.section;
if (section == null)
if (maintainer == null)
$(".maintainer").remove();
else {
- $("#maintainer").html(maintainer.name);
+ space("#maintainer", maintainer.name, 153);
if (maintainer.address == null)
$("#maintainer-icon").remove();
else
if (sponsor == null)
$(".sponsor").remove();
else {
- $("#sponsor").html(sponsor.name);
+ space("#sponsor", sponsor.name, 152);
$("#sponsor-href").href(sponsor.address);
}