scratch – Diff between revs 10 and 18
?pathlinks?
Rev 10 | Rev 18 | |||
---|---|---|---|---|
1 | <!DOCTYPE html> |
1 | <!DOCTYPE html> |
|
2 | <html lang="en"> |
2 | <html lang="en"> |
|
3 | <head> |
3 | <head> |
|
4 | <meta charset="utf-8"> |
4 | <meta charset="utf-8"> |
|
5 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
5 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|
6 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
6 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
|
7 | <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> |
7 | <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> |
|
8 | <meta name="description" content="quick file upload"> |
8 | <meta name="description" content="quick file upload"> |
|
9 | <meta name="author" content="Wizardry and Steamworks"> |
9 | <meta name="author" content="Wizardry and Steamworks"> |
|
10 | <link rel="icon" href="favicon.ico"> |
10 | <link rel="icon" href="favicon.ico"> |
|
11 | |
11 | |
|
12 | <title>Quickload</title> |
12 | <title>Quickload</title> |
|
13 | |
13 | |
|
14 | <!-- Bootstrap core CSS --> |
14 | <!-- Bootstrap core CSS --> |
|
15 | <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet"> |
15 | <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet"> |
|
16 | |
16 | |
|
17 | <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> |
17 | <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> |
|
18 | <link href="css/bootstrap/ie10-viewport-bug-workaround.css" rel="stylesheet"> |
18 | <link href="css/bootstrap/ie10-viewport-bug-workaround.css" rel="stylesheet"> |
|
19 | |
19 | |
|
20 | <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> |
20 | <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> |
|
21 | <!--[if lt IE 9]><script src="js/bootstrap/ie8-responsive-file-warning.js"></script><![endif]--> |
21 | <!--[if lt IE 9]><script src="js/bootstrap/ie8-responsive-file-warning.js"></script><![endif]--> |
|
22 | <script src="js/bootstrap/ie-emulation-modes-warning.js"></script> |
22 | <script src="js/bootstrap/ie-emulation-modes-warning.js"></script> |
|
23 | |
23 | |
|
24 | <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> |
24 | <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> |
|
25 | <!--[if lt IE 9]> |
25 | <!--[if lt IE 9]> |
|
26 | <script src="js/bootstrap/html5shiv.min.js"></script> |
26 | <script src="js/bootstrap/html5shiv.min.js"></script> |
|
27 | <script src="js/bootstrap/respond.min.js"></script> |
27 | <script src="js/bootstrap/respond.min.js"></script> |
|
28 | <![endif]--> |
28 | <![endif]--> |
|
29 | |
29 | |
|
30 | <!-- DropZone --> |
30 | <!-- DropZone --> |
|
31 | <link href="css/dropzone/dropzone.min.css" rel="stylesheet"> |
31 | <link href="css/dropzone/dropzone.min.css" rel="stylesheet"> |
|
32 | <!-- Local style --> |
32 | <!-- Local style --> |
|
33 | <link href="css/style.css" rel="stylesheet"> |
33 | <link href="css/style.css" rel="stylesheet"> |
|
34 | </head> |
34 | </head> |
|
35 | |
35 | |
|
36 | <body> |
36 | <body> |
|
37 | |
37 | |
|
38 | <div class="container"> |
38 | <div class="container"> |
|
39 | |
39 | |
|
40 | <!-- Main component for a primary marketing message or call to action --> |
40 | <!-- Main component for a primary marketing message or call to action --> |
|
41 | <div class="jumbotron"> |
41 | <div class="jumbotron"> |
|
42 | <h1>Quickload</h1> |
42 | <h1>Quickload</h1> |
|
43 | <p>HTTP template for sharing assets.</p> |
43 | <p>Asset sharing platform.</p> |
|
44 | </div> |
44 | </div> |
|
45 | |
45 | |
|
46 | <ul class="nav nav-tabs"> |
46 | <ul class="nav nav-tabs"> |
|
47 | <li class="active"><a href="#">Files</a></li> |
47 | <li class="active"><a href="#">Files</a></li> |
|
48 | </ul> |
48 | </ul> |
|
49 | |
49 | |
|
50 | <div id="actions" class="row"> |
50 | <div id="actions" class="row"> |
|
51 | |
51 | |
|
52 | <div class="col-lg-7"> |
52 | <div class="col-lg-7"> |
|
53 | <!-- The fileinput-button span is used to style the file input field as button --> |
53 | <!-- The fileinput-button span is used to style the file input field as button --> |
|
54 | <span class="btn btn-success fileinput-button"> |
54 | <span class="btn btn-success fileinput-button"> |
|
55 | <i class="glyphicon glyphicon-plus"></i> |
55 | <i class="glyphicon glyphicon-plus"></i> |
|
56 | <span>Add files...</span> |
56 | <span>Add files...</span> |
|
57 | </span> |
57 | </span> |
|
58 | <button type="submit" class="btn btn-primary start"> |
58 | <button type="submit" class="btn btn-primary start"> |
|
59 | <i class="glyphicon glyphicon-upload"></i> |
59 | <i class="glyphicon glyphicon-upload"></i> |
|
60 | <span>Start upload</span> |
60 | <span>Start upload</span> |
|
61 | </button> |
61 | </button> |
|
62 | <button type="reset" class="btn btn-warning cancel"> |
62 | <button type="reset" class="btn btn-warning cancel"> |
|
63 | <i class="glyphicon glyphicon-ban-circle"></i> |
63 | <i class="glyphicon glyphicon-ban-circle"></i> |
|
64 | <span>Cancel upload</span> |
64 | <span>Cancel upload</span> |
|
65 | </button> |
65 | </button> |
|
66 | </div> |
66 | </div> |
|
67 | |
67 | |
|
68 | <div class="col-lg-5"> |
68 | <div class="col-lg-5"> |
|
69 | <!-- The global file processing state --> |
69 | <!-- The global file processing state --> |
|
70 | <span class="fileupload-process"> |
70 | <span class="fileupload-process"> |
|
71 | <div id="total-progress" class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"> |
71 | <div id="total-progress" class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"> |
|
72 | <div class="progress-bar progress-bar-success" style="width:0%;" data-dz-uploadprogress></div> |
72 | <div class="progress-bar progress-bar-success" style="width:0%;" data-dz-uploadprogress></div> |
|
73 | </div> |
73 | </div> |
|
74 | </span> |
74 | </span> |
|
75 | </div> |
75 | </div> |
|
76 | |
76 | |
|
77 | </div> |
77 | </div> |
|
78 | <div class="table table-striped files" id="previews"> |
78 | <div class="table table-striped files" id="previews"> |
|
79 | |
79 | |
|
80 | <div id="template" class="file-row"> |
80 | <div id="template" class="file-row"> |
|
81 | <!-- This is used as the file preview template --> |
81 | <!-- This is used as the file preview template --> |
|
82 | <div> |
82 | <div> |
|
83 | <span class="preview"><img data-dz-thumbnail /></span> |
83 | <span class="preview"><img data-dz-thumbnail /></span> |
|
84 | </div> |
84 | </div> |
|
85 | <div> |
85 | <div> |
|
86 | <p id="name" class="name" data-dz-name></p> |
86 | <p id="name" class="name" data-dz-name></p> |
|
87 | <input id="URL" type="text" class='form-control' readonly> |
87 | <input id="URL" type="text" class='form-control' readonly> |
|
88 | <span class="input-group-button"> |
88 | <span class="input-group-button"> |
|
89 | <button id="clippy" class="btn clipBtn" type="button"> |
89 | <button id="clippy" class="btn clipBtn" class='form-control' type="button"> |
|
90 | <img class="clippy" src="img/clipboard/clippy.svg" width="13" alt="Copy to clipboard"> |
90 | <img class="clippy" src="img/clipboard/clippy.svg" width="13" alt="Copy to clipboard"> |
|
91 | </button> |
91 | </button> |
|
92 | </span> |
92 | </span> |
|
93 | <strong class="error text-danger" data-dz-errormessage></strong> |
93 | <strong class="error text-danger" data-dz-errormessage></strong> |
|
94 | </div> |
94 | </div> |
|
95 | <div> |
95 | <div> |
|
96 | <p class="size" data-dz-size></p> |
96 | <p class="size" data-dz-size></p> |
|
97 | <div id="progress" class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"> |
97 | <div id="progress" class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"> |
|
98 | <div class="progress-bar progress-bar-success" style="width:0%;" data-dz-uploadprogress></div> |
98 | <div class="progress-bar progress-bar-success" style="width:0%;" data-dz-uploadprogress></div> |
|
99 | </div> |
99 | </div> |
|
100 | </div> |
100 | </div> |
|
101 | <div> |
101 | <div> |
|
102 | <button class="btn btn-primary start"> |
102 | <button class="btn btn-primary start"> |
|
103 | <i class="glyphicon glyphicon-upload"></i> |
103 | <i class="glyphicon glyphicon-upload"></i> |
|
104 | <span>Start</span> |
104 | <span>Start</span> |
|
105 | </button> |
105 | </button> |
|
106 | <button data-dz-remove class="btn btn-warning cancel"> |
106 | <button data-dz-remove class="btn btn-warning cancel"> |
|
107 | <i class="glyphicon glyphicon-ban-circle"></i> |
107 | <i class="glyphicon glyphicon-ban-circle"></i> |
|
108 | <span>Cancel</span> |
108 | <span>Cancel</span> |
|
109 | </button> |
109 | </button> |
|
110 | <button data-dz-remove class="btn btn-danger delete"> |
110 | <button data-dz-remove class="btn btn-danger delete"> |
|
111 | <i class="glyphicon glyphicon-trash"></i> |
111 | <i class="glyphicon glyphicon-trash"></i> |
|
112 | <span>Delete</span> |
112 | <span>Delete</span> |
|
113 | </button> |
113 | </button> |
|
114 | </div> |
114 | </div> |
|
115 | </div> |
115 | </div> |
|
116 | |
116 | |
|
117 | </div> |
117 | </div> |
|
118 | |
118 | |
|
119 | </div> <!-- /container --> |
119 | </div> <!-- /container --> |
|
120 | |
120 | |
|
121 | <div id="footer"> |
121 | <div id="footer"> |
|
122 | <div class="container"> |
122 | <div class="container"> |
|
123 | <p class="text-muted credit">Copyright <i class="glyphicon glyphicon-copyright-mark"></i> 2017 <a href="http://grimore.org">Wizardry and Steamworks</a>.</p> |
123 | <p class="text-muted credit">Copyright <i class="glyphicon glyphicon-copyright-mark"></i> 2017 <a href="http://grimore.org">Wizardry and Steamworks</a>.</p> |
|
124 | </div> |
124 | </div> |
|
125 | </div> |
125 | </div> |
|
126 | |
126 | |
|
127 | <script src="js/jquery/jquery.min.js"></script> |
127 | <script src="js/jquery/jquery.min.js"></script> |
|
128 | <script src="js/bootstrap/bootstrap.min.js"></script> |
128 | <script src="js/bootstrap/bootstrap.min.js"></script> |
|
129 | <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> |
129 | <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> |
|
130 | <script src="js/bootstrap/ie10-viewport-bug-workaround.js"></script> |
130 | <script src="js/bootstrap/ie10-viewport-bug-workaround.js"></script> |
|
131 | |
131 | |
|
132 | <!-- DropZone --> |
132 | <!-- DropZone --> |
|
133 | <script src="js/dropzone/dropzone.min.js"></script> |
133 | <script src="js/dropzone/dropzone.min.js"></script> |
|
134 | <!-- <script src="js/dropzone/dropzone-amd-module.min.js"></script> --> |
134 | <!-- <script src="js/dropzone/dropzone-amd-module.min.js"></script> --> |
|
135 | <!-- Clipboard --> |
135 | <!-- Clipboard --> |
|
136 | <script src="js/clipboard/clipboard.min.js"></script> |
136 | <script src="js/clipboard/clipboard.min.js"></script> |
|
137 | <script> |
137 | <script> |
|
138 | $(document).ready(function(){ |
138 | $(document).ready(function(){ |
|
139 | // Get the template HTML and remove it from the doument |
139 | // Get the template HTML and remove it from the doument |
|
140 | var previewNode = document |
140 | var previewNode = document |
|
141 | .querySelector("#template"); |
141 | .querySelector("#template"); |
|
142 | previewNode.id = ""; |
142 | previewNode.id = ""; |
|
143 | var previewTemplate = previewNode |
143 | var previewTemplate = previewNode |
|
144 | .parentNode |
144 | .parentNode |
|
145 | .innerHTML; |
145 | .innerHTML; |
|
146 | previewNode |
146 | previewNode |
|
147 | .parentNode |
147 | .parentNode |
|
148 | .removeChild(previewNode); |
148 | .removeChild(previewNode); |
|
149 | |
149 | |
|
150 | var myDropzone = new Dropzone(document.body, { // Make the whole body a dropzone |
150 | var myDropzone = new Dropzone(document.body, { // Make the whole body a dropzone |
|
151 | url: "upload.php", // Set the url |
151 | url: "upload.php", // Set the url |
|
152 | paramName: "file", |
152 | paramName: "file", |
|
153 | thumbnailWidth: 80, |
153 | thumbnailWidth: 80, |
|
154 | thumbnailHeight: 80, |
154 | thumbnailHeight: 80, |
|
155 | parallelUploads: 20, |
155 | parallelUploads: 20, |
|
156 | previewTemplate: previewTemplate, |
156 | previewTemplate: previewTemplate, |
|
157 | autoQueue: false, // Make sure the files aren't queued until manually added |
157 | autoQueue: false, // Make sure the files aren't queued until manually added |
|
158 | previewsContainer: "#previews", // Container to display the previews |
158 | previewsContainer: "#previews", // Container to display the previews |
|
159 | clickable: ".fileinput-button" // Element that should be used as click trigger to select files. |
159 | clickable: ".fileinput-button" // Element that should be used as click trigger to select files. |
|
160 | }); |
160 | }); |
|
161 | |
161 | |
|
162 | myDropzone.on("addedfile", (file) => { |
162 | myDropzone.on("addedfile", (file) => { |
|
163 | // Hookup the start button |
163 | // Hookup the start button |
|
164 | file.previewElement.querySelector(".start").onclick = () => { |
164 | file.previewElement.querySelector(".start").onclick = () => { |
|
165 | myDropzone.enqueueFile(file); |
165 | myDropzone.enqueueFile(file); |
|
166 | }; |
166 | }; |
|
167 | }); |
167 | }); |
|
168 | |
168 | |
|
169 | // Update the total progress bar |
169 | // Update the total progress bar |
|
170 | myDropzone.on("totaluploadprogress", (progress) => { |
170 | myDropzone.on("totaluploadprogress", (progress) => { |
|
171 | document |
171 | document |
|
172 | .querySelector("#total-progress .progress-bar") |
172 | .querySelector("#total-progress .progress-bar") |
|
173 | .style |
173 | .style |
|
174 | .width = progress + "%"; |
174 | .width = progress + "%"; |
|
175 | }); |
175 | }); |
|
176 | |
176 | |
|
177 | myDropzone.on("sending", (file) => { |
177 | myDropzone.on("sending", (file) => { |
|
178 | // Show the total progress bar when upload starts |
178 | // Show the total progress bar when upload starts |
|
179 | document.querySelector("#total-progress") |
179 | document.querySelector("#total-progress") |
|
180 | .style |
180 | .style |
|
181 | .opacity = 1; |
181 | .opacity = 1; |
|
182 | |
182 | |
|
183 | // And disable the start button. |
183 | // And disable the start button. |
|
184 | file |
184 | file |
|
185 | .previewElement |
185 | .previewElement |
|
186 | .querySelector(".start") |
186 | .querySelector(".start") |
|
187 | .setAttribute("disabled", "disabled"); |
187 | .setAttribute("disabled", "disabled"); |
|
188 | }); |
188 | }); |
|
189 | |
189 | |
|
190 | // Hide the total progress bar when nothing's uploading anymore |
190 | // Hide the total progress bar when nothing's uploading anymore |
|
191 | myDropzone.on("queuecomplete", (progress) => { |
191 | myDropzone.on("queuecomplete", (progress) => { |
|
192 | document.querySelector("#total-progress") |
192 | document.querySelector("#total-progress") |
|
193 | .style |
193 | .style |
|
194 | .opacity = "0"; |
194 | .opacity = "0"; |
|
195 | }); |
195 | }); |
|
196 | |
196 | |
|
197 | // Display the URL of the file. |
197 | // Display the URL of the file. |
|
198 | myDropzone.on("success", (file, data) => { |
198 | myDropzone.on("success", (file, data) => { |
|
199 | |
199 | |
|
200 | var boxURLID = '_' + Math.random().toString(36).substr(2, 9); |
200 | var boxURLID = '_' + Math.random().toString(36).substr(2, 9); |
|
201 | file |
201 | file |
|
202 | .previewElement |
202 | .previewElement |
|
203 | .querySelector("#URL") |
203 | .querySelector("#URL") |
|
204 | .value = data; |
204 | .value = data; |
|
205 | |
205 | |
|
206 | file |
206 | file |
|
207 | .previewElement |
207 | .previewElement |
|
208 | .querySelector("#URL") |
208 | .querySelector("#URL") |
|
209 | .setAttribute('id', boxURLID) |
209 | .setAttribute('id', boxURLID) |
|
210 | |
210 | |
|
211 | // Clipboard button. |
211 | // Clipboard button. |
|
212 | clipButtonID = '_' + Math.random().toString(36).substr(2, 9); |
212 | clipButtonID = '_' + Math.random().toString(36).substr(2, 9); |
|
213 | file |
213 | file |
|
214 | .previewElement |
214 | .previewElement |
|
215 | .querySelector("#clippy") |
215 | .querySelector("#clippy") |
|
216 | .setAttribute('data-clipboard-target', '#' + boxURLID) |
216 | .setAttribute('data-clipboard-target', '#' + boxURLID) |
|
217 | |
217 | |
|
218 | file |
218 | file |
|
219 | .previewElement |
219 | .previewElement |
|
220 | .querySelector("#clippy") |
220 | .querySelector("#clippy") |
|
221 | .setAttribute('id', clipButtonID); |
221 | .setAttribute('id', clipButtonID); |
|
222 | |
222 | |
|
223 | new Clipboard('#' + clipButtonID); |
223 | new Clipboard('#' + clipButtonID); |
|
224 | }); |
224 | }); |
|
225 | |
225 | |
|
226 | // Setup the buttons for all transfers |
226 | // Setup the buttons for all transfers |
|
227 | // The "add files" button doesn't need to be setup because the config |
227 | // The "add files" button doesn't need to be setup because the config |
|
228 | // `clickable` has already been specified. |
228 | // `clickable` has already been specified. |
|
229 | document.querySelector("#actions .start").onclick = function() { |
229 | document.querySelector("#actions .start").onclick = function() { |
|
230 | myDropzone.enqueueFiles(myDropzone.getFilesWithStatus(Dropzone.ADDED)); |
230 | myDropzone.enqueueFiles(myDropzone.getFilesWithStatus(Dropzone.ADDED)); |
|
231 | }; |
231 | }; |
|
232 | document.querySelector("#actions .cancel").onclick = function() { |
232 | document.querySelector("#actions .cancel").onclick = function() { |
|
233 | myDropzone.removeAllFiles(true); |
233 | myDropzone.removeAllFiles(true); |
|
234 | }; |
234 | }; |
|
235 | }); |
235 | }); |
|
236 | </script> |
236 | </script> |
|
237 | </body> |
237 | </body> |
|
238 | </html> |
238 | </html> |
|
239 | |
239 | |