scratch – Blame information for rev 42
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
25 | office | 1 | <!DOCTYPE html> |
2 | <html lang="en"> |
||
3 | <head> |
||
4 | <meta charset="utf-8"> |
||
5 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||
35 | office | 6 | <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> |
7 | <meta http-equiv="Pragma" content="no-cache" /> |
||
8 | <meta http-equiv="Expires" content="0" /> |
||
25 | office | 9 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
10 | <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> |
||
11 | <meta name="description" content="quick asset upload"> |
||
12 | <meta name="author" content="Wizardry and Steamworks"> |
||
13 | <link rel="icon" href="favicon.ico"> |
||
14 | |||
15 | <title>Quickload</title> |
||
31 | office | 16 | |
17 | <!-- Polyfill --> |
||
32 | office | 18 | <script src="js/polyfill/polyfill.min.js"></script> |
25 | office | 19 | |
20 | <!-- Bootstrap core CSS --> |
||
21 | <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet"> |
||
22 | |||
23 | <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> |
||
24 | <link href="css/bootstrap/ie10-viewport-bug-workaround.css" rel="stylesheet"> |
||
25 | |||
26 | <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> |
||
27 | <!--[if lt IE 9]><script src="js/bootstrap/ie8-responsive-file-warning.js"></script><![endif]--> |
||
28 | <script src="js/bootstrap/ie-emulation-modes-warning.js"></script> |
||
29 | |||
30 | <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> |
||
31 | <!--[if lt IE 9]> |
||
32 | <script src="js/bootstrap/html5shiv.min.js"></script> |
||
33 | <script src="js/bootstrap/respond.min.js"></script> |
||
34 | <![endif]--> |
||
35 | |||
36 | <!-- Trumbowyg --> |
||
37 | <link href="css/trumbowyg/trumbowyg.min.css" rel="stylesheet"> |
||
38 | <!-- Local style --> |
||
32 | office | 39 | <link href="css/text/style.css" rel="stylesheet"> |
25 | office | 40 | </head> |
41 | |||
42 | <body> |
||
43 | |||
44 | <div class="container"> |
||
45 | |||
46 | <!-- Main component for a primary marketing message or call to action --> |
||
47 | <div class="jumbotron"> |
||
48 | <h1>Quickload</h1> |
||
49 | <p>Asset sharing platform.</p> |
||
50 | </div> |
||
51 | |||
52 | <ul class="nav nav-tabs"> |
||
53 | <li><a href="index.html">Home</a></li> |
||
54 | <li><a href="files.html">Files</a></li> |
||
55 | <li class="active"><a href="#">Text</a></li> |
||
56 | </ul> |
||
57 | |||
31 | office | 58 | <div class="panel panel-default"> |
59 | <div class="panel-heading"> |
||
37 | office | 60 | <div class="form-group"> |
31 | office | 61 | <div class="input-group"> |
62 | <span class="input-group-btn"> |
||
39 | office | 63 | <button id="save" class="btn btn-default" type="button" data-toggle="tooltip" data-placement="auto" title="Generate link."> |
41 | office | 64 | <i class="glyphicon glyphicon-share"></i> |
31 | office | 65 | </button> |
66 | </span> |
||
38 | office | 67 | <input id="URL" type="text" class="form-control" readonly> |
32 | office | 68 | <span class="input-group-btn"> |
39 | office | 69 | <button id="copy-url" class="btn btn-default" type="button" data-clipboard-target="#URL" data-toggle="tooltip" data-placement="auto" title="Copy to clipboard."><i class="glyphicon glyphicon-paperclip"></i></button> |
32 | office | 70 | </span> |
31 | office | 71 | </div> |
72 | </div> |
||
38 | office | 73 | <form id="nick-form" role="form"> |
37 | office | 74 | <div class="form-group has-feedback"> |
75 | <div class="input-group"> |
||
76 | <span class="input-group-btn"> |
||
39 | office | 77 | <button id="go" class="btn btn-default" type="button" data-toggle="tooltip" data-placement="auto" title="Load document."> |
37 | office | 78 | <i class="glyphicon glyphicon-play"></i> |
79 | </button> |
||
80 | </span> |
||
81 | <span class="input-group-btn"> |
||
39 | office | 82 | <button id="reset" class="btn btn-default" type="button" data-toggle="tooltip" data-placement="auto" title="Reset document."> |
42 | office | 83 | <i id="home-icon" class="glyphicon glyphicon-home"></i> |
38 | office | 84 | </button> |
85 | </span> |
||
86 | <input id="nick" type="text" class="form-control" pattern="^[A-Za-z0-9]{32}$" maxlength="32"> |
||
87 | <span class="input-group-btn"> |
||
39 | office | 88 | <button id="copy-nick" class="btn btn-default" type="button" data-clipboard-target="#nick" data-toggle="tooltip" data-placement="auto" title="Copy to clipboard."><i class="glyphicon glyphicon-paperclip"></i></button> |
37 | office | 89 | </span> |
90 | </div> |
||
91 | </div> |
||
92 | </form> |
||
93 | </div> |
||
32 | office | 94 | <div class="panel-body" id="editorpanel"> |
95 | <div id="trumbowyg" style="display: none; font-family: monospace;"> |
||
31 | office | 96 | </div> |
97 | </div> |
||
25 | office | 98 | </div> |
99 | |||
100 | </div> <!-- /container --> |
||
101 | |||
102 | <div id="footer"> |
||
103 | <div class="container"> |
||
104 | <p class="text-muted credit">Copyright <i class="glyphicon glyphicon-copyright-mark"></i> 2017 <a href="http://grimore.org">Wizardry and Steamworks</a>.</p> |
||
105 | </div> |
||
106 | </div> |
||
107 | |||
108 | <script src="js/jquery/jquery.min.js"></script> |
||
109 | <script src="js/bootstrap/bootstrap.min.js"></script> |
||
110 | <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> |
||
111 | <script src="js/bootstrap/ie10-viewport-bug-workaround.js"></script> |
||
112 | |||
113 | <!-- Trumbowyg --> |
||
114 | <script src="js/trumbowyg/trumbowyg.min.js"></script> |
||
32 | office | 115 | <!-- Clipboard --> |
116 | <script src="js/clipboard/clipboard.min.js"></script> |
||
37 | office | 117 | <!-- Fingerprint 2 --> |
118 | <script src="js/fingerprintjs/fingerprint2.min.js"></script> |
||
119 | <!-- js-cookie --> |
||
120 | <script src="js/jscookie/js.cookie.js"></script> |
||
121 | <!-- Bootstrap Validator --> |
||
122 | <script src="js/validator/validator.min.js"></script> |
||
25 | office | 123 | <script> |
124 | $(document).ready(() => { |
||
38 | office | 125 | // Attach the form validator. |
126 | $('#nick-form').validator({ |
||
127 | focus: false |
||
128 | }); |
||
129 | |||
37 | office | 130 | // Get the fingerprint. |
131 | new Fingerprint2().get((result, components) => { |
||
132 | // Set the nick as a cookie. |
||
38 | office | 133 | const fingerprint = result; |
37 | office | 134 | var nick = Cookies.get('nick'); |
135 | if(!nick || nick.length !== 32) |
||
136 | Cookies.set('nick', result, { path: '' }); |
||
137 | else |
||
138 | result = nick; |
||
139 | |||
140 | // Set the nick. |
||
141 | $('#nick').val(result); |
||
142 | new Clipboard('#copy-nick'); |
||
143 | |||
42 | office | 144 | if(fingerprint == nick) |
145 | $('#home-icon').addClass("text-success"); |
||
146 | else |
||
147 | $('#home-icon').addClass("text-danger"); |
||
148 | |||
37 | office | 149 | // Load the editor. |
150 | $('#trumbowyg').trumbowyg({ |
||
151 | autogrow: true, |
||
152 | disabled: true |
||
153 | }).on('tbwchange', () => { |
||
154 | $('#editor').trumbowyg('disable'); |
||
155 | $.post('share-text.php', { |
||
156 | data: $('#trumbowyg').trumbowyg('html'), |
||
157 | fingerprint: result, |
||
158 | action: 'SAVE' |
||
159 | }).done((data) => { |
||
160 | $('#trumbowyg').trumbowyg('enable'); |
||
161 | }).fail(() => { |
||
162 | $('#trumbowyg').trumbowyg('enable'); |
||
163 | }); |
||
164 | }); |
||
165 | |||
166 | // Retrieve the contents of the shared file. |
||
167 | $.post('share-text.php', |
||
168 | { |
||
169 | timestamp: window.performance.now(), |
||
170 | fingerprint: result, |
||
171 | action: 'LOAD' |
||
172 | }).done((data) => {; |
||
173 | $('#trumbowyg') |
||
174 | .trumbowyg('html', data); |
||
29 | office | 175 | $('#trumbowyg').trumbowyg('enable'); |
37 | office | 176 | $('#trumbowyg').show(); |
29 | office | 177 | }).fail(() => { |
178 | $('#trumbowyg').trumbowyg('enable'); |
||
37 | office | 179 | $('#trumbowyg').show(); |
25 | office | 180 | }); |
31 | office | 181 | |
37 | office | 182 | // Enable the Clipboard button. |
183 | new Clipboard('#copy-url'); |
||
31 | office | 184 | |
37 | office | 185 | $('#save').click(() => { |
186 | $('#editor').trumbowyg('disable'); |
||
31 | office | 187 | |
37 | office | 188 | var formData = new FormData(); |
189 | formData.append('file', new Blob( |
||
190 | [ |
||
191 | $('#trumbowyg').trumbowyg('html') |
||
192 | ] |
||
193 | ), |
||
194 | '.html' |
||
195 | ); |
||
31 | office | 196 | |
37 | office | 197 | $.ajax({ |
198 | url: 'upload-files.php', |
||
199 | type: 'POST', |
||
200 | data: formData, |
||
201 | // cache: false // FF |
||
202 | processData: false, |
||
203 | contentType: false |
||
204 | }).done((data) => { |
||
205 | $('#URL').val(data); |
||
206 | $('#trumbowyg').trumbowyg('enable'); |
||
207 | }).fail(() => { |
||
208 | $('#trumbowyg').trumbowyg('enable'); |
||
209 | }); |
||
31 | office | 210 | }); |
37 | office | 211 | |
41 | office | 212 | // When the button is clicked, navigate to the fingerprint. |
37 | office | 213 | $('#go').click(() => { |
214 | nick = $('#nick').val(); |
||
215 | if(!nick || nick.length != 32) |
||
216 | return; |
||
217 | Cookies.set('nick', nick, { path: '' }); |
||
40 | office | 218 | result = nick; |
37 | office | 219 | |
42 | office | 220 | if(fingerprint == nick) |
221 | $('#home-icon').addClass("text-success").removeClass("text-danger"); |
||
222 | else |
||
223 | $('#home-icon').addClass("text-danger").removeClass("text-success"); |
||
224 | |||
37 | office | 225 | // Retrieve the contents of the shared file. |
226 | $.post('share-text.php', |
||
227 | { |
||
228 | timestamp: window.performance.now(), |
||
229 | fingerprint: nick, |
||
230 | action: 'LOAD' |
||
231 | }).done((data) => {; |
||
232 | $('#trumbowyg') |
||
233 | .trumbowyg('html', data); |
||
234 | $('#trumbowyg').trumbowyg('enable'); |
||
235 | $('#trumbowyg').show(); |
||
42 | office | 236 | |
237 | if(fingerprint == nick) |
||
238 | $('#home-icon').addClass("text-success"); |
||
239 | else |
||
240 | $('#home-icon').addClass("text-danger"); |
||
241 | |||
37 | office | 242 | }).fail(() => { |
243 | $('#trumbowyg').trumbowyg('enable'); |
||
244 | $('#trumbowyg').show(); |
||
245 | }); |
||
246 | }); |
||
38 | office | 247 | |
41 | office | 248 | // When the form is submitted, naigate to the fingerprint. |
38 | office | 249 | $('#nick-form').submit((e) => { |
250 | e.preventDefault(); |
||
251 | |||
252 | nick = $('#nick').val(); |
||
253 | if(!nick || nick.length != 32) |
||
254 | return; |
||
255 | Cookies.set('nick', nick, { path: '' }); |
||
40 | office | 256 | result = nick; |
38 | office | 257 | |
42 | office | 258 | if(fingerprint == nick) |
259 | $('#home-icon').addClass("text-success"); |
||
260 | else |
||
261 | $('#home-icon').addClass("text-danger"); |
||
262 | |||
38 | office | 263 | // Retrieve the contents of the shared file. |
264 | $.post('share-text.php', |
||
265 | { |
||
266 | timestamp: window.performance.now(), |
||
267 | fingerprint: nick, |
||
268 | action: 'LOAD' |
||
269 | }).done((data) => {; |
||
270 | $('#trumbowyg') |
||
271 | .trumbowyg('html', data); |
||
272 | $('#trumbowyg').trumbowyg('enable'); |
||
273 | $('#trumbowyg').show(); |
||
42 | office | 274 | |
275 | if(fingerprint == nick) |
||
276 | $('#home-icon').addClass("text-success").removeClass("text-danger"); |
||
277 | else |
||
278 | $('#home-icon').addClass("text-danger").removeClass("text-success"); |
||
279 | |||
38 | office | 280 | }).fail(() => { |
281 | $('#trumbowyg').trumbowyg('enable'); |
||
282 | $('#trumbowyg').show(); |
||
283 | }); |
||
284 | }); |
||
285 | |||
41 | office | 286 | // While the nick is changing, navigate to the changed fingerprint. |
287 | $("#nick").on('input', () => { |
||
288 | nick = $('#nick').val(); |
||
289 | if(!nick || nick.length != 32) |
||
290 | return; |
||
291 | Cookies.set('nick', nick, { path: '' }); |
||
292 | result = nick; |
||
293 | |||
42 | office | 294 | if(fingerprint == nick) |
295 | $('#home-icon').addClass("text-success").removeClass("text-danger"); |
||
296 | else |
||
297 | $('#home-icon').addClass("text-danger").removeClass("text-success"); |
||
298 | |||
41 | office | 299 | // Retrieve the contents of the shared file. |
300 | $.post('share-text.php', |
||
301 | { |
||
302 | timestamp: window.performance.now(), |
||
303 | fingerprint: nick, |
||
304 | action: 'LOAD' |
||
305 | }).done((data) => {; |
||
306 | $('#trumbowyg') |
||
307 | .trumbowyg('html', data); |
||
308 | $('#trumbowyg').trumbowyg('enable'); |
||
309 | $('#trumbowyg').show(); |
||
310 | }).fail(() => { |
||
311 | $('#trumbowyg').trumbowyg('enable'); |
||
312 | $('#trumbowyg').show(); |
||
313 | }); |
||
314 | }); |
||
315 | |||
316 | // When the reset button is pressed, navigate to the fingerprint. |
||
38 | office | 317 | $('#reset').click(() => { |
318 | Cookies.set('nick', fingerprint, { path: '' }); |
||
319 | $('#nick').val(fingerprint); |
||
40 | office | 320 | result = fingerprint; |
42 | office | 321 | nick = fingerprint; |
38 | office | 322 | |
42 | office | 323 | if(fingerprint == nick) |
324 | $('#home-icon').addClass("text-success").removeClass("text-danger"); |
||
325 | else |
||
326 | $('#home-icon').addClass("text-danger").removeClass("text-success"); |
||
327 | |||
38 | office | 328 | // Retrieve the contents of the shared file. |
329 | $.post('share-text.php', |
||
330 | { |
||
331 | timestamp: window.performance.now(), |
||
332 | fingerprint: fingerprint, |
||
333 | action: 'LOAD' |
||
334 | }).done((data) => {; |
||
335 | $('#trumbowyg') |
||
336 | .trumbowyg('html', data); |
||
337 | $('#trumbowyg').trumbowyg('enable'); |
||
338 | $('#trumbowyg').show(); |
||
339 | }).fail(() => { |
||
340 | $('#trumbowyg').trumbowyg('enable'); |
||
341 | $('#trumbowyg').show(); |
||
342 | }); |
||
343 | }); |
||
31 | office | 344 | }); |
32 | office | 345 | |
25 | office | 346 | }); |
347 | </script> |
||
348 | </body> |
||
349 | </html> |