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