summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/filebrowser/browser.js
blob: 6e7527226d52bbcb30cd607a6191bc6d6e3be4b4 (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
$(document).ready(
	function() {
		$("#fbOpen").click(
			function() {
				$("#fbBrowser").fadeIn(750);
				fbBrowse($("#fbTarget").val());
			}
		);
	}
);

function fbBrowse(path) {
	$("#fileContent").fadeOut();

	if ($("#fbCurrentDir")) {
		$("#fbCurrentDir").html("Loading ...");
	}

	$.ajax(
		"/filebrowser/browser.php?path=" + encodeURI(path ? path : "/"),
		{ type: "get", complete: fbComplete }
	);

}

function fbComplete(req) {
	$("#fbBrowser").html(req.responseText);

	var actions = {
		fbHome:  function() { fbBrowse("/");                                },
		fbClose: function() { $("#fbBrowser").fadeOut(750); },
		fbDir:   function() { fbBrowse(this.id);                            },
		fbFile:  function() { $("#fbTarget").val(this.id);             }
	}

	for (var type in actions) {
		$("#fbBrowser ." + type).each(
			function() {
				$(this).click(actions[type]);
				$(this).css("cursor","pointer");
			}
		);
	}
}
OpenPOWER on IntegriCloud