Update templates/files.html
Browse files- templates/files.html +16 -3
templates/files.html
CHANGED
@@ -6,10 +6,18 @@
|
|
6 |
<style>
|
7 |
ul {
|
8 |
list-style-type: none;
|
|
|
9 |
}
|
10 |
li {
|
11 |
cursor: pointer;
|
12 |
margin: 5px 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
</style>
|
15 |
</head>
|
@@ -29,11 +37,16 @@
|
|
29 |
function openItem(item) {
|
30 |
const currentPath = "{{ current_path }}";
|
31 |
const newPath = currentPath ? currentPath + '/' + item : item;
|
|
|
|
|
|
|
32 |
const isDir = item.includes('.'); // 简单判断是否为文件
|
33 |
-
if (isDir) {
|
34 |
-
|
|
|
35 |
} else {
|
36 |
-
|
|
|
37 |
}
|
38 |
}
|
39 |
</script>
|
|
|
6 |
<style>
|
7 |
ul {
|
8 |
list-style-type: none;
|
9 |
+
padding: 0;
|
10 |
}
|
11 |
li {
|
12 |
cursor: pointer;
|
13 |
margin: 5px 0;
|
14 |
+
padding: 5px;
|
15 |
+
border: 1px solid #ccc;
|
16 |
+
border-radius: 4px;
|
17 |
+
background-color: #f9f9f9;
|
18 |
+
}
|
19 |
+
li:hover {
|
20 |
+
background-color: #e9e9e9;
|
21 |
}
|
22 |
</style>
|
23 |
</head>
|
|
|
37 |
function openItem(item) {
|
38 |
const currentPath = "{{ current_path }}";
|
39 |
const newPath = currentPath ? currentPath + '/' + item : item;
|
40 |
+
const fullPath = '/files/' + newPath;
|
41 |
+
|
42 |
+
// Check if the item is a directory or a file
|
43 |
const isDir = item.includes('.'); // 简单判断是否为文件
|
44 |
+
if (!isDir) {
|
45 |
+
// 如果是目录,导航到该目录
|
46 |
+
location.href = fullPath;
|
47 |
} else {
|
48 |
+
// 如果是文件,下载该文件
|
49 |
+
location.href = fullPath + '/' + item;
|
50 |
}
|
51 |
}
|
52 |
</script>
|