1
0
forked from x/ContextOS
ContextOS/usr/up.html
2018-05-22 01:07:09 +08:00

80 lines
1.6 KiB
HTML

<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<style>
th {
cursor:pointer;
background-color:lightgray;
}
.time {
padding-right:20px;
}
.size {
text-align:right;
padding-right:20px;
}
.name {
padding-left:10px;
text-align:left;
}
code {
font-size:14px;
}
</style>
</head>
<body>
<form method="POST" action="/upload" enctype="multipart/form-data">
<fieldset><legend>upload</legend>
<input type="file" name="file"><input type="submit">
</fieldset>
<fieldset><legend>message</legend>
{{index . "message"}}
</fieldset>
</form>
<table>
<colgroup>{{range .append}}<col class="{{.}}">{{end}}</colgroup>
<tr>{{range .append}}<th class="{{.}}" onclick="list('{{.}}')">{{.}}</th>{{end}}</tr>
{{$meta := .}} {{$first := index .append 0}}
{{range $i, $k := index . $first}}
<tr>
{{range $key := index $meta "append"}}
{{if eq $key "name"}}
<td class="{{$key}}">
<a href="/upload?file={{index $meta "file" 0}}/{{index $meta $key $i}}"><code>{{index $meta $key $i}}</code></a>
</td>
{{else}}
<td class="{{$key}}">
<code>{{index $meta $key $i}}</code>
</td>
{{end}}
{{end}}
</tr>
{{end}}
</table>
<script>
function Cookie(name, value) {
if (value == undefined) {
var pattern = new RegExp(name+"=([^;]*);?");
var result = pattern.exec(document.cookie);
if (result && result.length > 0) {
return result[1];
}
return ""
}
document.cookie = name+"="+value;
return Cookie(name);
}
function list(what) {
Cookie("list", what);
Cookie("order", Cookie("order")*1 + 1)
location.assign(location.href)
}
</script>
</body>