-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathuncompressed.js
239 lines (227 loc) · 8.28 KB
/
uncompressed.js
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/**
* XDCC Parser
* |- Javascript Module
*
* This software is free software and you are permitted to
* modify and redistribute it under the terms of the GNU General
* Public License version 3 as published by the Free Sofware
* Foundation.
*
* @link http://xdccparser.is-fabulo.us/
* @version 1.2.0
* @author Alex 'xshadowfire' Yu <[email protected]>
* @author DrX
* @copyright 2008-2009 Alex Yu and DrX
*/
function p() {
this.k = new Array();
this.lastType = 0;
this.lastValue = "";
this.url = "";
this.init=function(url) {
this.url=url;
this.table=document.getElementById('listtable');
this.status=document.getElementById('status');
this.searchdiv=document.getElementById('searchdiv');
this.listname=document.getElementById('listname');
this.tablehead="<table cellspacing='0' id='listtable'><tr class='animeColumn'><th class='number'>Bot <a href='javascript:p.k.sort(p.botDesc);p.flush();'>↑</a> <a href='javascript:p.k.sort(p.botAsc);p.flush();'>↓</a></th><th class='number'>Pack <a href='javascript:p.k.sort(p.numberDesc);p.flush();'>↑</a> <a href='javascript:p.k.sort(p.numberAsc);p.flush();'>↓</a></th><th class='number'>Size <a href='javascript:p.k.sort(p.sizeDesc);p.flush();'>↑</a> <a href='javascript:p.k.sort(p.sizeAsc);p.flush();'>↓</a></th><th class='name'>Filename <a href='javascript:p.k.sort(p.nameDesc);p.flush();'>↑</a> <a href='javascript:p.k.sort(p.nameAsc);p.flush();'>↓</a></th></tr>";
this.search();
};
this.ajax_init=function() {
try {
this.ajax_request = new XMLHttpRequest();
} catch (trymicrosoft) {
try {
this.ajax_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (othermicrosoft) {
try {
this.ajax_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
this.ajax_request = null;
}
}
}
if (!this.ajax_request)
alert("Sorry, your browser is to old. To use this page, please make yourself happier and download a newer browser.");
};
this.flush=function() {
var buffer = this.tablehead;
if(this.k.length<1) {
buffer += "<tr class='anime0' id='none' ><td class='none' colspan='4'>No packs found.</td></tr>";
} else {
for(i=0;i<this.k.length;i++) {
var size = (this.k[i]['s']==0) ? "<1" : this.k[i]['s'];
size += "M";
buffer += "<tr class='anime"+(i%2)+"' onclick=\"p.genCommand('"+this.k[i]['b']+"',"+this.k[i]['n']+");\"><td class='number'>"+this.k[i]['b']+"</td><td class='number'>"+this.k[i]['n']+"</td><td class='number'>"+size+"</td><td class='name'>"+this.k[i]['f']+"</td></tr>";
}
}
buffer += "</table>";
this.listname.innerHTML = this.getLastName();
this.table.innerHTML = buffer;
this.status.style.display = 'none';
};
this.getLastName=function() {
var name = (this.lastType==1) ? "Search: " : "Bot: ";
name += this.lastValue;
name += (this.lastType!=1) ? ' [<a href="rss.php?nick='+this.lastValue+'">rss</a>]' : "";
return name;
};
this.getLastURI=function() {
var param = (this.lastType==1) ? "?search=" : "?nick=";
param += this.lastValue;
prompt('Permalink:',this.url+param);
};
this.genCommand=function(nick,pack) {
prompt('Paste this in your irc client:','/msg '+nick+' xdcc send #'+pack);
};
this.search=function() {
if(document.getElementById('search').value != "" && document.getElementById('search').value != " ") {
var search = document.getElementById('search').value.replace(/\+/ig,"%2B");
this.request("t="+search);
this.lastType = 1;
this.lastValue = search;
} else {
this.table.innerHTML = this.tablehead + "<tr class='anime0' id='start'><td class='none' colspan='4'>Please select a bot or enter search terms to start.</td></tr></table>";
}
};
this.nickPacks=function(nick) {
this.request("nick="+nick);
this.lastType = 2;
this.lastValue = nick;
};
this.numberAsc=function(a,b) {
var x = a.n;
var y = b.n;
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
this.numberDesc=function(a,b) {
var x = a.n;
var y = b.n;
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
this.sizeAsc=function(a,b) {
var x = a.s;
var y = b.s;
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
this.sizeDesc=function(a,b) {
var x = a.s;
var y = b.s;
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
this.nameAsc=function(a,b) {
var x = a.f.toLowerCase();
var y = b.f.toLowerCase();
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
this.nameDesc=function(a,b) {
var x = a.f.toLowerCase();
var y = b.f.toLowerCase();
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
this.botAsc=function(a,b) {
var x = a.b.toLowerCase();
var y = b.b.toLowerCase();
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
this.botDesc=function(a,b) {
var x = a.b.toLowerCase();
var y = b.b.toLowerCase();
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
this.request=function(request) {
request = "search.php?"+request;
this.center_status();
this.ajax_init();
this.ajax_request.onreadystatechange = this.ajax_callback;
this.ajax_request.open("GET",request,true);
this.ajax_request.send(null);
this.inited = true;
};
this.ajax_callback=function() {
if(p.ajax_request.readyState == 4 && p.ajax_request.status == 200) {
p.k = new Array();
eval(p.ajax_request.responseText);
p.flush();
}
};
this.center_status=function() {
var my_width = 0;
var my_height = 0;
if ( typeof( window.innerWidth ) == 'number' ) {
my_width = window.innerWidth;
my_height = window.innerHeight;
} else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
my_width = document.documentElement.clientWidth;
my_height = document.documentElement.clientHeight;
} else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
my_width = document.body.clientWidth;
my_height = document.body.clientHeight;
}
this.status.style.position = 'absolute';
this.status.style.display = 'block';
this.status.style.zIndex = -1;
var divheight = parseInt( this.status.style.height, 10 ) ? parseInt( this.status.style.height, 10 ) : parseInt( this.status.offsetHeight, 10 );
var divwidth = parseInt( this.status.style.width, 10 ) ? parseInt( this.status.style.width, 10 ) : parseInt( this.status.offsetWidth, 10 );
divheight = divheight ? divheight : 200;
divwidth = divwidth ? divwidth : 400;
var scrollY = this.getScrollY();
var setX = ( my_width - divwidth ) / 2;
var setY = ( my_height - divheight ) / 2 + scrollY;
setX = ( setX < 0 ) ? 0 : setX;
setY = ( setY < 0 ) ? 0 : setY;
this.status.style.left = setX + "px";
this.status.style.top = setY + "px";
this.status.style.zIndex = 99;
};
this.getScrollY=function() {
var scrollY = 0;
if ( document.documentElement && document.documentElement.scrollTop ) {
scrollY = document.documentElement.scrollTop;
} else if ( document.body && document.body.scrollTop ) {
scrollY = document.body.scrollTop;
} else if ( window.pageYOffset ) {
scrollY = window.pageYOffset;
} else if ( window.scrollY ) {
scrollY = window.scrollY;
}
return scrollY;
};
this.goTop=function() {
var dx = 0;
var dy = 0;
var bx = 0;
var by = 0;
if (document.documentElement) {
dx = document.documentElement.scrollLeft || 0;
dy = document.documentElement.scrollTop || 0;
}
if (document.body) {
bx = document.body.scrollLeft || 0;
by = document.body.scrollTop || 0;
}
var wx = window.scrollX || 0;
var wy = window.scrollY || 0;
var x = Math.max(wx, Math.max(bx, dx));
var y = Math.max(wy, Math.max(by, dy));
window.scrollTo(Math.floor(x / 1.5), Math.floor(y / 1.5));
if(x > 0 || y > 0) {
window.setTimeout("p.goTop()", 15);
}
};
this.setSkin=function(id) {
document.getElementById("skin").href = "style"+id+".css";
var exdate=new Date();
exdate.setDate(exdate.getDate()+7);
document.cookie="skin"+"="+escape(id)+";expires="+exdate.toGMTString();
};
}
var p = new p();
window.onscroll=function() {
var scrollY = p.getScrollY();
if(scrollY > 76) {
p.searchdiv.style.top = (scrollY-79)+"px";
} else {
p.searchdiv.style.top = "0px";
}
};