-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
151 lines (130 loc) · 4.85 KB
/
index.html
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<div id="title">Autobup's Repo</div>
<div id="content">
<h4>Here is Autobup's Repo, enjoy!</h4>
<div class="text-center openCydia" style="margin-top:15px" dir="ltr">
<hr>
<p>Open Cydia > Sources > Edit > Add</p>
<div class="input-group input-group-lg">
<input autocomplete="off" dir="ltr" class="form-control" style="text-align:center;user-select:text;-ms-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-webkit-touch-callout:text" type="text" value="https://autobup.github.io/">
<span class="input-group-btn"><a class="btn btn-primary" rel="nofollow" href="cydia://url/https://cydia.saurik.com/api/share#?source=https://autobup.github.io/">Add</a></span>
</div>
</div>
<span id="ocy"></span>
<div class="panel panel-primary" style="margin-top: 20px;">
<div class="panel-heading">Featured Package</div>
<div class="panel-body">
<div id="samples"></div>
</div>
</div>
<script type="text/javascript">
//Some fast iOS check.
is_ios = (navigator.userAgent.match(/iPad/i) != null) || (navigator.userAgent.match(/iPhone/i) != null) || (navigator.userAgent.match(/iPod/i) != null);
// if (!is_ios) document.getElementById('ocy').innerHTML = ' Most probably, you will not be able to open Cydia.';
//The functionality for the package list.
function Apt_package() {
this.Package;
this.Version;
this.Section;
this.Installed_Size;
this.Description;
this.Name;
this.Author;
this.Filename;
this.Depiction;
} //Constructor for Apt_package object.
function parsePackage(string) { //TODO: Make sure no key is undefined
var a_package = new Apt_package();
var lines = string.split('\n');
var c;
for (c = 0; c < lines.length; ++c) {
var line = lines[c];
if (line.search(':') == -1) continue;
var components = line.split(':'); //Quick and dirty.
var key = components.shift();
var value = components.join(':').trim();
switch (key) {
case 'Package':
a_package.Package = value;
break;
case 'Version':
a_package.Version = value;
break;
case 'Section':
a_package.Section = value;
break;
case 'Installed-Size':
a_package.Installed_Size = value;
break;
case 'Description':
a_package.Description = value;
break;
case 'Name':
a_package.Name = value;
break;
case 'Author':
a_package.Author = value;
break;
case 'Filename':
a_package.Filename = value;
break;
case 'Depiction':
a_package.Depiction = value;
break;
default:
break; //Unknown key.
}
}
if (a_package.Package == undefined) return undefined;
return a_package;
}
function parsePackages(parse) {
var depictions = {};
while (parse.indexOf('\r') >= 0) parse = parse.replace('\r', ''); //Remove all carriage returns, which should not be there, anyways.
var packages = parse.split('\n\n');
for (var c = 0; c < packages.length; ++c) {
var a_package = parsePackage(packages[c]);
if (a_package == undefined) continue;
var pid = a_package.Package;
if (depictions[pid] && (parseFloat(a_package.Version) >= parseFloat(depictions[pid].Version))) { //Only keep the latest version.
depictions[pid] = a_package;
} else if (depictions[pid] == undefined) { //Package not added yet, add.
depictions[pid] = a_package;
}
}
return depictions;
}
var xhr;
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xhr = new ActiveXObject('Microsoft.XMLHTTP');
}
xhr.onreadystatechange = function() {
if (!(xhr.readyState == 4)) return;
var depictionArray = parsePackages(xhr.responseText);
if (!depictionArray) return;
for (key in depictionArray) {
var pack = depictionArray[key];
//The following code is very messy. You have been warned.
document.getElementById('samples').innerHTML = document.getElementById('samples').innerHTML +
''+
'<a href="javascript:var e = document.getElementById(\'u_' + pack.Package + '\'); e.style.display = e.style.display= (e.style.display == \'block\' ? \'none\' : \'block\');">' +
pack.Name + ' (' + pack.Version + ')</a><br>' +
'<div id="u_' + pack.Package + '" style="display:none;">' +
' ' + pack.Description + '<br>' +
(is_ios ? ' <a href="' + 'cydia://url/https://cydia.saurik.com/api/share#?source=https://autobup.github.io/&package=' + pack.Package + '" target="_blank">Show in Cydia.</a><br>' : '') +
' <a href="' + pack.Depiction + '" target="_blank">Show more info.</a><br>' +
' <a href="' + pack.Filename + '" target="_blank">Download the .deb package.</a><br><br>' +
'</div>';
}
};
xhr.open("GET","Packages");
xhr.send();
</script>
</div>
<!-- include this where you want the standard design template from here... -->
<script type="text/javascript" src="./dptemplate.js"></script>
<noscript>
As this website uses JavaScript to generate a semi-dynamically created page, you need to activate JavaScript!
</noscript>
<!-- ...until here! -->