-
Notifications
You must be signed in to change notification settings - Fork 10
/
index-classic.html
301 lines (301 loc) · 12 KB
/
index-classic.html
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CTList</title>
<style>
@font-face{
font-family: 'icomoon';
src : url("data:application/x-font-woff;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBwQAAAC8AAAAYGNtYXDTrtL+AAABHAAAAGxnYXNwAAAAEAAAAYgAAAAIZ2x5Zizg66wAAAGQAAACOGhlYWQXasWNAAADyAAAADZoaGVhB8IDyQAABAAAAAAkaG10eBYAAJMAAAQkAAAAIGxvY2ECEgFAAAAERAAAABJtYXhwAA8AZgAABFgAAAAgbmFtZZlKCfsAAAR4AAABhnBvc3QAAwAAAAAGAAAAACAAAwOaAZAABQAAApkCzAAAAI8CmQLMA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AADwP/AAAAEAAAAAAAEAAABAAAAAAAAAAAAAAAAAAAACAQAAAAAAAAAAAAAAAIAAAAEAAAABAAAQAQAAAAEAABTAAAAAAAKABQAHgBCAM4A6gEcAAAAAQAAAAgAZAAGAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGljb21vb24AaQBjAG8AbQBvAG8AblZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGljb21vb24AaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AblJlZ3VsYXIAUgBlAGcAdQBsAGEAcmljb21vb24AaQBjAG8AbQBvAG8AbkZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=") format('woff');
font-weight: normal;
font-style: normal;
font-display: block;
}
[class^="icon-"], [class*=" icon-"] {
font-family: 'icomoon' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-home:before {
content: "\e900";
}
.icon-folder-open:before {
content: "\e930";
}
.icon-file-text2:before {
content: "\e926";
}
.icon-arrow-left2:before {
content: "\ea40";
}
body {
background-color: rgb(247, 247, 249);
}
h1 {
text-align: center;
color: rgb(51, 51, 51);
font-size: 28px;
letter-spacing: 2px;
line-height: 64px;
}
h3 a:hover{
text-decoration: underline;
}
a {
text-decoration: none;
color: black;
}
table {
table-layout: fixed;
word-break: break-all;
}
th {
font-weight: bold;
text-align: right;
}
th:first-child {
text-align: left;
padding: 5px;
padding-left: 25px;
width: 68%;
}
th:nth-child(2),th:nth-child(3),td:nth-child(2),td:nth-child(3){
text-align: right;
width: 20%;
}
th:nth-child(3),td:nth-child(3){
width: 12%;
}
td {
font-weight: normal;
padding-top: 5px;
padding-bottom: 5px;
}
td:first-child{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
td:first-child:hover {
overflow: visible;
text-overflow: clip;
font-weight: bold;
white-space: normal;
}
.list-wrapper {
width: 80%;
margin: 0 auto;
margin-bottom: 40px;
position: relative;
box-shadow: 0 0 32px 0 rgba(0, 0, 0, 0.1);
}
.header-container {
margin: 0;
border: 0 none;
padding: 5px 50px 10px;
text-align: left;
font-weight: normal;
color: #000000;
background-color: #f7f7f9;
}
.list-body-container {
left: 0;
overflow-x: hidden;
overflow-y: auto;
box-sizing: border-box;
background: white;
position: relative;
}
.list-table {
width: 100%;
padding: 15px;
border-spacing: 0;
}
.item:hover {
background-color: gainsboro;
}
#back{
position: absolute;
top: 35px;
right: 35px;
}
#search{
margin: 0;
border: 0 none;
border-radius:15px;
width: 100%;
padding: 5px 10px;
text-align: left;
font-size: inherit;
color: #000000;
background-color: white;
outline: none;
}
</style>
</head>
<body>
<h1>
<span onclick="Goto(RootPath);">CTList</span>
</h1>
<div class="list-wrapper">
<div class="list-container">
<div class="header-container">
<h3>CTList Local Path</h3>
<span id="back" class="icon-arrow-left2" onclick="Goto(Back());"></span>
<div class="search-container">
<input id="search" oninput="Search();" placeholder="Search" />
</div>
</div>
<div class="list-body-container">
<table class="list-table">
<tr class="list-title">
<th onclick="View('name');">文件</th>
<th onclick="View('date');">时间</th>
<th onclick="View('size');">大小</th>
</tr>
</table>
</div>
</div>
</div>
<script>
var RootPath = "{{.RootPath}}";
var CurrentPath = "{{.CurrentPath}}";
var RawData = "{{.RawData}}";
var Reverse = false;
var PageData = JSON.parse(window.atob(RawData));
var ArrayPath = new Array();
var ArrayFloder = new Array();
var ArrayFile = new Array();
if (CurrentPath === "/"){ CurrentPath = "" }
for(let item in PageData){
if (item.indexOf("@") == 0) { continue }
if (PageData[item]['@type'] == 'file') {
ArrayFile.push(PageData[item]);
} else if (PageData[item]['@type'] == 'folder') {
ArrayFloder.push(PageData[item]);
}
}
function Goto(thePath) {window.location.href = thePath;}
function SizeNum(Size) {
let dataArray = Size.split(" ", 2);
let dataNum = 0;
switch (dataArray[1]) {
case "B":
dataNum = Math.pow(2, 0) * dataArray[0];
break;
case "KB":
dataNum = Math.pow(2, 10) * dataArray[0];
break;
case "MB":
dataNum = Math.pow(2, 20) * dataArray[0];
break;
case "GB":
dataNum = Math.pow(2, 30) * dataArray[0];
break;
case "TB":
dataNum = Math.pow(2, 40) * dataArray[0];
break;
case "PB":
dataNum = Math.pow(2, 50) * dataArray[0];
break;
default:
dataNum = 0;
}
return dataNum;
}
function compare(property) {
if (property === "size") {
return function(a,b){
let value0 = SizeNum(a[property].toUpperCase());
let value1 = SizeNum(b[property].toUpperCase());
return value0 - value1;
}
} else {
return function(a,b){
let value0 = a[property].toLowerCase();
let value1 = b[property].toLowerCase();
return value0.localeCompare(value1);
}
}
}
function Clear() {
let ClassList = new Array("item");
for(let item in ClassList){
let Elem = document.getElementsByClassName(ClassList[item]);
for(let i = Elem.length-1; i >= 0 ; i--) {
Elem[i].parentNode.removeChild(Elem[i]);
}
}
let ElemH3 = document.getElementsByTagName("h3")[0];
let newH3 = document.createElement("h3");
let localPath = CurrentPath.trim().replace(/^\//, "").replace(/\/$/, "");
let localHtmlArray = new Array();
localHtmlArray.push("<a href='//" + window.location.host + RootPath + "'>" + '<span class="icon-home"></span>' + "</a>");
if (localPath !== "" ){
let localPathArray = localPath.split("/");
let localHref = "";
for(let j=0; j<localPathArray.length; j++){
localHref += "/" + localPathArray[j];
if (j === 0 && RootPath !== "/"){ continue }
localHtmlArray.push("<a href='//" + window.location.host + localHref + "'>" + localPathArray[j] + "</a>");
}
}
ElemH3.innerHTML = localHtmlArray.join(" / ");
ArrayPath = localHtmlArray;
}
function Back() {
let Num = ArrayPath.length - 1;
let ElemNum = 0;
let ElemBack = document.createElement("div");
if (Num > 0){ElemNum = Num - 1;}
ElemBack.innerHTML = ArrayPath[ElemNum];
return ElemBack.childNodes[0].href
}
function Search() {
let searchVal = document.getElementById("search").value;
if (searchVal === undefined){ return; } else { searchVal = searchVal.toString().toLowerCase(); }
let ShowArray = document.getElementsByClassName("item");
for(i=0; i<ShowArray.length; i++){
let FocusElem = ShowArray[i].children[0].getElementsByTagName("a");
if (FocusElem !== undefined && FocusElem.length === 1){
let newAttr = "table-row";
if (FocusElem[0].textContent.toLowerCase().indexOf(searchVal) < 0) { newAttr = "none"; }
ShowArray[i].style.display = newAttr;
}
}
}
function View(Property) {
ArrayFloder.sort(compare(Property));
ArrayFile.sort(compare(Property));
if (Reverse) {
ArrayFloder.reverse();
ArrayFile.reverse();
}
Reverse = !(Reverse);
Clear();
let Elem = document.getElementsByClassName("list-table")[0];
let ArrayItem = ArrayFloder.concat(ArrayFile);
for(let item in ArrayItem){
let newChild = document.createElement("tr");
let iconHtml = "";
if (ArrayItem[item]['@type'] == 'folder') {
iconHtml = '<span class="icon-folder-open"> </span>';
} else if (ArrayItem[item]['@type'] == 'file') {
iconHtml = '<span class="icon-file-text2"> </span>';
} else { continue }
newChild.setAttribute('class', 'item');
let ItemName = decodeURIComponent(ArrayItem[item]['name']);
newChild.innerHTML = "<td class=\"list-data\">" + iconHtml + "<a href='//" + window.location.host + CurrentPath + "/" + ItemName +"'>" + ItemName + "</a></td><td class=\"list-data\">" + ArrayItem[item]['date'] + "</td><td class=\"list-data\">" + ArrayItem[item]['size'] + "</td>";
Elem.lastChild.appendChild(newChild);
}
}
window.onload = View("name");
</script>
</body>
</html>