scratch – Diff between revs 84 and 90

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 84 Rev 90
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 <li><a href="draw.html">Draw</a></li>
45 </ul> 45 </ul>
46 46
47 <div id="main-panel" class="panel panel-default"> 47 <div id="main-panel" class="panel panel-default">
48 <div class="panel-heading"> 48 <div class="panel-heading">
49 <div id="actions" class="row"> 49 <div id="actions" class="row">
50 <div class="col-lg-5"> 50 <div class="col-lg-5">
51 <div class="btn-group btn-group-justified" role="group"> 51 <div class="btn-group btn-group-justified" role="group">
52 <!-- 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 -->
53 <div class="btn-group" role="group"> 53 <div class="btn-group" role="group">
54 <button id="uploadbutton" type="button" class="btn btn-default"> 54 <button id="uploadbutton" type="button" class="btn btn-default">
55 <i class="glyphicon glyphicon-plus"></i> 55 <i class="glyphicon glyphicon-plus"></i>
56 <span>Add...</span> 56 <span>Add...</span>
57 </button> 57 </button>
58 </div> 58 </div>
59 <div class="btn-group" role="group"> 59 <div class="btn-group" role="group">
60 <button type="submit" class="btn btn-default start"> 60 <button type="submit" class="btn btn-default start">
61 <i class="glyphicon glyphicon-upload"></i> 61 <i class="glyphicon glyphicon-upload"></i>
62 <span>Upload All</span> 62 <span>Upload All</span>
63 </button> 63 </button>
64 </div> 64 </div>
65 <div class="btn-group" role="group"> 65 <div class="btn-group" role="group">
66 <button type="reset" class="btn btn-default cancel"> 66 <button type="reset" class="btn btn-default cancel">
67 <i class="glyphicon glyphicon-ban-circle"></i> 67 <i class="glyphicon glyphicon-ban-circle"></i>
68 <span>Cancel All</span> 68 <span>Cancel All</span>
69 </button> 69 </button>
70 </div> 70 </div>
71 </div> 71 </div>
72 </div> 72 </div>
73 </div> 73 </div>
74 </div> 74 </div>
75 <div class="panel-body" id="uploadpanel"> 75 <div class="panel-body" id="uploadpanel">
76 <div class="table table-striped files" id="previews"> 76 <div class="table table-striped files" id="previews">
77 <div id="template" class="file-row"> 77 <div id="template" class="file-row">
78 <!-- This is used as the file preview template --> 78 <!-- This is used as the file preview template -->
79 <div> 79 <div>
80 <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>
81 </div> 81 </div>
82 <div> 82 <div>
83 <p id="name" class="name" data-dz-name></p> 83 <p id="name" class="name" data-dz-name></p>
84 <div class="input-group"> 84 <div class="input-group">
85 <input id="URL" type="text" class="form-control" readonly> 85 <input id="URL" type="text" class="form-control" readonly>
86 <span class="input-group-btn"> 86 <span class="input-group-btn">
87 <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>
88 </span> 88 </span>
89 <span class="input-group-btn"> 89 <span class="input-group-btn">
-   90 <button id="btn-facebook" class="btn btn-default" type="button" disabled="disabled"><i class="fa fa-facebook"></i></button>
-   91 </span>
-   92 <span class="input-group-btn">
90 <button id="btn-clipboard" class="btn btn-default" type="button"><i class="glyphicon glyphicon-paperclip"></i></button> 93 <button id="btn-clipboard" class="btn btn-default" type="button"><i class="glyphicon glyphicon-paperclip"></i></button>
91 </span> 94 </span>
92 </div> 95 </div>
93 <div class="input-group"> 96 <div class="input-group">
94 <input id="deleteURL" type="text" class="form-control" readonly> 97 <input id="deleteURL" type="text" class="form-control" readonly>
95 <span class="input-group-btn"> 98 <span class="input-group-btn">
96 <button id="btn-clipboard-delete" class="btn btn-default" type="button"><i class="glyphicon glyphicon-paperclip"></i></button> 99 <button id="btn-clipboard-delete" class="btn btn-default" type="button"><i class="glyphicon glyphicon-paperclip"></i></button>
97 </span> 100 </span>
98 </div> 101 </div>
99 <strong class="error text-danger" data-dz-errormessage></strong> 102 <strong class="error text-danger" data-dz-errormessage></strong>
100 </div> 103 </div>
101 <div> 104 <div>
102 <p class="size" data-dz-size></p> 105 <p class="size" data-dz-size></p>
103 <div id="progress" class="progress active" role="progressbar"> 106 <div id="progress" class="progress active" role="progressbar">
104 <div class="progress-bar progress-bar-custom" style="width:0%;" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" data-dz-uploadprogress></div> 107 <div class="progress-bar progress-bar-custom" style="width:0%;" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" data-dz-uploadprogress></div>
105 </div> 108 </div>
106 </div> 109 </div>
107 <div> 110 <div>
108 <button id="start" class="btn btn-default start"> 111 <button id="start" class="btn btn-default start">
109 <i class="glyphicon glyphicon-upload"></i> 112 <i class="glyphicon glyphicon-upload"></i>
110 <span>Upload</span> 113 <span>Upload</span>
111 </button> 114 </button>
112 <button id="cancel" data-dz-cancel class="btn btn-default cancel"> 115 <button id="cancel" data-dz-cancel class="btn btn-default cancel">
113 <i class="glyphicon glyphicon-ban-circle"></i> 116 <i class="glyphicon glyphicon-ban-circle"></i>
114 <span>Cancel</span> 117 <span>Cancel</span>
115 </button> 118 </button>
116 <button id="remove" data-dz-remove class="btn btn-danger remove"> 119 <button id="remove" data-dz-remove class="btn btn-danger remove">
117 <i class="glyphicon glyphicon-remove"></i> 120 <i class="glyphicon glyphicon-remove"></i>
118 <span>Remove</span> 121 <span>Remove</span>
119 </button> 122 </button>
120 </div> 123 </div>
121 </div> 124 </div>
122   125  
123 </div> 126 </div>
124 </div> 127 </div>
125 <!-- The global file processing state --> 128 <!-- The global file processing state -->
126 <div class="fileupload-process"> 129 <div class="fileupload-process">
127 <div id="total-progress" class="progress active" role="progressbar"> 130 <div id="total-progress" class="progress active" role="progressbar">
128 <div class="progress-bar progress-bar-custom" style="width:0%;" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" data-dz-uploadprogress></div> 131 <div class="progress-bar progress-bar-custom" style="width:0%;" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" data-dz-uploadprogress></div>
129 </div> 132 </div>
130 </div> 133 </div>
131 </div> 134 </div>
132   135  
133 </div> <!-- /container --> 136 </div> <!-- /container -->
134 137
135 <div id="footer"> 138 <div id="footer">
136 <div class="container"> 139 <div class="container">
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> 140 <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>
138 </div> 141 </div>
139 </div> 142 </div>
140   143  
141 <!-- jQuery --> 144 <!-- jQuery -->
142 <script src="bower_components/jquery/dist/jquery.min.js"></script> 145 <script src="bower_components/jquery/dist/jquery.min.js"></script>
143 <!-- BootStrap --> 146 <!-- BootStrap -->
144 <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script> 147 <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
145 <!-- DropZone --> 148 <!-- DropZone -->
146 <script src="bower_components/dropzone/dist/min/dropzone.min.js"></script> 149 <script src="bower_components/dropzone/dist/min/dropzone.min.js"></script>
147 <!-- Clipboard --> 150 <!-- Clipboard -->
148 <script src="bower_components/clipboard/dist/clipboard.min.js"></script> 151 <script src="bower_components/clipboard/dist/clipboard.min.js"></script>
149 <script> 152 <script>
150 $(document).ready(() => { 153 $(document).ready(() => {
151 // Get the template HTML and remove it from the doument 154 // Get the template HTML and remove it from the doument
152 var previewNode = document 155 var previewNode = document
153 .querySelector("#template"); 156 .querySelector("#template");
154 previewNode.id = ""; 157 previewNode.id = "";
155 var previewTemplate = previewNode 158 var previewTemplate = previewNode
156 .parentNode 159 .parentNode
157 .innerHTML; 160 .innerHTML;
158 previewNode 161 previewNode
159 .parentNode 162 .parentNode
160 .removeChild(previewNode); 163 .removeChild(previewNode);
161   164  
162 var myDropzone = new Dropzone('.panel-body', { // Make the whole body a dropzone 165 var myDropzone = new Dropzone('.panel-body', { // Make the whole body a dropzone
163 url: "file.php", // Set the url 166 url: "file.php", // Set the url
164 paramName: "file", 167 paramName: "file",
165 thumbnailWidth: 80, 168 thumbnailWidth: 80,
166 thumbnailHeight: 80, 169 thumbnailHeight: 80,
167 //parallelUploads: 20, 170 //parallelUploads: 20,
168 previewTemplate: previewTemplate, 171 previewTemplate: previewTemplate,
169 autoQueue: false, // Make sure the files aren't queued until manually added 172 autoQueue: false, // Make sure the files aren't queued until manually added
170 previewsContainer: "#previews", // Container to display the previews 173 previewsContainer: "#previews", // Container to display the previews
171 clickable: [ 174 clickable: [
172 "#uploadbutton", 175 "#uploadbutton",
173 "#uploadpanel" 176 "#uploadpanel"
174 ], 177 ],
175 //clickable: "#uploadbutton" // Element that should be used as click trigger to select files. 178 //clickable: "#uploadbutton" // Element that should be used as click trigger to select files.
176 }).on("addedfile", (file) => { 179 }).on("addedfile", (file) => {
177 // Hookup the start button 180 // Hookup the start button
178 file.previewElement.querySelector(".start").onclick = () => { 181 file.previewElement.querySelector(".start").onclick = () => {
179 myDropzone.enqueueFile(file); 182 myDropzone.enqueueFile(file);
180 }; 183 };
181 }).on("totaluploadprogress", (progress) => { 184 }).on("totaluploadprogress", (progress) => {
182 document 185 document
183 .querySelector("#total-progress .progress-bar") 186 .querySelector("#total-progress .progress-bar")
184 .style 187 .style
185 .width = progress + "%"; 188 .width = progress + "%";
186 }).on("sending", (file) => { 189 }).on("sending", (file) => {
187 // Show the total progress bar when upload starts 190 // Show the total progress bar when upload starts
188 document.querySelector("#total-progress") 191 document.querySelector("#total-progress")
189 .style 192 .style
190 .opacity = 1; 193 .opacity = 1;
191 194
192 // And disable the start button. 195 // And disable the start button.
193 file 196 file
194 .previewElement 197 .previewElement
195 .querySelector(".start") 198 .querySelector(".start")
196 .setAttribute("disabled", "disabled"); 199 .setAttribute("disabled", "disabled");
197 }).on("queuecomplete", (progress) => { 200 }).on("queuecomplete", (progress) => {
198 document.querySelector("#total-progress") 201 document.querySelector("#total-progress")
199 .style 202 .style
200 .opacity = "0"; 203 .opacity = "0";
201 }).on("success", (file, data) => { 204 }).on("success", (file, data) => {
202 // Serialize JSON to object. 205 // Serialize JSON to object.
203 data = JSON.parse(data); 206 data = JSON.parse(data);
204 207
205 // Set the ID of the URL box. 208 // Set the ID of the URL box.
206 const boxURLID = '_' + Math 209 const boxURLID = '_' + Math
207 .random() 210 .random()
208 .toString(36) 211 .toString(36)
209 .substr(2, 9); 212 .substr(2, 9);
210 file 213 file
211 .previewElement 214 .previewElement
212 .querySelector("#URL") 215 .querySelector("#URL")
213 .value = location.protocol 216 .value = location.protocol
214 .concat("//") 217 .concat("//")
215 .concat(window.location.hostname) 218 .concat(window.location.hostname)
216 .concat("/") 219 .concat("/")
217 .concat(data.hash); 220 .concat(data.hash);
218 221
219 file 222 file
220 .previewElement 223 .previewElement
221 .querySelector("#URL") 224 .querySelector("#URL")
222 .setAttribute('id', boxURLID) 225 .setAttribute('id', boxURLID)
223   226  
224 // Set the ID of the delete URL box. 227 // Set the ID of the delete URL box.
225 const deleteBoxURLID = '_' + Math 228 const deleteBoxURLID = '_' + Math
226 .random() 229 .random()
227 .toString(36) 230 .toString(36)
228 .substr(2, 9); 231 .substr(2, 9);
229 file 232 file
230 .previewElement 233 .previewElement
231 .querySelector("#deleteURL") 234 .querySelector("#deleteURL")
232 .value = location.protocol.concat("//") 235 .value = location.protocol.concat("//")
233 .concat(window.location.hostname) 236 .concat(window.location.hostname)
234 .concat("/") 237 .concat("/")
235 .concat(data.timestamp) 238 .concat(data.timestamp)
236 .concat("/") 239 .concat("/")
237 .concat(data.hash); 240 .concat(data.hash);
238 241
239 file 242 file
240 .previewElement 243 .previewElement
241 .querySelector("#deleteURL") 244 .querySelector("#deleteURL")
242 .setAttribute('id', deleteBoxURLID) 245 .setAttribute('id', deleteBoxURLID)
243 246
244 // Set the ID of the URL clipboard button. 247 // Set the ID of the URL clipboard button.
245 const clipButtonID = '_' + Math 248 const clipButtonID = '_' + Math
246 .random() 249 .random()
247 .toString(36) 250 .toString(36)
248 .substr(2, 9); 251 .substr(2, 9);
249 file 252 file
250 .previewElement 253 .previewElement
251 .querySelector("#btn-clipboard") 254 .querySelector("#btn-clipboard")
252 .setAttribute('data-clipboard-target', '#' + boxURLID) 255 .setAttribute('data-clipboard-target', '#' + boxURLID)
253 256
254 file 257 file
255 .previewElement 258 .previewElement
256 .querySelector("#btn-clipboard") 259 .querySelector("#btn-clipboard")
257 .setAttribute('id', clipButtonID); 260 .setAttribute('id', clipButtonID);
258 261
259 new Clipboard('#' + clipButtonID); 262 new Clipboard('#' + clipButtonID);
260 263
261 // Set the ID of the delete URL clipboard button. 264 // Set the ID of the delete URL clipboard button.
262 const clipButtonDeleteID = '_' + Math 265 const clipButtonDeleteID = '_' + Math
263 .random() 266 .random()
264 .toString(36) 267 .toString(36)
265 .substr(2, 9); 268 .substr(2, 9);
266 file 269 file
267 .previewElement 270 .previewElement
268 .querySelector("#btn-clipboard-delete") 271 .querySelector("#btn-clipboard-delete")
269 .setAttribute('data-clipboard-target', '#' + deleteBoxURLID) 272 .setAttribute('data-clipboard-target', '#' + deleteBoxURLID)
270 273
271 file 274 file
272 .previewElement 275 .previewElement
273 .querySelector("#btn-clipboard-delete") 276 .querySelector("#btn-clipboard-delete")
274 .setAttribute('id', clipButtonDeleteID); 277 .setAttribute('id', clipButtonDeleteID);
275 278
276 new Clipboard('#' + clipButtonDeleteID); 279 new Clipboard('#' + clipButtonDeleteID);
277 280
278 // Set the ID of the mailto button. 281 // Set the ID of the mailto button.
279 const mailToButtonID = '_' + Math 282 const mailToButtonID = '_' + Math
280 .random() 283 .random()
281 .toString(36) 284 .toString(36)
282 .substr(2, 9); 285 .substr(2, 9);
283 286
284 file 287 file
285 .previewElement 288 .previewElement
286 .querySelector("#btn-mailto") 289 .querySelector("#btn-mailto")
287 .setAttribute('id', mailToButtonID); 290 .setAttribute('id', mailToButtonID);
288   291  
289 file 292 file
290 .previewElement 293 .previewElement
291 .querySelector(".start") 294 .querySelector(".start")
292 .setAttribute("disabled", "disabled"); 295 .setAttribute("disabled", "disabled");
293 file 296 file
294 .previewElement 297 .previewElement
295 .querySelector(".cancel") 298 .querySelector(".cancel")
296 .setAttribute("disabled", "disabled"); 299 .setAttribute("disabled", "disabled");
297 300
298 $('#' + mailToButtonID).on('click', () => { 301 $('#' + mailToButtonID).on('click', () => {
299 window.location.href = "mailto:?subject="+ 302 window.location.href = "mailto:?subject="+
300 encodeURIComponent("Can't scratch this!") + "&body=" + 303 encodeURIComponent("Can't scratch this!") + "&body=" +
301 encodeURIComponent($('#' + boxURLID).val()); 304 encodeURIComponent($('#' + boxURLID).val());
302 }); 305 });
-   306
-   307 // Set the ID of the facebook button.
-   308 const faceBookButtonID = '_' + Math
-   309 .random()
-   310 .toString(36)
-   311 .substr(2, 9);
-   312  
-   313 file
-   314 .previewElement
-   315 .querySelector("#btn-facebook")
-   316 .setAttribute('id', faceBookButtonID);
-   317
-   318 switch(data.opengraph) {
-   319 case true:
-   320 // Enable the facebook button.
-   321 file
-   322 .previewElement
-   323 .querySelector('#' + faceBookButtonID)
-   324 .removeAttribute("disabled");
-   325
-   326 // Change the URL when the user clicks the button.
-   327 $('#' + faceBookButtonID).on('click', () => {
-   328 $('#' + boxURLID)
-   329 .val(
-   330 location.protocol.concat("//")
-   331 .concat(window.location.hostname)
-   332 .concat("/")
-   333 .concat("og")
-   334 .concat("/")
-   335 .concat(data.hash)
-   336 );
-   337 });
-   338 break;
-   339 default:
-   340 // Disable the facebook button.
-   341 file
-   342 .previewElement
-   343 .querySelector('#' + faceBookButtonID)
-   344 .setAttribute("disabled", "disabled");
-   345 break;
-   346 }
303 }); 347 });
304 348
305 document.querySelector("#actions .start").onclick = () => { 349 document.querySelector("#actions .start").onclick = () => {
306 myDropzone.enqueueFiles( 350 myDropzone.enqueueFiles(
307 myDropzone 351 myDropzone
308 .getFilesWithStatus(Dropzone.ADDED)); 352 .getFilesWithStatus(Dropzone.ADDED));
309 }; 353 };
310 354
311 document.querySelector("#actions .cancel").onclick = () => { 355 document.querySelector("#actions .cancel").onclick = () => {
312 myDropzone.removeAllFiles(true); 356 myDropzone.removeAllFiles(true);
313 }; 357 };
314 358
315 // Scroll to the panel. 359 // Scroll to the panel.
316 $('html, body').animate({ 360 $('html, body').animate({
317 scrollTop: $('#main-panel').offset().top 361 scrollTop: $('#main-panel').offset().top
318 }, 'slow'); 362 }, 'slow');
319 }); 363 });
320 </script> 364 </script>
321 <!-- Jumbotron parallax effect --> 365 <!-- Jumbotron parallax effect -->
322 <script> 366 <script>
323 const jumboHeight = $('.jumbotron').outerHeight(); 367 const jumboHeight = $('.jumbotron').outerHeight();
324 function parallax(){ 368 function parallax(){
325 var scrolled = $(window).scrollTop(); 369 var scrolled = $(window).scrollTop();
326 $('.paralax-background').css('height', (jumboHeight-scrolled) + 'px'); 370 $('.paralax-background').css('height', (jumboHeight-scrolled) + 'px');
327 } 371 }
328   372  
329 $(window).scroll(function(e){ 373 $(window).scroll(function(e){
330 parallax(); 374 parallax();
331 }); 375 });
332 </script> 376 </script>
333 </body> 377 </body>
334 </html> 378 </html>
335   379