-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
66 lines (64 loc) · 1.98 KB
/
index.php
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
<html>
<head>
<meta charset="UTF-8">
<title>PHP Workspace</title>
<script src="//code.jquery.com/jquery.js"></script>
<style>
li {
height: 20px;
overflow: hidden;
}
li>span {
display : inline-block;
height: 20px;
width: 20px;
cursor: pointer;
}
li>span:hover {
background-color: lightgray;
}
a.file {
margin-left: 20px;
}
</style>
</head>
<body>
<?php
echo "<h1>Online</h1>";
$dirname = './';
listeDir($dirname);
function listeDir($dirname) {
$noList = array('.', '..', 'nbproject', '.git');
echo "<ul>";
$dir = opendir($dirname);
while ($file = readdir($dir)) {
if (!in_array($file, $noList)) {
if (is_dir($dirname . $file)) {
echo '<li><span>></span><a class="dir" href="' . $dirname . $file . '">' . $file . '</a><br/>';
listeDir($dirname . $file . '/');
echo "</li>";
} else {
echo '<li><a class="file" href="' . $dirname . $file . '">' . $file . '</a></li>';
}
}
}
echo "</ul>";
closedir($dir);
}
?>
<script>
$(document).ready(function(){
$("li>span").click(function(){
if( $(this).html() == "V" ) {
$(this).html(">");
$(this).parent("li").css("height","20px");
}
else {
$(this).html("V");
$(this).parent("li").css("height","auto");
}
});
});
</script>
</body>
</head>