1
|
jQuery(document).ready(
|
2
|
function() {
|
3
|
jQuery("#fbOpen").click(
|
4
|
function() {
|
5
|
jQuery("#fbBrowser").fadeIn(750);
|
6
|
fbBrowse(jQuery("#fbTarget").val());
|
7
|
}
|
8
|
);
|
9
|
}
|
10
|
);
|
11
|
|
12
|
function fbBrowse(path) {
|
13
|
jQuery("#fileContent").fadeOut();
|
14
|
|
15
|
if (jQuery("#fbCurrentDir")) {
|
16
|
jQuery("#fbCurrentDir").html("Loading ...");
|
17
|
}
|
18
|
|
19
|
jQuery.ajax(
|
20
|
"/filebrowser/browser.php?path=" + encodeURI(path ? path : "/"),
|
21
|
{ type: "get", complete: fbComplete }
|
22
|
);
|
23
|
|
24
|
}
|
25
|
|
26
|
function fbComplete(req) {
|
27
|
jQuery("#fbBrowser").html(req.responseText);
|
28
|
|
29
|
var actions = {
|
30
|
fbHome: function() { fbBrowse("/"); },
|
31
|
fbClose: function() { jQuery("#fbBrowser").fadeOut(750); },
|
32
|
fbDir: function() { fbBrowse(this.id); },
|
33
|
fbFile: function() { jQuery("#fbTarget").val(this.id); }
|
34
|
}
|
35
|
|
36
|
for (var type in actions) {
|
37
|
jQuery("#fbBrowser ." + type).each(
|
38
|
function() {
|
39
|
jQuery(this).click(actions[type]);
|
40
|
jQuery(this).css("cursor","pointer");
|
41
|
}
|
42
|
);
|
43
|
}
|
44
|
}
|