scratch – Blame information for rev 71
?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 | |||
64 | office | 15 | <title>scratch</title> |
25 | office | 16 | |
17 | <!-- Bootstrap core CSS --> |
||
58 | office | 18 | <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> |
65 | office | 19 | <!-- Font Awesome --> |
20 | <link href="bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet"> |
||
25 | office | 21 | <!-- Trumbowyg --> |
58 | office | 22 | <link href="bower_components/trumbowyg/dist/ui/trumbowyg.min.css" rel="stylesheet"> |
71 | office | 23 | |
24 | <!-- Site-wide style CCS --> |
||
25 | <link href="css/style.css" rel="stylesheet"> |
||
26 | |||
25 | office | 27 | <!-- Local style --> |
32 | office | 28 | <link href="css/text/style.css" rel="stylesheet"> |
25 | office | 29 | </head> |
30 | |||
31 | <body> |
||
32 | |||
71 | office | 33 | <!-- Main component for a primary marketing message or call to action --> |
34 | <div class="paralax-background"></div> |
||
35 | <div class="jumbotron"> |
||
36 | <h1>scratch copy</h1> |
||
37 | <p class="quote">the asset sharer</p> |
||
38 | </div> |
||
39 | |||
25 | office | 40 | <div class="container"> |
41 | |||
42 | <ul class="nav nav-tabs"> |
||
43 | <li><a href="index.html">Home</a></li> |
||
56 | office | 44 | <li><a href="file.html">File</a></li> |
25 | office | 45 | <li class="active"><a href="#">Text</a></li> |
46 | </ul> |
||
47 | |||
31 | office | 48 | <div class="panel panel-default"> |
49 | <div class="panel-heading"> |
||
37 | office | 50 | <div class="form-group"> |
31 | office | 51 | <div class="input-group"> |
52 | <span class="input-group-btn"> |
||
39 | office | 53 | <button id="save" class="btn btn-default" type="button" data-toggle="tooltip" data-placement="auto" title="Generate link."> |
41 | office | 54 | <i class="glyphicon glyphicon-share"></i> |
31 | office | 55 | </button> |
56 | </span> |
||
38 | office | 57 | <input id="URL" type="text" class="form-control" readonly> |
32 | office | 58 | <span class="input-group-btn"> |
39 | office | 59 | <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 | 60 | </span> |
31 | office | 61 | </div> |
62 | </div> |
||
38 | office | 63 | <form id="nick-form" role="form"> |
37 | office | 64 | <div class="form-group has-feedback"> |
65 | <div class="input-group"> |
||
66 | <span class="input-group-btn"> |
||
39 | office | 67 | <button id="go" class="btn btn-default" type="button" data-toggle="tooltip" data-placement="auto" title="Load document."> |
37 | office | 68 | <i class="glyphicon glyphicon-play"></i> |
69 | </button> |
||
70 | </span> |
||
71 | <span class="input-group-btn"> |
||
39 | office | 72 | <button id="reset" class="btn btn-default" type="button" data-toggle="tooltip" data-placement="auto" title="Reset document."> |
42 | office | 73 | <i id="home-icon" class="glyphicon glyphicon-home"></i> |
38 | office | 74 | </button> |
75 | </span> |
||
76 | <input id="nick" type="text" class="form-control" pattern="^[A-Za-z0-9]{32}$" maxlength="32"> |
||
77 | <span class="input-group-btn"> |
||
39 | office | 78 | <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 | 79 | </span> |
80 | </div> |
||
81 | </div> |
||
82 | </form> |
||
83 | </div> |
||
32 | office | 84 | <div class="panel-body" id="editorpanel"> |
85 | <div id="trumbowyg" style="display: none; font-family: monospace;"> |
||
31 | office | 86 | </div> |
87 | </div> |
||
25 | office | 88 | </div> |
89 | |||
90 | </div> <!-- /container --> |
||
91 | |||
92 | <div id="footer"> |
||
93 | <div class="container"> |
||
71 | office | 94 | <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> |
25 | office | 95 | </div> |
96 | </div> |
||
97 | |||
58 | office | 98 | <!-- jQuery --> |
99 | <script src="bower_components/jquery/dist/jquery.min.js"></script> |
||
100 | <!-- BootStrap --> |
||
101 | <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script> |
||
25 | office | 102 | |
103 | <!-- Trumbowyg --> |
||
58 | office | 104 | <script src="bower_components/trumbowyg/dist/trumbowyg.min.js"></script> |
32 | office | 105 | <!-- Clipboard --> |
58 | office | 106 | <script src="bower_components/clipboard/dist/clipboard.min.js"></script> |
37 | office | 107 | <!-- Fingerprint 2 --> |
58 | office | 108 | <script src="bower_components/fingerprintjs2/dist/fingerprint2.min.js"></script> |
37 | office | 109 | <!-- js-cookie --> |
58 | office | 110 | <script src="bower_components/js-cookie/src/js.cookie.js"></script> |
37 | office | 111 | <!-- Bootstrap Validator --> |
58 | office | 112 | <script src="bower_components/bootstrap-validator/dist/validator.min.js"></script> |
25 | office | 113 | <script> |
114 | $(document).ready(() => { |
||
38 | office | 115 | // Attach the form validator. |
116 | $('#nick-form').validator({ |
||
117 | focus: false |
||
118 | }); |
||
119 | |||
43 | office | 120 | // Enable the Clipboard button. |
121 | new Clipboard('#copy-url'); |
||
122 | |||
37 | office | 123 | // Get the fingerprint. |
61 | office | 124 | new Fingerprint2({ |
125 | //excludeUserAgent: true, |
||
126 | //excludeLanguage: true, |
||
127 | excludeColorDepth: true, |
||
128 | excludeScreenResolution: true, |
||
129 | excludeAvailableScreenResolution: true, |
||
130 | //excludeTimezoneOffset: true, |
||
131 | excludeSessionStorage: true, |
||
132 | excludeIndexedDB: true, |
||
133 | excludeAddBehavior: true, |
||
134 | excludeOpenDatabase: true, |
||
135 | //excludeCpuClass: true, |
||
136 | //excludePlatform: true, |
||
137 | excludeDoNotTrack: true, |
||
138 | excludeCanvas: true, |
||
139 | excludeWebGL: true, |
||
140 | excludeAdBlock: true, |
||
141 | //excludeHasLiedLanguages: true, |
||
142 | //excludeHasLiedResolution: true, |
||
143 | //excludeHasLiedOs: true, |
||
144 | //excludeHasLiedBrowser: true, |
||
145 | excludeJsFonts: true, |
||
146 | excludeFlashFonts: true, |
||
147 | excludePlugins: true, |
||
148 | excludeIEPlugins: true, |
||
149 | //excludeTouchSupport: true, |
||
150 | excludePixelRatio: true |
||
151 | }).get((result, components) => { |
||
37 | office | 152 | // Set the nick as a cookie. |
38 | office | 153 | const fingerprint = result; |
37 | office | 154 | var nick = Cookies.get('nick'); |
43 | office | 155 | if(!nick || nick.length !== 32) { |
37 | office | 156 | Cookies.set('nick', result, { path: '' }); |
43 | office | 157 | nick = result; |
158 | } |
||
37 | office | 159 | else |
160 | result = nick; |
||
161 | |||
162 | // Set the nick. |
||
163 | $('#nick').val(result); |
||
164 | new Clipboard('#copy-nick'); |
||
165 | |||
42 | office | 166 | if(fingerprint == nick) |
167 | $('#home-icon').addClass("text-success"); |
||
168 | else |
||
169 | $('#home-icon').addClass("text-danger"); |
||
170 | |||
54 | office | 171 | function saveTextFile() { |
49 | office | 172 | $.post('text.php', { |
37 | office | 173 | data: $('#trumbowyg').trumbowyg('html'), |
174 | fingerprint: result, |
||
51 | office | 175 | action: 'SAVE', |
176 | timeout: 0 |
||
37 | office | 177 | }); |
54 | office | 178 | } |
179 | var autoSaveTimeoutID = window.setTimeout(saveTextFile, 250); |
||
180 | |||
181 | // Load the editor. |
||
182 | $('#trumbowyg').trumbowyg({ |
||
183 | autogrow: true, |
||
184 | disabled: true |
||
185 | }).on('tbwchange', () => { |
||
186 | // Clear the value of the URL box because the URL will have changed. |
||
187 | $('#URL').val(''); |
||
188 | // Reschedule saving of the file. |
||
189 | window.clearTimeout(autoSaveTimeoutID); |
||
190 | autoSaveTimeoutID = window.setTimeout(saveTextFile, 250); |
||
37 | office | 191 | }); |
54 | office | 192 | |
37 | office | 193 | // Retrieve the contents of the shared file. |
54 | office | 194 | $('#trumbowyg').trumbowyg('disable'); |
49 | office | 195 | $.post('text.php', |
37 | office | 196 | { |
197 | timestamp: window.performance.now(), |
||
198 | fingerprint: result, |
||
199 | action: 'LOAD' |
||
200 | }).done((data) => {; |
||
201 | $('#trumbowyg') |
||
202 | .trumbowyg('html', data); |
||
29 | office | 203 | $('#trumbowyg').trumbowyg('enable'); |
37 | office | 204 | $('#trumbowyg').show(); |
29 | office | 205 | }).fail(() => { |
206 | $('#trumbowyg').trumbowyg('enable'); |
||
37 | office | 207 | $('#trumbowyg').show(); |
25 | office | 208 | }); |
31 | office | 209 | |
37 | office | 210 | $('#save').click(() => { |
211 | $('#editor').trumbowyg('disable'); |
||
212 | var formData = new FormData(); |
||
213 | formData.append('file', new Blob( |
||
214 | [ |
||
215 | $('#trumbowyg').trumbowyg('html') |
||
216 | ] |
||
217 | ), |
||
218 | '.html' |
||
219 | ); |
||
31 | office | 220 | |
37 | office | 221 | $.ajax({ |
49 | office | 222 | url: 'file.php', |
37 | office | 223 | type: 'POST', |
224 | data: formData, |
||
225 | // cache: false // FF |
||
226 | processData: false, |
||
227 | contentType: false |
||
228 | }).done((data) => { |
||
229 | $('#URL').val(data); |
||
230 | $('#trumbowyg').trumbowyg('enable'); |
||
231 | }).fail(() => { |
||
232 | $('#trumbowyg').trumbowyg('enable'); |
||
233 | }); |
||
31 | office | 234 | }); |
37 | office | 235 | |
41 | office | 236 | // When the button is clicked, navigate to the fingerprint. |
37 | office | 237 | $('#go').click(() => { |
238 | nick = $('#nick').val(); |
||
239 | if(!nick || nick.length != 32) |
||
240 | return; |
||
241 | Cookies.set('nick', nick, { path: '' }); |
||
40 | office | 242 | result = nick; |
37 | office | 243 | |
244 | // Retrieve the contents of the shared file. |
||
54 | office | 245 | $('#editor').trumbowyg('disable'); |
49 | office | 246 | $.post('text.php', |
37 | office | 247 | { |
248 | timestamp: window.performance.now(), |
||
249 | fingerprint: nick, |
||
250 | action: 'LOAD' |
||
251 | }).done((data) => {; |
||
252 | $('#trumbowyg') |
||
253 | .trumbowyg('html', data); |
||
254 | $('#trumbowyg').trumbowyg('enable'); |
||
255 | $('#trumbowyg').show(); |
||
42 | office | 256 | |
257 | if(fingerprint == nick) |
||
43 | office | 258 | $('#home-icon').addClass("text-success").removeClass("text-danger"); |
42 | office | 259 | else |
43 | office | 260 | $('#home-icon').addClass("text-danger").removeClass("text-success"); |
42 | office | 261 | |
37 | office | 262 | }).fail(() => { |
263 | $('#trumbowyg').trumbowyg('enable'); |
||
264 | $('#trumbowyg').show(); |
||
265 | }); |
||
266 | }); |
||
38 | office | 267 | |
41 | office | 268 | // When the form is submitted, naigate to the fingerprint. |
38 | office | 269 | $('#nick-form').submit((e) => { |
270 | e.preventDefault(); |
||
271 | |||
272 | nick = $('#nick').val(); |
||
273 | if(!nick || nick.length != 32) |
||
274 | return; |
||
275 | Cookies.set('nick', nick, { path: '' }); |
||
40 | office | 276 | result = nick; |
38 | office | 277 | |
278 | // Retrieve the contents of the shared file. |
||
54 | office | 279 | $('#editor').trumbowyg('disable'); |
49 | office | 280 | $.post('text.php', |
38 | office | 281 | { |
282 | timestamp: window.performance.now(), |
||
283 | fingerprint: nick, |
||
284 | action: 'LOAD' |
||
285 | }).done((data) => {; |
||
286 | $('#trumbowyg') |
||
287 | .trumbowyg('html', data); |
||
288 | $('#trumbowyg').trumbowyg('enable'); |
||
289 | $('#trumbowyg').show(); |
||
42 | office | 290 | |
291 | if(fingerprint == nick) |
||
292 | $('#home-icon').addClass("text-success").removeClass("text-danger"); |
||
293 | else |
||
294 | $('#home-icon').addClass("text-danger").removeClass("text-success"); |
||
295 | |||
38 | office | 296 | }).fail(() => { |
297 | $('#trumbowyg').trumbowyg('enable'); |
||
298 | $('#trumbowyg').show(); |
||
299 | }); |
||
300 | }); |
||
301 | |||
41 | office | 302 | // While the nick is changing, navigate to the changed fingerprint. |
303 | $("#nick").on('input', () => { |
||
304 | nick = $('#nick').val(); |
||
305 | if(!nick || nick.length != 32) |
||
306 | return; |
||
307 | Cookies.set('nick', nick, { path: '' }); |
||
308 | result = nick; |
||
309 | |||
310 | // Retrieve the contents of the shared file. |
||
54 | office | 311 | $('#editor').trumbowyg('disable'); |
49 | office | 312 | $.post('text.php', |
41 | office | 313 | { |
314 | timestamp: window.performance.now(), |
||
315 | fingerprint: nick, |
||
316 | action: 'LOAD' |
||
317 | }).done((data) => {; |
||
318 | $('#trumbowyg') |
||
319 | .trumbowyg('html', data); |
||
320 | $('#trumbowyg').trumbowyg('enable'); |
||
321 | $('#trumbowyg').show(); |
||
43 | office | 322 | |
323 | if(fingerprint == nick) |
||
324 | $('#home-icon').addClass("text-success").removeClass("text-danger"); |
||
325 | else |
||
326 | $('#home-icon').addClass("text-danger").removeClass("text-success"); |
||
41 | office | 327 | }).fail(() => { |
328 | $('#trumbowyg').trumbowyg('enable'); |
||
329 | $('#trumbowyg').show(); |
||
330 | }); |
||
331 | }); |
||
332 | |||
333 | // When the reset button is pressed, navigate to the fingerprint. |
||
38 | office | 334 | $('#reset').click(() => { |
335 | Cookies.set('nick', fingerprint, { path: '' }); |
||
336 | $('#nick').val(fingerprint); |
||
40 | office | 337 | result = fingerprint; |
42 | office | 338 | nick = fingerprint; |
38 | office | 339 | |
340 | // Retrieve the contents of the shared file. |
||
54 | office | 341 | $('#editor').trumbowyg('disable'); |
49 | office | 342 | $.post('text.php', |
38 | office | 343 | { |
344 | timestamp: window.performance.now(), |
||
345 | fingerprint: fingerprint, |
||
346 | action: 'LOAD' |
||
347 | }).done((data) => {; |
||
348 | $('#trumbowyg') |
||
349 | .trumbowyg('html', data); |
||
350 | $('#trumbowyg').trumbowyg('enable'); |
||
351 | $('#trumbowyg').show(); |
||
43 | office | 352 | if(fingerprint == nick) |
353 | $('#home-icon').addClass("text-success").removeClass("text-danger"); |
||
354 | else |
||
355 | $('#home-icon').addClass("text-danger").removeClass("text-success"); |
||
38 | office | 356 | }).fail(() => { |
357 | $('#trumbowyg').trumbowyg('enable'); |
||
358 | $('#trumbowyg').show(); |
||
359 | }); |
||
360 | }); |
||
31 | office | 361 | }); |
25 | office | 362 | }); |
363 | </script> |
||
71 | office | 364 | <!-- Jumbotron parallax effect --> |
70 | office | 365 | <script> |
366 | var jumboHeight = $('.jumbotron').outerHeight(); |
||
367 | function parallax(){ |
||
368 | var scrolled = $(window).scrollTop(); |
||
369 | $('.paralax-background').css('height', (jumboHeight-scrolled) + 'px'); |
||
370 | } |
||
371 | |||
372 | $(window).scroll(function(e){ |
||
373 | parallax(); |
||
374 | }); |
||
375 | </script> |
||
25 | office | 376 | </body> |
377 | </html> |