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