-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
117 lines (97 loc) · 3.07 KB
/
index.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
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>TardiBox</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/filepond-plugin-image-preview.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/filepond.min.css">
<style>
body {
max-width: 20em;
margin: 30vh auto;
padding: 0 .5em .5em;
font-family: Arial, Helvetica, sans-serif;
line-height: 2;
text-align: center;
}
.filepond--panel-root {
border-radius: 2em;
background-color: #edf0f4;
height: 1em;
}
.filepond--drip-blob {
background-color: #7f8a9a;
}
.filepond--drop-label {
color: #4c4e53;
}
.filepond--label-action {
text-decoration-color: #babdc0;
}
.filepond--item-panel {
background-color: #595e68;
}
#maximumDownloadCount {
width: 75px;
}
button {
margin: 16px 0 0;
border: 1px solid #2582ff;
border-radius: 4px;
padding: 10px 24px;
background-color: #fff;
color: #2582ff;
font-weight: bold;
cursor: pointer;
transition: all .15s ease-in-out;
}
button:hover {
background-color: #2582ff;
color: #fff;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/filepond-plugin-image-preview.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/filepond.min.js"></script>
<script>
(function (onReady) {
if (document.attachEvent ? document.readyState === 'complete' : document.readyState !== 'loading')
onReady()
else
document.addEventListener('DOMContentLoaded', onReady)
})(function () {
FilePond.registerPlugin(FilePondPluginImagePreview)
var maximumDownloadCount = document.getElementById('maximumDownloadCount')
, expiryDateAndTime = document.getElementById('expiryDateAndTime')
, server = 'http://localhost'
, uploader = FilePond.create(document.getElementById('uploadArea'), {
credits: false
, server
, chunkUploads: true
, chunkForce: true
, chunkSize: Math.pow(2, 2 * 10)
, instantUpload: false
, allowRevert: false
})
;[maximumDownloadCount, expiryDateAndTime].forEach(function (element) {
element.addEventListener('change', function () {
uploader.server.url = server + '?'
+ 'maximumDownloadCount' + '=' + maximumDownloadCount.value
+ (expiryDateAndTime.value ?
'&' + 'expiryDateAndTime' + '=' + new Date(expiryDateAndTime.value).toISOString()
: '')
})
})
document.getElementById('uploadButton').addEventListener('click', function () {
uploader.processFiles()
})
})
</script>
</head>
<body>
<input id="uploadArea" type="file" multiple data-allow-reorder>
Maximum download count: <input id="maximumDownloadCount" type="number" min="1">
<br>Expiry time: <input id="expiryDateAndTime" type="datetime-local">
<br><button id="uploadButton" type="button">Upload</button>
</body>
</html>