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