aboutsummaryrefslogtreecommitdiffstats
path: root/files/js/files.js
blob: 9eeeb7f6bfd23d15aef95b6a59da8fa3f3a3c0f1 (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
$(document).ready(function() {
    // Sets browser table behaviour :
    $('.browser tr').hover(
        function() {
            $(this).addClass('mouseOver');
        },
        function() {
            $(this).removeClass('mouseOver');
        }
    );

    // Sets logs table behaviour :
    $('.logs tr').hover(
        function() {
            $(this).addClass('mouseOver');
        },
        function() {
            $(this).removeClass('mouseOver');
        }
    );

    // Sets the file-action buttons behaviour :
    $('td.fileaction a').click(function() {
        $(this).parent().append($('#file_menu'));
        $('#file_menu').slideToggle(250);
        return false;
    });

    // Sets the select_all checkbox behaviour :
    $('#select_all').click(function() {

        if($(this).attr('checked'))
            // Check all
            $('.browser input:checkbox').attr('checked', true);
        else
            // Uncheck all
            $('.browser input:checkbox').attr('checked', false);
    });
	
	// Shows and hides file upload form
    $('#file_upload_button').toggle(function() {
		$('#file_upload_form').css({"display":"block"});
    }, function() {
		$('#file_upload_form').css({"display":"none"});
	});
	
	$('#file_upload_start').click(function() {		
		$('#file_upload_target').load(uploadFinished);
	});
});

function uploadFinished() {
	result = $('#file_upload_target').contents().text();
	result = eval("(" + result + ");");
	if(result.status == "error") {
		alert('An error occcured, upload failed.\nError code: ' + result.data.error);
	} else {
		location.href = 'index.php?dir=' + $('#dir').val();
	}
}