summaryrefslogtreecommitdiff
path: root/Cydia.app/package.js
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2008-12-30 01:14:28 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2010-09-30 07:09:33 +0000
commitc37ef8c803fbed03504a12b9e1547af1fc8de358 (patch)
treef84897dfd6ddec86380257ed0e59a5e09553b383 /Cydia.app/package.js
parentd6dad1b433cca3973dcb114c69e389b2ecb765fd (diff)
Reworked how ratings integrate.
Diffstat (limited to 'Cydia.app/package.js')
-rw-r--r--Cydia.app/package.js63
1 files changed, 32 insertions, 31 deletions
diff --git a/Cydia.app/package.js b/Cydia.app/package.js
index 679d183..71ac849 100644
--- a/Cydia.app/package.js
+++ b/Cydia.app/package.js
@@ -29,22 +29,47 @@ function space(selector, html, max) {
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);
}
}
-var rated = 0;
+$(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';
+
+ $("#icon").css("background-image", 'url("' + icon + '")');
+ $("#reflection").src("cydia://package-icon/" + idc);
+
+ $("#name").html(name);
+ space("#latest", package.latest, 96);
-var rating = function () {
var rating = package.rating;
if (rating == null)
$(".rating").remove();
else {
- rating = 'fail.html';
- $.xhr('_' + rating, 'GET', {}, null, {
+ $.xhr(rating, 'GET', {}, null, {
success: function (value) {
- document.getElementById("rating").contentWindow.document.write(value);
+ value = eval(value);
+
+ $("#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);
+ }
},
failure: function (status) {
@@ -52,30 +77,6 @@ var rating = function () {
}
});
}
-};
-
-var rating_ = function() {
- if (rated == 0)
- rated = 1;
- else if (rated == 1) {
- rating();
- rated = -1;
- }
-};
-
-$(function () {
- var id = package.id;
- var idc = encodeURIComponent(id);
- var name = package.name;
- var regarding = encodeURIComponent("Cydia/APT: " + name);
-
- $("#icon").src("cydia://package-icon/" + idc);
- $("#reflection").src("cydia://package-icon/" + idc);
-
- $("#name").html(name);
- space("#latest", package.latest, 93);
-
- rating_();
$("#settings").href("cydia://package-settings/" + idc);
@@ -147,7 +148,7 @@ $(function () {
if (depiction == null)
$(".depiction").remove();
else {
- $(".description").display("none");
+ $(".description").css("display", "none");
$("#depiction-src").src(depiction);
}