scratch – Diff between revs 77 and 84

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