scratch – Diff between revs 81 and 84

Subversion Repositories:
Rev:
Only display areas with differencesRegard whitespace
Rev 81 Rev 84
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 asset upload"> 8 <meta name="description" content="quick asset 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>scratch</title> 12 <title>scratch</title>
13   13  
14 <!-- Bootstrap core CSS --> 14 <!-- Bootstrap core CSS -->
15 <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> 15 <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
16 <!-- Font Awesome --> 16 <!-- Font Awesome -->
17 <link href="bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet"> 17 <link href="bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet">
18 18
19 <!-- DropZone --> 19 <!-- DropZone -->
20 <link href="bower_components/dropzone/dist/min/dropzone.min.css" rel="stylesheet"> 20 <link href="bower_components/dropzone/dist/min/dropzone.min.css" rel="stylesheet">
21 21
22 <!-- Site-wide style CCS --> 22 <!-- Site-wide style CCS -->
23 <link href="css/style.css" rel="stylesheet"> 23 <link href="css/style.css" rel="stylesheet">
24 24
25 <!-- Local style --> 25 <!-- Local style -->
26 <link href="css/files/style.css" rel="stylesheet"> 26 <link href="css/files/style.css" rel="stylesheet">
27 </head> 27 </head>
28   28  
29 <body> 29 <body>
30   30  
31 <!-- Main component for a primary marketing message or call to action --> 31 <!-- Main component for a primary marketing message or call to action -->
32 <div class="paralax-background"></div> 32 <div class="paralax-background"></div>
33 <div class="jumbotron"> 33 <div class="jumbotron">
34 <h1>scratch copy</h1> 34 <h1>scratch copy</h1>
35 <p class="quote">the asset sharer</p> 35 <p class="quote">the asset sharer</p>
36 </div> 36 </div>
37   37  
38 <div class="container"> 38 <div class="container">
39 39
40 <ul class="nav nav-tabs"> 40 <ul class="nav nav-tabs">
41 <li><a href="index.html">Home</a></li> 41 <li><a href="index.html">Home</a></li>
42 <li class="active"><a href="#">File</a></li> 42 <li class="active"><a href="#">File</a></li>
43 <li><a href="text.html">Text</a></li> 43 <li><a href="text.html">Text</a></li>
-   44 <li><a href="draw.html">Draw</a></li>
44 </ul> 45 </ul>
45 46
46 <div class="panel panel-default"> 47 <div id="main-panel" class="panel panel-default">
47 <div class="panel-heading"> 48 <div class="panel-heading">
48 <div id="actions" class="row"> 49 <div id="actions" class="row">
49 <div class="col-lg-5"> 50 <div class="col-lg-5">
50 <div class="btn-group btn-group-justified" role="group"> 51 <div class="btn-group btn-group-justified" role="group">
51 <!-- The fileinput-button span is used to style the file input field as button --> 52 <!-- The fileinput-button span is used to style the file input field as button -->
52 <div class="btn-group" role="group"> 53 <div class="btn-group" role="group">
53 <button id="uploadbutton" type="button" class="btn btn-default"> 54 <button id="uploadbutton" type="button" class="btn btn-default">
54 <i class="glyphicon glyphicon-plus"></i> 55 <i class="glyphicon glyphicon-plus"></i>
55 <span>Add...</span> 56 <span>Add...</span>
56 </button> 57 </button>
57 </div> 58 </div>
58 <div class="btn-group" role="group"> 59 <div class="btn-group" role="group">
59 <button type="submit" class="btn btn-default start"> 60 <button type="submit" class="btn btn-default start">
60 <i class="glyphicon glyphicon-upload"></i> 61 <i class="glyphicon glyphicon-upload"></i>
61 <span>Upload All</span> 62 <span>Upload All</span>
62 </button> 63 </button>
63 </div> 64 </div>
64 <div class="btn-group" role="group"> 65 <div class="btn-group" role="group">
65 <button type="reset" class="btn btn-default cancel"> 66 <button type="reset" class="btn btn-default cancel">
66 <i class="glyphicon glyphicon-ban-circle"></i> 67 <i class="glyphicon glyphicon-ban-circle"></i>
67 <span>Cancel All</span> 68 <span>Cancel All</span>
68 </button> 69 </button>
69 </div> 70 </div>
70 </div> 71 </div>
71 </div> 72 </div>
72 </div> 73 </div>
73 </div> 74 </div>
74 <div class="panel-body" id="uploadpanel"> 75 <div class="panel-body" id="uploadpanel">
75 <div class="table table-striped files" id="previews"> 76 <div class="table table-striped files" id="previews">
76 <div id="template" class="file-row"> 77 <div id="template" class="file-row">
77 <!-- This is used as the file preview template --> 78 <!-- This is used as the file preview template -->
78 <div> 79 <div>
79 <span class="preview"><img src="img/fileholder.svg" width="58" alt="Upload file thumbnail" data-dz-thumbnail></span> 80 <span class="preview"><img src="img/fileholder.svg" width="58" alt="Upload file thumbnail" data-dz-thumbnail></span>
80 </div> 81 </div>
81 <div> 82 <div>
82 <p id="name" class="name" data-dz-name></p> 83 <p id="name" class="name" data-dz-name></p>
83 <div class="input-group"> 84 <div class="input-group">
84 <input id="URL" type="text" class="form-control" readonly> 85 <input id="URL" type="text" class="form-control" readonly>
85 <span class="input-group-btn"> 86 <span class="input-group-btn">
86 <button id="btn-mailto" class="btn btn-default" type="button"><i class="glyphicon glyphicon-envelope"></i></button> 87 <button id="btn-mailto" class="btn btn-default" type="button"><i class="glyphicon glyphicon-envelope"></i></button>
87 </span> 88 </span>
88 <span class="input-group-btn"> 89 <span class="input-group-btn">
89 <button id="btn-clipboard" class="btn btn-default" type="button"><i class="glyphicon glyphicon-paperclip"></i></button> 90 <button id="btn-clipboard" class="btn btn-default" type="button"><i class="glyphicon glyphicon-paperclip"></i></button>
90 </span> 91 </span>
91 </div> 92 </div>
92 <div class="input-group"> 93 <div class="input-group">
93 <input id="deleteURL" type="text" class="form-control" readonly> 94 <input id="deleteURL" type="text" class="form-control" readonly>
94 <span class="input-group-btn"> 95 <span class="input-group-btn">
95 <button id="btn-clipboard-delete" class="btn btn-default" type="button"><i class="glyphicon glyphicon-paperclip"></i></button> 96 <button id="btn-clipboard-delete" class="btn btn-default" type="button"><i class="glyphicon glyphicon-paperclip"></i></button>
96 </span> 97 </span>
97 </div> 98 </div>
98 <strong class="error text-danger" data-dz-errormessage></strong> 99 <strong class="error text-danger" data-dz-errormessage></strong>
99 </div> 100 </div>
100 <div> 101 <div>
101 <p class="size" data-dz-size></p> 102 <p class="size" data-dz-size></p>
102 <div id="progress" class="progress active" role="progressbar"> 103 <div id="progress" class="progress active" role="progressbar">
103 <div class="progress-bar progress-bar-custom" style="width:0%;" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" data-dz-uploadprogress></div> 104 <div class="progress-bar progress-bar-custom" style="width:0%;" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" data-dz-uploadprogress></div>
104 </div> 105 </div>
105 </div> 106 </div>
106 <div> 107 <div>
107 <button id="start" class="btn btn-default start"> 108 <button id="start" class="btn btn-default start">
108 <i class="glyphicon glyphicon-upload"></i> 109 <i class="glyphicon glyphicon-upload"></i>
109 <span>Upload</span> 110 <span>Upload</span>
110 </button> 111 </button>
111 <button id="cancel" data-dz-cancel class="btn btn-default cancel"> 112 <button id="cancel" data-dz-cancel class="btn btn-default cancel">
112 <i class="glyphicon glyphicon-ban-circle"></i> 113 <i class="glyphicon glyphicon-ban-circle"></i>
113 <span>Cancel</span> 114 <span>Cancel</span>
114 </button> 115 </button>
115 <button id="remove" data-dz-remove class="btn btn-danger remove"> 116 <button id="remove" data-dz-remove class="btn btn-danger remove">
116 <i class="glyphicon glyphicon-remove"></i> 117 <i class="glyphicon glyphicon-remove"></i>
117 <span>Remove</span> 118 <span>Remove</span>
118 </button> 119 </button>
119 </div> 120 </div>
120 </div> 121 </div>
121   122  
122 </div> 123 </div>
123 </div> 124 </div>
124 <!-- The global file processing state --> 125 <!-- The global file processing state -->
125 <div class="fileupload-process"> 126 <div class="fileupload-process">
126 <div id="total-progress" class="progress active" role="progressbar"> 127 <div id="total-progress" class="progress active" role="progressbar">
127 <div class="progress-bar progress-bar-custom" style="width:0%;" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" data-dz-uploadprogress></div> 128 <div class="progress-bar progress-bar-custom" style="width:0%;" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" data-dz-uploadprogress></div>
128 </div> 129 </div>
129 </div> 130 </div>
130 </div> 131 </div>
131   132  
132 </div> <!-- /container --> 133 </div> <!-- /container -->
133 134
134 <div id="footer"> 135 <div id="footer">
135 <div class="container"> 136 <div class="container">
136 <p class="text-muted credit text-center">Copyright <i class="glyphicon glyphicon-copyright-mark"></i> 2017 <a href="http://grimore.org">Wizardry and Steamworks</a>.</p> 137 <p class="text-muted credit text-center">Copyright <i class="glyphicon glyphicon-copyright-mark"></i> 2017 <a href="http://grimore.org">Wizardry and Steamworks</a>.</p>
137 </div> 138 </div>
138 </div> 139 </div>
139   140  
140 <!-- jQuery --> 141 <!-- jQuery -->
141 <script src="bower_components/jquery/dist/jquery.min.js"></script> 142 <script src="bower_components/jquery/dist/jquery.min.js"></script>
142 <!-- BootStrap --> 143 <!-- BootStrap -->
143 <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script> 144 <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
144 <!-- DropZone --> 145 <!-- DropZone -->
145 <script src="bower_components/dropzone/dist/min/dropzone.min.js"></script> 146 <script src="bower_components/dropzone/dist/min/dropzone.min.js"></script>
146 <!-- Clipboard --> 147 <!-- Clipboard -->
147 <script src="bower_components/clipboard/dist/clipboard.min.js"></script> 148 <script src="bower_components/clipboard/dist/clipboard.min.js"></script>
148 <script> 149 <script>
149 $(document).ready(() => { 150 $(document).ready(() => {
150 // Get the template HTML and remove it from the doument 151 // Get the template HTML and remove it from the doument
151 var previewNode = document 152 var previewNode = document
152 .querySelector("#template"); 153 .querySelector("#template");
153 previewNode.id = ""; 154 previewNode.id = "";
154 var previewTemplate = previewNode 155 var previewTemplate = previewNode
155 .parentNode 156 .parentNode
156 .innerHTML; 157 .innerHTML;
157 previewNode 158 previewNode
158 .parentNode 159 .parentNode
159 .removeChild(previewNode); 160 .removeChild(previewNode);
160   161  
161 var myDropzone = new Dropzone('.panel-body', { // Make the whole body a dropzone 162 var myDropzone = new Dropzone('.panel-body', { // Make the whole body a dropzone
162 url: "file.php", // Set the url 163 url: "file.php", // Set the url
163 paramName: "file", 164 paramName: "file",
164 thumbnailWidth: 80, 165 thumbnailWidth: 80,
165 thumbnailHeight: 80, 166 thumbnailHeight: 80,
166 //parallelUploads: 20, 167 //parallelUploads: 20,
167 previewTemplate: previewTemplate, 168 previewTemplate: previewTemplate,
168 autoQueue: false, // Make sure the files aren't queued until manually added 169 autoQueue: false, // Make sure the files aren't queued until manually added
169 previewsContainer: "#previews", // Container to display the previews 170 previewsContainer: "#previews", // Container to display the previews
170 clickable: [ 171 clickable: [
171 "#uploadbutton", 172 "#uploadbutton",
172 "#uploadpanel" 173 "#uploadpanel"
173 ], 174 ],
174 //clickable: "#uploadbutton" // Element that should be used as click trigger to select files. 175 //clickable: "#uploadbutton" // Element that should be used as click trigger to select files.
175 }).on("addedfile", (file) => { 176 }).on("addedfile", (file) => {
176 // Hookup the start button 177 // Hookup the start button
177 file.previewElement.querySelector(".start").onclick = () => { 178 file.previewElement.querySelector(".start").onclick = () => {
178 myDropzone.enqueueFile(file); 179 myDropzone.enqueueFile(file);
179 }; 180 };
180 }).on("totaluploadprogress", (progress) => { 181 }).on("totaluploadprogress", (progress) => {
181 document 182 document
182 .querySelector("#total-progress .progress-bar") 183 .querySelector("#total-progress .progress-bar")
183 .style 184 .style
184 .width = progress + "%"; 185 .width = progress + "%";
185 }).on("sending", (file) => { 186 }).on("sending", (file) => {
186 // Show the total progress bar when upload starts 187 // Show the total progress bar when upload starts
187 document.querySelector("#total-progress") 188 document.querySelector("#total-progress")
188 .style 189 .style
189 .opacity = 1; 190 .opacity = 1;
190 191
191 // And disable the start button. 192 // And disable the start button.
192 file 193 file
193 .previewElement 194 .previewElement
194 .querySelector(".start") 195 .querySelector(".start")
195 .setAttribute("disabled", "disabled"); 196 .setAttribute("disabled", "disabled");
196 }).on("queuecomplete", (progress) => { 197 }).on("queuecomplete", (progress) => {
197 document.querySelector("#total-progress") 198 document.querySelector("#total-progress")
198 .style 199 .style
199 .opacity = "0"; 200 .opacity = "0";
200 }).on("success", (file, data) => { 201 }).on("success", (file, data) => {
201 // Serialize JSON to object. 202 // Serialize JSON to object.
202 data = JSON.parse(data); 203 data = JSON.parse(data);
203 204
204 // Set the ID of the URL box. 205 // Set the ID of the URL box.
205 const boxURLID = '_' + Math 206 const boxURLID = '_' + Math
206 .random() 207 .random()
207 .toString(36) 208 .toString(36)
208 .substr(2, 9); 209 .substr(2, 9);
209 file 210 file
210 .previewElement 211 .previewElement
211 .querySelector("#URL") 212 .querySelector("#URL")
212 .value = location.protocol 213 .value = location.protocol
213 .concat("//") 214 .concat("//")
214 .concat(window.location.hostname) 215 .concat(window.location.hostname)
215 .concat("/") 216 .concat("/")
216 .concat(data.hash); 217 .concat(data.hash);
217 218
218 file 219 file
219 .previewElement 220 .previewElement
220 .querySelector("#URL") 221 .querySelector("#URL")
221 .setAttribute('id', boxURLID) 222 .setAttribute('id', boxURLID)
222   223  
223 // Set the ID of the delete URL box. 224 // Set the ID of the delete URL box.
224 const deleteBoxURLID = '_' + Math 225 const deleteBoxURLID = '_' + Math
225 .random() 226 .random()
226 .toString(36) 227 .toString(36)
227 .substr(2, 9); 228 .substr(2, 9);
228 file 229 file
229 .previewElement 230 .previewElement
230 .querySelector("#deleteURL") 231 .querySelector("#deleteURL")
231 .value = location.protocol.concat("//") 232 .value = location.protocol.concat("//")
232 .concat(window.location.hostname) 233 .concat(window.location.hostname)
233 .concat("/") 234 .concat("/")
234 .concat(data.timestamp) 235 .concat(data.timestamp)
235 .concat("/") 236 .concat("/")
236 .concat(data.hash); 237 .concat(data.hash);
237 238
238 file 239 file
239 .previewElement 240 .previewElement
240 .querySelector("#deleteURL") 241 .querySelector("#deleteURL")
241 .setAttribute('id', deleteBoxURLID) 242 .setAttribute('id', deleteBoxURLID)
242 243
243 // Set the ID of the URL clipboard button. 244 // Set the ID of the URL clipboard button.
244 const clipButtonID = '_' + Math 245 const clipButtonID = '_' + Math
245 .random() 246 .random()
246 .toString(36) 247 .toString(36)
247 .substr(2, 9); 248 .substr(2, 9);
248 file 249 file
249 .previewElement 250 .previewElement
250 .querySelector("#btn-clipboard") 251 .querySelector("#btn-clipboard")
251 .setAttribute('data-clipboard-target', '#' + boxURLID) 252 .setAttribute('data-clipboard-target', '#' + boxURLID)
252 253
253 file 254 file
254 .previewElement 255 .previewElement
255 .querySelector("#btn-clipboard") 256 .querySelector("#btn-clipboard")
256 .setAttribute('id', clipButtonID); 257 .setAttribute('id', clipButtonID);
257 258
258 new Clipboard('#' + clipButtonID); 259 new Clipboard('#' + clipButtonID);
259 260
260 // Set the ID of the delete URL clipboard button. 261 // Set the ID of the delete URL clipboard button.
261 const clipButtonDeleteID = '_' + Math 262 const clipButtonDeleteID = '_' + Math
262 .random() 263 .random()
263 .toString(36) 264 .toString(36)
264 .substr(2, 9); 265 .substr(2, 9);
265 file 266 file
266 .previewElement 267 .previewElement
267 .querySelector("#btn-clipboard-delete") 268 .querySelector("#btn-clipboard-delete")
268 .setAttribute('data-clipboard-target', '#' + deleteBoxURLID) 269 .setAttribute('data-clipboard-target', '#' + deleteBoxURLID)
269 270
270 file 271 file
271 .previewElement 272 .previewElement
272 .querySelector("#btn-clipboard-delete") 273 .querySelector("#btn-clipboard-delete")
273 .setAttribute('id', clipButtonDeleteID); 274 .setAttribute('id', clipButtonDeleteID);
274 275
275 new Clipboard('#' + clipButtonDeleteID); 276 new Clipboard('#' + clipButtonDeleteID);
276 277
277 // Set the ID of the mailto button. 278 // Set the ID of the mailto button.
278 const mailToButtonID = '_' + Math 279 const mailToButtonID = '_' + Math
279 .random() 280 .random()
280 .toString(36) 281 .toString(36)
281 .substr(2, 9); 282 .substr(2, 9);
282 283
283 file 284 file
284 .previewElement 285 .previewElement
285 .querySelector("#btn-mailto") 286 .querySelector("#btn-mailto")
286 .setAttribute('id', mailToButtonID); 287 .setAttribute('id', mailToButtonID);
287   288  
288 file 289 file
289 .previewElement 290 .previewElement
290 .querySelector(".start") 291 .querySelector(".start")
291 .setAttribute("disabled", "disabled"); 292 .setAttribute("disabled", "disabled");
292 file 293 file
293 .previewElement 294 .previewElement
294 .querySelector(".cancel") 295 .querySelector(".cancel")
295 .setAttribute("disabled", "disabled"); 296 .setAttribute("disabled", "disabled");
296 297
297 $('#' + mailToButtonID).on('click', () => { 298 $('#' + mailToButtonID).on('click', () => {
298 window.location.href = "mailto:?subject="+ 299 window.location.href = "mailto:?subject="+
299 encodeURIComponent("Can't scratch this!") + "&body=" + 300 encodeURIComponent("Can't scratch this!") + "&body=" +
300 encodeURIComponent($('#' + boxURLID).val()); 301 encodeURIComponent($('#' + boxURLID).val());
301 }); 302 });
302 }); 303 });
303 304
304 document.querySelector("#actions .start").onclick = () => { 305 document.querySelector("#actions .start").onclick = () => {
305 myDropzone.enqueueFiles( 306 myDropzone.enqueueFiles(
306 myDropzone 307 myDropzone
307 .getFilesWithStatus(Dropzone.ADDED)); 308 .getFilesWithStatus(Dropzone.ADDED));
308 }; 309 };
309 310
310 document.querySelector("#actions .cancel").onclick = () => { 311 document.querySelector("#actions .cancel").onclick = () => {
311 myDropzone.removeAllFiles(true); 312 myDropzone.removeAllFiles(true);
312 }; 313 };
-   314
-   315 // Scroll to the panel.
-   316 $('html, body').animate({
-   317 scrollTop: $('#main-panel').offset().top
-   318 }, 'slow');
313 }); 319 });
314 </script> 320 </script>
315 <!-- Jumbotron parallax effect --> 321 <!-- Jumbotron parallax effect -->
316 <script> 322 <script>
317 const jumboHeight = $('.jumbotron').outerHeight(); 323 const jumboHeight = $('.jumbotron').outerHeight();
318 function parallax(){ 324 function parallax(){
319 var scrolled = $(window).scrollTop(); 325 var scrolled = $(window).scrollTop();
320 $('.paralax-background').css('height', (jumboHeight-scrolled) + 'px'); 326 $('.paralax-background').css('height', (jumboHeight-scrolled) + 'px');
321 } 327 }
322   328  
323 $(window).scroll(function(e){ 329 $(window).scroll(function(e){
324 parallax(); 330 parallax();
325 }); 331 });
326 </script> 332 </script>
327 </body> 333 </body>
328 </html> 334 </html>
329   335