summaryrefslogtreecommitdiff
path: root/Cydia.app/package.js
blob: aec81416fee118217d0fcdd97b0d47a3fa4331eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*var package = {
    "name": "MobileTerminal",
    "latest": "286u-5",
    "author": {
        "name": "Allen Porter",
        "address": "allen.porter@gmail.com"
    },
    "depiction": "http://planet-iphones.com/repository/info/chromium1.3.php",
    "description": "this is a sample description",
    //"homepage": "http://cydia.saurik.com/terminal.html",
    "homepage": "http://planet-iphones.com/repository/info/chromium1.3.php",
    "installed": "286u-4",
    "id": "mobileterminal",
    "section": "Terminal Support",
    "size": 552*1024,
    "maintainer": {
        "name": "Jay Freeman",
        "address": "saurik@saurik.com"
    },
    "source": {
        "name": "Telesphoreo Tangelo",
        "description": "Distribution of Unix Software for the iPhone"
    }
};*/

$(function () {
    var id = package.id;
    var name = package.name;
    var regarding = encodeURIComponent("Cydia/APT: " + name);

    $("#name").html(name);
    $("#latest").html(package.latest);

    var author = package.author;
    if (author == null)
        $(".author").remove();
    else {
        $("#author").html(author.name);
        $("#author-href").href("mailto:" + author.address + "?subject=" + regarding);
    }

    var depiction = package.depiction;
    if (depiction != null) {
        $(".description").remove();
        $("#depiction-src").src(depiction);
    } else {
        $(".depiction").remove();

        var description = package.description;
        if (description == null)
            description = package.tagline;
        else
            description = description.replace(/\n/g, "<br/>");
        $("#description").html(description);
    }

    var homepage = package.homepage;
    if (homepage == null)
        $(".homepage").remove();
    else
        $("#homepage-href").href(homepage);

    var installed = package.installed;
    if (installed == null)
        $(".installed").remove();
    else {
        $("#installed").html(installed);
        $("#files-href").href("cydia://files/" + id);
    }

    $("#id").html(id);

    var section = package.section;
    if (section == null)
        $(".section").remove();
    else
        $("#section").html(package.section);

    var size = package.size;
    if (size == 0)
        $(".size").remove();
    else
        $("#size").html(size / 1024 + " kB");

    var maintainer = package.maintainer;
    if (maintainer == null)
        $(".maintainer").remove();
    else {
        $("#maintainer").html(maintainer.name);
        $("#maintainer-href").href("mailto:" + maintainer.address + "?subject=" + regarding);
    }

    var sponsor = package.sponsor;
    if (sponsor == null)
        $(".sponsor").remove();
    else {
        $("#sponsor").html(sponsor.name);
        $("#sponsor-href").href(sponsor.address);
    }

    var source = package.source;
    if (source == null) {
        $(".source").remove();
        $(".trusted").remove();
    } else {
        $("#source-name").html(source.name);

        if (!source.trusted)
            $(".trusted").remove();

        var description = source.description;
        if (description == null)
            $(".source-description").remove();
        else
            $("#source-description").html(description);
    }
});