scratch – Blame information for rev 125

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