scratch – Blame information for rev 129
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
24 | office | 1 | <!DOCTYPE html> |
125 | office | 2 | <html lang="en" ng-app="scratch"> |
24 | office | 3 | <head> |
4 | <meta charset="utf-8"> |
||
5 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||
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 --> |
||
8 | <meta name="description" content="quick asset upload"> |
||
9 | <meta name="author" content="Wizardry and Steamworks"> |
||
10 | <link rel="icon" href="favicon.ico"> |
||
11 | |||
64 | office | 12 | <title>scratch</title> |
96 | office | 13 | |
24 | office | 14 | <!-- Bootstrap core CSS --> |
58 | office | 15 | <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> |
65 | office | 16 | <!-- Font Awesome --> |
17 | <link href="bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet"> |
||
24 | office | 18 | <!-- DropZone --> |
58 | office | 19 | <link href="bower_components/dropzone/dist/min/dropzone.min.css" rel="stylesheet"> |
125 | office | 20 | <!-- TagsInput --> |
21 | <link href="bower_components/bootstrap-tagsinput/dist/bootstrap-tagsinput.css" rel="stylesheet"> |
||
71 | office | 22 | |
23 | <!-- Site-wide style CCS --> |
||
24 | <link href="css/style.css" rel="stylesheet"> |
||
25 | |||
24 | office | 26 | <!-- Local style --> |
27 | <link href="css/files/style.css" rel="stylesheet"> |
||
125 | office | 28 | |
29 | <!-- Scratch Angular Includes --> |
||
30 | <ng-include src="'html/scratch-head-last.html'"></ng-include> |
||
24 | office | 31 | </head> |
32 | |||
33 | <body> |
||
125 | office | 34 | |
35 | <!-- Scratch Angular Includes --> |
||
36 | <ng-include src="'html/scratch-body-first.html'"></ng-include> |
||
24 | office | 37 | |
71 | office | 38 | <!-- Main component for a primary marketing message or call to action --> |
39 | <div class="paralax-background"></div> |
||
40 | <div class="jumbotron"> |
||
41 | <h1>scratch copy</h1> |
||
42 | <p class="quote">the asset sharer</p> |
||
43 | </div> |
||
44 | |||
24 | office | 45 | <div class="container"> |
46 | |||
47 | <ul class="nav nav-tabs"> |
||
48 | <li><a href="index.html">Home</a></li> |
||
56 | office | 49 | <li class="active"><a href="#">File</a></li> |
24 | office | 50 | <li><a href="text.html">Text</a></li> |
84 | office | 51 | <li><a href="draw.html">Draw</a></li> |
91 | office | 52 | <li><a href="link.html">Link</a></li> |
121 | office | 53 | <li><a href="view.html">View</a></li> |
24 | office | 54 | </ul> |
55 | |||
84 | office | 56 | <div id="main-panel" class="panel panel-default"> |
24 | office | 57 | <div class="panel-heading"> |
58 | <div id="actions" class="row"> |
||
59 | <div class="col-lg-5"> |
||
60 | <div class="btn-group btn-group-justified" role="group"> |
||
61 | <!-- The fileinput-button span is used to style the file input field as button --> |
||
62 | <div class="btn-group" role="group"> |
||
63 | <button id="uploadbutton" type="button" class="btn btn-default"> |
||
64 | <i class="glyphicon glyphicon-plus"></i> |
||
65 | <span>Add...</span> |
||
66 | </button> |
||
67 | </div> |
||
68 | <div class="btn-group" role="group"> |
||
69 | <button type="submit" class="btn btn-default start"> |
||
70 | <i class="glyphicon glyphicon-upload"></i> |
||
57 | office | 71 | <span>Upload All</span> |
24 | office | 72 | </button> |
73 | </div> |
||
74 | <div class="btn-group" role="group"> |
||
96 | office | 75 | <button type="reset" class="btn btn-danger cancel"> |
24 | office | 76 | <i class="glyphicon glyphicon-ban-circle"></i> |
57 | office | 77 | <span>Cancel All</span> |
24 | office | 78 | </button> |
79 | </div> |
||
80 | </div> |
||
81 | </div> |
||
82 | </div> |
||
83 | </div> |
||
84 | <div class="panel-body" id="uploadpanel"> |
||
85 | <div class="table table-striped files" id="previews"> |
||
86 | <div id="template" class="file-row"> |
||
87 | <!-- This is used as the file preview template --> |
||
88 | <div> |
||
89 | <span class="preview"><img src="img/fileholder.svg" width="58" alt="Upload file thumbnail" data-dz-thumbnail></span> |
||
90 | </div> |
||
91 | <div> |
||
129 | office | 92 | <p class="upload-filename" data-dz-name></p> |
24 | office | 93 | <div class="input-group"> |
129 | office | 94 | <input id="file-upload-url" type="text" class="form-control upload-url" readonly> |
24 | office | 95 | <span class="input-group-btn"> |
129 | office | 96 | <button id="btn-mailto" class="btn btn-default url-mailto-button" type="button"><i class="glyphicon glyphicon-envelope"></i></button> |
24 | office | 97 | </span> |
72 | office | 98 | <span class="input-group-btn"> |
129 | office | 99 | <button id="btn-facebook" class="btn btn-default url-facebook-button" type="button" disabled><i class="fa fa-facebook"></i></button> |
90 | office | 100 | </span> |
101 | <span class="input-group-btn"> |
||
129 | office | 102 | <button id="btn-clipboard" class="btn btn-default url-clipboard-button" type="button"><i class="glyphicon glyphicon-paperclip"></i></button> |
72 | office | 103 | </span> |
24 | office | 104 | </div> |
73 | office | 105 | <div class="input-group"> |
129 | office | 106 | <input id="file-delete-url" type="text" class="form-control delete-url" readonly> |
73 | office | 107 | <span class="input-group-btn"> |
129 | office | 108 | <button id="btn-clipboard-delete" class="btn btn-default delete-cliboard-button" type="button"><i class="glyphicon glyphicon-paperclip"></i></button> |
73 | office | 109 | </span> |
110 | </div> |
||
125 | office | 111 | <div class="input-group"> |
129 | office | 112 | <select id="file-tags" multiple class="form-control bootstrap-tagsinput file-tags"></select> |
125 | office | 113 | </div> |
24 | office | 114 | <strong class="error text-danger" data-dz-errormessage></strong> |
115 | </div> |
||
116 | <div> |
||
117 | <p class="size" data-dz-size></p> |
||
76 | office | 118 | <div id="progress" class="progress active" role="progressbar"> |
119 | <div class="progress-bar progress-bar-custom" style="width:0%;" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" data-dz-uploadprogress></div> |
||
24 | office | 120 | </div> |
121 | </div> |
||
122 | <div> |
||
123 | <button id="start" class="btn btn-default start"> |
||
124 | <i class="glyphicon glyphicon-upload"></i> |
||
125 | <span>Upload</span> |
||
126 | </button> |
||
96 | office | 127 | <button id="cancel" data-dz-remove class="btn btn-warning cancel"> |
24 | office | 128 | <i class="glyphicon glyphicon-ban-circle"></i> |
129 | <span>Cancel</span> |
||
130 | </button> |
||
131 | <button id="remove" data-dz-remove class="btn btn-danger remove"> |
||
132 | <i class="glyphicon glyphicon-remove"></i> |
||
133 | <span>Remove</span> |
||
134 | </button> |
||
135 | </div> |
||
136 | </div> |
||
137 | |||
138 | </div> |
||
139 | </div> |
||
140 | <!-- The global file processing state --> |
||
141 | <div class="fileupload-process"> |
||
76 | office | 142 | <div id="total-progress" class="progress active" role="progressbar"> |
143 | <div class="progress-bar progress-bar-custom" style="width:0%;" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" data-dz-uploadprogress></div> |
||
144 | </div> |
||
24 | office | 145 | </div> |
146 | </div> |
||
147 | |||
148 | </div> <!-- /container --> |
||
149 | |||
150 | <div id="footer"> |
||
151 | <div class="container"> |
||
71 | office | 152 | <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> |
24 | office | 153 | </div> |
154 | </div> |
||
155 | |||
58 | office | 156 | <!-- jQuery --> |
157 | <script src="bower_components/jquery/dist/jquery.min.js"></script> |
||
125 | office | 158 | <!-- Angular JS --> |
159 | <script src="bower_components/angular/angular.min.js"></script> |
||
58 | office | 160 | <!-- BootStrap --> |
161 | <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script> |
||
24 | office | 162 | <!-- DropZone --> |
58 | office | 163 | <script src="bower_components/dropzone/dist/min/dropzone.min.js"></script> |
24 | office | 164 | <!-- Clipboard --> |
58 | office | 165 | <script src="bower_components/clipboard/dist/clipboard.min.js"></script> |
125 | office | 166 | <!-- TagsInput --> |
167 | <script src="bower_components/bootstrap-tagsinput/dist/bootstrap-tagsinput.min.js"></script> |
||
168 | <!-- Angular Initialization. --> |
||
24 | office | 169 | <script> |
125 | office | 170 | var app = angular.module('scratch', []); |
171 | </script> |
||
172 | <script> |
||
26 | office | 173 | $(document).ready(() => { |
96 | office | 174 | $.get('session.php').then((token) => { |
175 | // Get the template HTML and remove it from the doument |
||
176 | var previewNode = document |
||
126 | office | 177 | .querySelector('#template'); |
178 | previewNode.id = ''; |
||
96 | office | 179 | var previewTemplate = previewNode |
180 | .parentNode |
||
181 | .innerHTML; |
||
182 | previewNode |
||
183 | .parentNode |
||
184 | .removeChild(previewNode); |
||
126 | office | 185 | |
96 | office | 186 | var myDropzone = new Dropzone('.panel-body', { // Make the whole body a dropzone |
187 | url: 'file.php', // Set the url |
||
188 | paramName: 'file', |
||
189 | thumbnailWidth: 80, |
||
190 | thumbnailHeight: 80, |
||
191 | //parallelUploads: 20, |
||
192 | previewTemplate: previewTemplate, |
||
193 | autoQueue: false, // Make sure the files aren't queued until manually added |
||
194 | previewsContainer: '#previews', // Container to display the previews |
||
195 | clickable: [ |
||
196 | '#uploadbutton', |
||
197 | '#uploadpanel' |
||
198 | ], |
||
199 | //clickable: "#uploadbutton" // Element that should be used as click trigger to select files. |
||
200 | }).on('sending', (file, xhr, formData) => { |
||
201 | // Append session token. |
||
202 | formData.append('token', token); |
||
126 | office | 203 | |
204 | // Append tags to the form data. |
||
205 | const tagsBoxID = file |
||
206 | .previewElement |
||
129 | office | 207 | .querySelector('.file-tags') |
126 | office | 208 | .getAttribute('id'); |
209 | |||
210 | const tags = $('#' + tagsBoxID) |
||
211 | .tagsinput('items'); |
||
212 | |||
213 | formData.append('tags', JSON.stringify(tags)); |
||
128 | office | 214 | |
215 | // And disable the tags bar. |
||
216 | file |
||
217 | .previewElement |
||
218 | .querySelector('#' + tagsBoxID) |
||
219 | .setAttribute('disabled', 'disabled'); |
||
220 | |||
96 | office | 221 | }).on('addedfile', (file) => { |
126 | office | 222 | // Hookup the start button. |
223 | file.previewElement.querySelector('.start').onclick = () => { |
||
96 | office | 224 | myDropzone.enqueueFile(file); |
225 | }; |
||
125 | office | 226 | |
96 | office | 227 | // Set the ID of the URL box. |
228 | const boxURLID = '_' + Math |
||
229 | .random() |
||
230 | .toString(36) |
||
231 | .substr(2, 9); |
||
232 | file |
||
233 | .previewElement |
||
129 | office | 234 | .querySelector('#file-upload-url') |
235 | .setAttribute('id', boxURLID); |
||
236 | |||
96 | office | 237 | // Set the ID of the delete URL box. |
238 | const deleteBoxURLID = '_' + Math |
||
239 | .random() |
||
240 | .toString(36) |
||
241 | .substr(2, 9); |
||
242 | file |
||
243 | .previewElement |
||
129 | office | 244 | .querySelector('#file-delete-url') |
245 | .setAttribute('id', deleteBoxURLID); |
||
246 | |||
96 | office | 247 | // Set the ID of the URL clipboard button. |
248 | const clipButtonID = '_' + Math |
||
249 | .random() |
||
250 | .toString(36) |
||
251 | .substr(2, 9); |
||
252 | file |
||
253 | .previewElement |
||
126 | office | 254 | .querySelector('#btn-clipboard') |
96 | office | 255 | .setAttribute('data-clipboard-target', '#' + boxURLID) |
24 | office | 256 | |
96 | office | 257 | file |
258 | .previewElement |
||
126 | office | 259 | .querySelector('#btn-clipboard') |
96 | office | 260 | .setAttribute('id', clipButtonID); |
73 | office | 261 | |
96 | office | 262 | new Clipboard('#' + clipButtonID); |
72 | office | 263 | |
96 | office | 264 | // Set the ID of the delete URL clipboard button. |
265 | const clipButtonDeleteID = '_' + Math |
||
266 | .random() |
||
267 | .toString(36) |
||
268 | .substr(2, 9); |
||
269 | file |
||
270 | .previewElement |
||
126 | office | 271 | .querySelector('#btn-clipboard-delete') |
96 | office | 272 | .setAttribute('data-clipboard-target', '#' + deleteBoxURLID) |
73 | office | 273 | |
96 | office | 274 | file |
275 | .previewElement |
||
126 | office | 276 | .querySelector('#btn-clipboard-delete') |
96 | office | 277 | .setAttribute('id', clipButtonDeleteID); |
73 | office | 278 | |
96 | office | 279 | new Clipboard('#' + clipButtonDeleteID); |
73 | office | 280 | |
96 | office | 281 | // Set the ID of the mailto button. |
282 | const mailToButtonID = '_' + Math |
||
283 | .random() |
||
284 | .toString(36) |
||
285 | .substr(2, 9); |
||
72 | office | 286 | |
96 | office | 287 | file |
288 | .previewElement |
||
126 | office | 289 | .querySelector('#btn-mailto') |
96 | office | 290 | .setAttribute('id', mailToButtonID); |
129 | office | 291 | |
292 | // Set the ID of the facebook button. |
||
293 | const faceBookButtonID = '_' + Math |
||
294 | .random() |
||
295 | .toString(36) |
||
296 | .substr(2, 9); |
||
24 | office | 297 | |
96 | office | 298 | file |
299 | .previewElement |
||
129 | office | 300 | .querySelector('#btn-facebook') |
301 | .setAttribute('id', faceBookButtonID); |
||
302 | |||
303 | // Set the ID of the tags input. |
||
304 | const tagsBoxID = '_' + Math |
||
305 | .random() |
||
306 | .toString(36) |
||
307 | .substr(2, 9); |
||
308 | |||
309 | file |
||
310 | .previewElement |
||
311 | .querySelector('#file-tags') |
||
312 | .setAttribute('id', tagsBoxID); |
||
313 | |||
314 | // Refresh the tags input. |
||
315 | $('#' + tagsBoxID).tagsinput('refresh'); |
||
316 | |||
317 | }).on('totaluploadprogress', (progress) => { |
||
318 | document |
||
319 | .querySelector('#total-progress .progress-bar') |
||
320 | .style |
||
321 | .width = progress + '%'; |
||
322 | }).on('sending', (file) => { |
||
323 | // Show the total progress bar when upload starts |
||
324 | document.querySelector("#total-progress") |
||
325 | .style |
||
326 | .opacity = 1; |
||
327 | |||
328 | // And disable the start button. |
||
329 | file |
||
330 | .previewElement |
||
126 | office | 331 | .querySelector('.start') |
332 | .setAttribute('disabled', 'disabled'); |
||
129 | office | 333 | }).on('queuecomplete', (progress) => { |
334 | document.querySelector('#total-progress') |
||
335 | .style |
||
336 | .opacity = '0'; |
||
337 | }).on('success', (file, data) => { |
||
338 | // Serialize JSON to object. |
||
339 | data = JSON.parse(data); |
||
340 | |||
96 | office | 341 | file |
342 | .previewElement |
||
129 | office | 343 | .querySelector(".upload-url") |
344 | .value = location.protocol |
||
345 | .concat("//") |
||
346 | .concat(window.location.hostname) |
||
347 | .concat("/") |
||
348 | .concat(data.hash); |
||
349 | |||
350 | file |
||
351 | .previewElement |
||
352 | .querySelector('.delete-url') |
||
353 | .value = location.protocol.concat('//') |
||
354 | .concat(window.location.hostname) |
||
355 | .concat('/') |
||
356 | .concat(data.timestamp) |
||
357 | .concat('/') |
||
358 | .concat(data.hash); |
||
359 | |||
360 | file |
||
361 | .previewElement |
||
362 | .querySelector('.start') |
||
363 | .setAttribute('disabled', 'disabled'); |
||
364 | file |
||
365 | .previewElement |
||
126 | office | 366 | .querySelector('.cancel') |
367 | .setAttribute('disabled', 'disabled'); |
||
129 | office | 368 | |
369 | // Enable the mailto button. |
||
370 | $('.url-mailto-button').on('click', () => { |
||
96 | office | 371 | window.location.href = "mailto:?subject="+ |
372 | encodeURIComponent("Can't scratch this!") + "&body=" + |
||
129 | office | 373 | encodeURIComponent($('.upload-url').val()); |
96 | office | 374 | }); |
129 | office | 375 | |
376 | // Enable or disable the facebook opengraph URL. |
||
96 | office | 377 | switch(data.opengraph) { |
378 | case true: |
||
379 | // Enable the facebook button. |
||
380 | file |
||
381 | .previewElement |
||
129 | office | 382 | .querySelector('.url-facebook-button') |
126 | office | 383 | .removeAttribute('disabled'); |
90 | office | 384 | |
96 | office | 385 | // Change the URL when the user clicks the button. |
129 | office | 386 | $('.url-facebook-button').on('click', () => { |
387 | $('.upload-url') |
||
96 | office | 388 | .val( |
126 | office | 389 | location.protocol.concat('//') |
96 | office | 390 | .concat(window.location.hostname) |
126 | office | 391 | .concat('/') |
392 | .concat('og') |
||
393 | .concat('/') |
||
96 | office | 394 | .concat(data.hash) |
395 | ); |
||
396 | }); |
||
397 | break; |
||
398 | default: |
||
399 | // Disable the facebook button. |
||
400 | file |
||
401 | .previewElement |
||
129 | office | 402 | .querySelector('.url-facebook-button') |
126 | office | 403 | .setAttribute('disabled', 'disabled'); |
96 | office | 404 | break; |
405 | } |
||
406 | }); |
||
407 | |||
126 | office | 408 | document.querySelector('#actions .start').onclick = () => { |
96 | office | 409 | myDropzone.enqueueFiles( |
410 | myDropzone |
||
411 | .getFilesWithStatus(Dropzone.ADDED)); |
||
412 | }; |
||
413 | |||
126 | office | 414 | document.querySelector('#actions .cancel').onclick = () => { |
96 | office | 415 | myDropzone.removeAllFiles(true); |
416 | }; |
||
24 | office | 417 | }); |
418 | |||
84 | office | 419 | // Scroll to the panel. |
420 | $('html, body').animate({ |
||
421 | scrollTop: $('#main-panel').offset().top |
||
422 | }, 'slow'); |
||
24 | office | 423 | }); |
424 | </script> |
||
71 | office | 425 | <!-- Jumbotron parallax effect --> |
70 | office | 426 | <script> |
71 | office | 427 | const jumboHeight = $('.jumbotron').outerHeight(); |
70 | office | 428 | function parallax(){ |
429 | var scrolled = $(window).scrollTop(); |
||
430 | $('.paralax-background').css('height', (jumboHeight-scrolled) + 'px'); |
||
431 | } |
||
432 | |||
433 | $(window).scroll(function(e){ |
||
434 | parallax(); |
||
435 | }); |
||
436 | </script> |
||
24 | office | 437 | </body> |
438 | </html> |