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