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