summaryrefslogtreecommitdiff
path: root/Cydia.app/package.js
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2008-12-31 09:00:05 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2010-09-30 07:09:33 +0000
commit59c6ae2287e52da7cf67e7bb8ae3fb53d07ab041 (patch)
tree382cef549e41497257784b3516ba6be88823283d /Cydia.app/package.js
parentc37ef8c803fbed03504a12b9e1547af1fc8de358 (diff)
Welcome to the future.
Diffstat (limited to 'Cydia.app/package.js')
-rw-r--r--Cydia.app/package.js76
1 files changed, 51 insertions, 25 deletions
diff --git a/Cydia.app/package.js b/Cydia.app/package.js
index 71ac849..de1343c 100644
--- a/Cydia.app/package.js
+++ b/Cydia.app/package.js
@@ -33,13 +33,29 @@ function space(selector, html, max) {
}
}
+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 icon = 'http://cydia.saurik.com/thumb/net.ispazio.deeptheme.png';
+ var api = 'http://cydia.saurik.com/api/';
$("#icon").css("background-image", 'url("' + icon + '")');
$("#reflection").src("cydia://package-icon/" + idc);
@@ -47,36 +63,46 @@ $(function () {
$("#name").html(name);
space("#latest", package.latest, 96);
- var rating = package.rating;
- if (rating == null)
- $(".rating").remove();
- else {
- $.xhr(rating, 'GET', {}, null, {
- success: function (value) {
- value = eval(value);
+ $.xhr(api + 'package/' + idc, 'GET', {}, null, {
+ success: function (value) {
+ value = eval(value);
- $("#rating-load").remove();
- $("#rating-href").href(value.reviews);
+ $("#rating-load").remove();
- var none = $("#rating-none");
- var done = $("#rating-done");
+ var href = $("#rating-href");
+ href.href(value.reviews);
- if (value.rating == null) {
- done.remove();
- none.css("display", "block");
- } else {
- none.remove();
- done.css("display", "block");
+ var none = $("#rating-none");
+ var done = $("#rating-done");
- $("#rating-value").css('width', 16 * value.rating);
- }
- },
+ if (value.rating == null) {
+ done.remove();
+ none.css("display", "block");
+ } else {
+ none.remove();
+ done.css("display", "block");
- failure: function (status) {
- $(".rating").remove();
+ $("#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);