scratch – Blame information for rev 126
?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> |
||
92 | <p id="name" class="name" data-dz-name></p> |
||
93 | <div class="input-group"> |
||
94 | <input id="URL" type="text" class="form-control" readonly> |
||
95 | <span class="input-group-btn"> |
||
74 | office | 96 | <button id="btn-mailto" class="btn btn-default" type="button"><i class="glyphicon glyphicon-envelope"></i></button> |
24 | office | 97 | </span> |
72 | office | 98 | <span class="input-group-btn"> |
91 | office | 99 | <button id="btn-facebook" class="btn btn-default" type="button" disabled><i class="fa fa-facebook"></i></button> |
90 | office | 100 | </span> |
101 | <span class="input-group-btn"> |
||
74 | office | 102 | <button id="btn-clipboard" class="btn btn-default" type="button"><i class="glyphicon glyphicon-paperclip"></i></button> |
72 | office | 103 | </span> |
24 | office | 104 | </div> |
73 | office | 105 | <div class="input-group"> |
106 | <input id="deleteURL" type="text" class="form-control" readonly> |
||
107 | <span class="input-group-btn"> |
||
108 | <button id="btn-clipboard-delete" class="btn btn-default" type="button"><i class="glyphicon glyphicon-paperclip"></i></button> |
||
109 | </span> |
||
110 | </div> |
||
125 | office | 111 | <div class="input-group"> |
126 | office | 112 | <select id="tags" multiple class="form-control bootstrap-tagsinput 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 |
||
207 | .querySelector('.tags') |
||
208 | .getAttribute('id'); |
||
209 | |||
210 | const tags = $('#' + tagsBoxID) |
||
211 | .tagsinput('items'); |
||
212 | |||
213 | formData.append('tags', JSON.stringify(tags)); |
||
96 | office | 214 | }).on('addedfile', (file) => { |
126 | office | 215 | // Hookup the start button. |
216 | file.previewElement.querySelector('.start').onclick = () => { |
||
96 | office | 217 | myDropzone.enqueueFile(file); |
218 | }; |
||
125 | office | 219 | |
220 | // Set the ID of the tags input. |
||
221 | const tagsBoxID = '_' + Math |
||
222 | .random() |
||
223 | .toString(36) |
||
224 | .substr(2, 9); |
||
225 | |||
226 | file |
||
227 | .previewElement |
||
126 | office | 228 | .querySelector('#tags') |
125 | office | 229 | .setAttribute('id', tagsBoxID); |
230 | |||
231 | $('#' + tagsBoxID).tagsinput('refresh'); |
||
96 | office | 232 | }).on('totaluploadprogress', (progress) => { |
233 | document |
||
234 | .querySelector('#total-progress .progress-bar') |
||
235 | .style |
||
126 | office | 236 | .width = progress + '%'; |
96 | office | 237 | }).on('sending', (file) => { |
238 | // Show the total progress bar when upload starts |
||
239 | document.querySelector("#total-progress") |
||
24 | office | 240 | .style |
96 | office | 241 | .opacity = 1; |
24 | office | 242 | |
96 | office | 243 | // And disable the start button. |
244 | file |
||
245 | .previewElement |
||
126 | office | 246 | .querySelector('.start') |
247 | .setAttribute('disabled', 'disabled'); |
||
96 | office | 248 | }).on('queuecomplete', (progress) => { |
126 | office | 249 | document.querySelector('#total-progress') |
96 | office | 250 | .style |
126 | office | 251 | .opacity = '0'; |
96 | office | 252 | }).on('success', (file, data) => { |
253 | // Serialize JSON to object. |
||
254 | data = JSON.parse(data); |
||
81 | office | 255 | |
96 | office | 256 | // Set the ID of the URL box. |
257 | const boxURLID = '_' + Math |
||
258 | .random() |
||
259 | .toString(36) |
||
260 | .substr(2, 9); |
||
261 | file |
||
262 | .previewElement |
||
263 | .querySelector("#URL") |
||
264 | .value = location.protocol |
||
265 | .concat("//") |
||
266 | .concat(window.location.hostname) |
||
267 | .concat("/") |
||
268 | .concat(data.hash); |
||
24 | office | 269 | |
96 | office | 270 | file |
271 | .previewElement |
||
126 | office | 272 | .querySelector('#URL') |
96 | office | 273 | .setAttribute('id', boxURLID) |
73 | office | 274 | |
96 | office | 275 | // Set the ID of the delete URL box. |
276 | const deleteBoxURLID = '_' + Math |
||
277 | .random() |
||
278 | .toString(36) |
||
279 | .substr(2, 9); |
||
280 | file |
||
281 | .previewElement |
||
126 | office | 282 | .querySelector('#deleteURL') |
283 | .value = location.protocol.concat('//') |
||
96 | office | 284 | .concat(window.location.hostname) |
126 | office | 285 | .concat('/') |
96 | office | 286 | .concat(data.timestamp) |
126 | office | 287 | .concat('/') |
96 | office | 288 | .concat(data.hash); |
73 | office | 289 | |
96 | office | 290 | file |
291 | .previewElement |
||
126 | office | 292 | .querySelector('#deleteURL') |
96 | office | 293 | .setAttribute('id', deleteBoxURLID) |
73 | office | 294 | |
96 | office | 295 | // Set the ID of the URL clipboard button. |
296 | const clipButtonID = '_' + Math |
||
297 | .random() |
||
298 | .toString(36) |
||
299 | .substr(2, 9); |
||
300 | file |
||
301 | .previewElement |
||
126 | office | 302 | .querySelector('#btn-clipboard') |
96 | office | 303 | .setAttribute('data-clipboard-target', '#' + boxURLID) |
24 | office | 304 | |
96 | office | 305 | file |
306 | .previewElement |
||
126 | office | 307 | .querySelector('#btn-clipboard') |
96 | office | 308 | .setAttribute('id', clipButtonID); |
73 | office | 309 | |
96 | office | 310 | new Clipboard('#' + clipButtonID); |
72 | office | 311 | |
96 | office | 312 | // Set the ID of the delete URL clipboard button. |
313 | const clipButtonDeleteID = '_' + Math |
||
314 | .random() |
||
315 | .toString(36) |
||
316 | .substr(2, 9); |
||
317 | file |
||
318 | .previewElement |
||
126 | office | 319 | .querySelector('#btn-clipboard-delete') |
96 | office | 320 | .setAttribute('data-clipboard-target', '#' + deleteBoxURLID) |
73 | office | 321 | |
96 | office | 322 | file |
323 | .previewElement |
||
126 | office | 324 | .querySelector('#btn-clipboard-delete') |
96 | office | 325 | .setAttribute('id', clipButtonDeleteID); |
73 | office | 326 | |
96 | office | 327 | new Clipboard('#' + clipButtonDeleteID); |
73 | office | 328 | |
96 | office | 329 | // Set the ID of the mailto button. |
330 | const mailToButtonID = '_' + Math |
||
331 | .random() |
||
332 | .toString(36) |
||
333 | .substr(2, 9); |
||
72 | office | 334 | |
96 | office | 335 | file |
336 | .previewElement |
||
126 | office | 337 | .querySelector('#btn-mailto') |
96 | office | 338 | .setAttribute('id', mailToButtonID); |
24 | office | 339 | |
96 | office | 340 | file |
341 | .previewElement |
||
126 | office | 342 | .querySelector('.start') |
343 | .setAttribute('disabled', 'disabled'); |
||
96 | office | 344 | file |
345 | .previewElement |
||
126 | office | 346 | .querySelector('.cancel') |
347 | .setAttribute('disabled', 'disabled'); |
||
72 | office | 348 | |
96 | office | 349 | $('#' + mailToButtonID).on('click', () => { |
350 | window.location.href = "mailto:?subject="+ |
||
351 | encodeURIComponent("Can't scratch this!") + "&body=" + |
||
352 | encodeURIComponent($('#' + boxURLID).val()); |
||
353 | }); |
||
90 | office | 354 | |
96 | office | 355 | // Set the ID of the facebook button. |
356 | const faceBookButtonID = '_' + Math |
||
357 | .random() |
||
358 | .toString(36) |
||
359 | .substr(2, 9); |
||
90 | office | 360 | |
96 | office | 361 | file |
362 | .previewElement |
||
126 | office | 363 | .querySelector('#btn-facebook') |
96 | office | 364 | .setAttribute('id', faceBookButtonID); |
90 | office | 365 | |
96 | office | 366 | switch(data.opengraph) { |
367 | case true: |
||
368 | // Enable the facebook button. |
||
369 | file |
||
370 | .previewElement |
||
371 | .querySelector('#' + faceBookButtonID) |
||
126 | office | 372 | .removeAttribute('disabled'); |
90 | office | 373 | |
96 | office | 374 | // Change the URL when the user clicks the button. |
375 | $('#' + faceBookButtonID).on('click', () => { |
||
376 | $('#' + boxURLID) |
||
377 | .val( |
||
126 | office | 378 | location.protocol.concat('//') |
96 | office | 379 | .concat(window.location.hostname) |
126 | office | 380 | .concat('/') |
381 | .concat('og') |
||
382 | .concat('/') |
||
96 | office | 383 | .concat(data.hash) |
384 | ); |
||
385 | }); |
||
386 | break; |
||
387 | default: |
||
388 | // Disable the facebook button. |
||
389 | file |
||
390 | .previewElement |
||
391 | .querySelector('#' + faceBookButtonID) |
||
126 | office | 392 | .setAttribute('disabled', 'disabled'); |
96 | office | 393 | break; |
394 | } |
||
395 | }); |
||
396 | |||
126 | office | 397 | document.querySelector('#actions .start').onclick = () => { |
96 | office | 398 | myDropzone.enqueueFiles( |
399 | myDropzone |
||
400 | .getFilesWithStatus(Dropzone.ADDED)); |
||
401 | }; |
||
402 | |||
126 | office | 403 | document.querySelector('#actions .cancel').onclick = () => { |
96 | office | 404 | myDropzone.removeAllFiles(true); |
405 | }; |
||
24 | office | 406 | }); |
407 | |||
84 | office | 408 | // Scroll to the panel. |
409 | $('html, body').animate({ |
||
410 | scrollTop: $('#main-panel').offset().top |
||
411 | }, 'slow'); |
||
24 | office | 412 | }); |
413 | </script> |
||
71 | office | 414 | <!-- Jumbotron parallax effect --> |
70 | office | 415 | <script> |
71 | office | 416 | const jumboHeight = $('.jumbotron').outerHeight(); |
70 | office | 417 | function parallax(){ |
418 | var scrolled = $(window).scrollTop(); |
||
419 | $('.paralax-background').css('height', (jumboHeight-scrolled) + 'px'); |
||
420 | } |
||
421 | |||
422 | $(window).scroll(function(e){ |
||
423 | parallax(); |
||
424 | }); |
||
425 | </script> |
||
24 | office | 426 | </body> |
427 | </html> |