scratch – Diff between revs 76 and 77

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