scratch – Diff between revs 42 and 43
?pathlinks?
Rev 42 | Rev 43 | |||
---|---|---|---|---|
Line 125... | Line 125... | |||
125 | // Attach the form validator. |
125 | // Attach the form validator. |
|
126 | $('#nick-form').validator({ |
126 | $('#nick-form').validator({ |
|
127 | focus: false |
127 | focus: false |
|
128 | }); |
128 | }); |
|
Line -... | Line 129... | |||
- | 129 | |
||
- | 130 | // Enable the Clipboard button. |
||
- | 131 | new Clipboard('#copy-url'); |
||
129 | |
132 | |
|
130 | // Get the fingerprint. |
133 | // Get the fingerprint. |
|
131 | new Fingerprint2().get((result, components) => { |
134 | new Fingerprint2().get((result, components) => { |
|
132 | // Set the nick as a cookie. |
135 | // Set the nick as a cookie. |
|
133 | const fingerprint = result; |
136 | const fingerprint = result; |
|
134 | var nick = Cookies.get('nick'); |
137 | var nick = Cookies.get('nick'); |
|
135 | if(!nick || nick.length !== 32) |
138 | if(!nick || nick.length !== 32) { |
|
- | 139 | Cookies.set('nick', result, { path: '' }); |
||
- | 140 | nick = result; |
||
136 | Cookies.set('nick', result, { path: '' }); |
141 | } |
|
137 | else |
142 | else |
|
Line 138... | Line 143... | |||
138 | result = nick; |
143 | result = nick; |
|
139 | |
144 | |
|
Line 177... | Line 182... | |||
177 | }).fail(() => { |
182 | }).fail(() => { |
|
178 | $('#trumbowyg').trumbowyg('enable'); |
183 | $('#trumbowyg').trumbowyg('enable'); |
|
179 | $('#trumbowyg').show(); |
184 | $('#trumbowyg').show(); |
|
180 | }); |
185 | }); |
|
Line 181... | Line -... | |||
181 | |
- | ||
182 | // Enable the Clipboard button. |
- | ||
183 | new Clipboard('#copy-url'); |
- | ||
184 | |
186 | |
|
185 | $('#save').click(() => { |
187 | $('#save').click(() => { |
|
Line 186... | Line 188... | |||
186 | $('#editor').trumbowyg('disable'); |
188 | $('#editor').trumbowyg('disable'); |
|
187 | |
189 | |
|
Line 215... | Line 217... | |||
215 | if(!nick || nick.length != 32) |
217 | if(!nick || nick.length != 32) |
|
216 | return; |
218 | return; |
|
217 | Cookies.set('nick', nick, { path: '' }); |
219 | Cookies.set('nick', nick, { path: '' }); |
|
218 | result = nick; |
220 | result = nick; |
|
Line 219... | Line -... | |||
219 | |
- | ||
220 | if(fingerprint == nick) |
- | ||
221 | $('#home-icon').addClass("text-success").removeClass("text-danger"); |
- | ||
222 | else |
- | ||
223 | $('#home-icon').addClass("text-danger").removeClass("text-success"); |
- | ||
224 | |
221 | |
|
225 | // Retrieve the contents of the shared file. |
222 | // Retrieve the contents of the shared file. |
|
226 | $.post('share-text.php', |
223 | $.post('share-text.php', |
|
227 | { |
224 | { |
|
228 | timestamp: window.performance.now(), |
225 | timestamp: window.performance.now(), |
|
Line 233... | Line 230... | |||
233 | .trumbowyg('html', data); |
230 | .trumbowyg('html', data); |
|
234 | $('#trumbowyg').trumbowyg('enable'); |
231 | $('#trumbowyg').trumbowyg('enable'); |
|
235 | $('#trumbowyg').show(); |
232 | $('#trumbowyg').show(); |
|
Line 236... | Line 233... | |||
236 | |
233 | |
|
237 | if(fingerprint == nick) |
234 | if(fingerprint == nick) |
|
238 | $('#home-icon').addClass("text-success"); |
235 | $('#home-icon').addClass("text-success").removeClass("text-danger"); |
|
239 | else |
236 | else |
|
Line 240... | Line 237... | |||
240 | $('#home-icon').addClass("text-danger"); |
237 | $('#home-icon').addClass("text-danger").removeClass("text-success"); |
|
241 | |
238 | |
|
242 | }).fail(() => { |
239 | }).fail(() => { |
|
243 | $('#trumbowyg').trumbowyg('enable'); |
240 | $('#trumbowyg').trumbowyg('enable'); |
|
Line 253... | Line 250... | |||
253 | if(!nick || nick.length != 32) |
250 | if(!nick || nick.length != 32) |
|
254 | return; |
251 | return; |
|
255 | Cookies.set('nick', nick, { path: '' }); |
252 | Cookies.set('nick', nick, { path: '' }); |
|
256 | result = nick; |
253 | result = nick; |
|
Line 257... | Line -... | |||
257 | |
- | ||
258 | if(fingerprint == nick) |
- | ||
259 | $('#home-icon').addClass("text-success"); |
- | ||
260 | else |
- | ||
261 | $('#home-icon').addClass("text-danger"); |
- | ||
262 | |
254 | |
|
263 | // Retrieve the contents of the shared file. |
255 | // Retrieve the contents of the shared file. |
|
264 | $.post('share-text.php', |
256 | $.post('share-text.php', |
|
265 | { |
257 | { |
|
266 | timestamp: window.performance.now(), |
258 | timestamp: window.performance.now(), |
|
Line 289... | Line 281... | |||
289 | if(!nick || nick.length != 32) |
281 | if(!nick || nick.length != 32) |
|
290 | return; |
282 | return; |
|
291 | Cookies.set('nick', nick, { path: '' }); |
283 | Cookies.set('nick', nick, { path: '' }); |
|
292 | result = nick; |
284 | result = nick; |
|
Line 293... | Line -... | |||
293 | |
- | ||
294 | if(fingerprint == nick) |
- | ||
295 | $('#home-icon').addClass("text-success").removeClass("text-danger"); |
- | ||
296 | else |
- | ||
297 | $('#home-icon').addClass("text-danger").removeClass("text-success"); |
- | ||
298 | |
285 | |
|
299 | // Retrieve the contents of the shared file. |
286 | // Retrieve the contents of the shared file. |
|
300 | $.post('share-text.php', |
287 | $.post('share-text.php', |
|
301 | { |
288 | { |
|
302 | timestamp: window.performance.now(), |
289 | timestamp: window.performance.now(), |
|
Line 305... | Line 292... | |||
305 | }).done((data) => {; |
292 | }).done((data) => {; |
|
306 | $('#trumbowyg') |
293 | $('#trumbowyg') |
|
307 | .trumbowyg('html', data); |
294 | .trumbowyg('html', data); |
|
308 | $('#trumbowyg').trumbowyg('enable'); |
295 | $('#trumbowyg').trumbowyg('enable'); |
|
309 | $('#trumbowyg').show(); |
296 | $('#trumbowyg').show(); |
|
- | 297 | |
||
- | 298 | if(fingerprint == nick) |
||
- | 299 | $('#home-icon').addClass("text-success").removeClass("text-danger"); |
||
- | 300 | else |
||
- | 301 | $('#home-icon').addClass("text-danger").removeClass("text-success"); |
||
310 | }).fail(() => { |
302 | }).fail(() => { |
|
311 | $('#trumbowyg').trumbowyg('enable'); |
303 | $('#trumbowyg').trumbowyg('enable'); |
|
312 | $('#trumbowyg').show(); |
304 | $('#trumbowyg').show(); |
|
313 | }); |
305 | }); |
|
314 | }); |
306 | }); |
|
Line 318... | Line 310... | |||
318 | Cookies.set('nick', fingerprint, { path: '' }); |
310 | Cookies.set('nick', fingerprint, { path: '' }); |
|
319 | $('#nick').val(fingerprint); |
311 | $('#nick').val(fingerprint); |
|
320 | result = fingerprint; |
312 | result = fingerprint; |
|
321 | nick = fingerprint; |
313 | nick = fingerprint; |
|
Line 322... | Line -... | |||
322 | |
- | ||
323 | if(fingerprint == nick) |
- | ||
324 | $('#home-icon').addClass("text-success").removeClass("text-danger"); |
- | ||
325 | else |
- | ||
326 | $('#home-icon').addClass("text-danger").removeClass("text-success"); |
- | ||
327 | |
314 | |
|
328 | // Retrieve the contents of the shared file. |
315 | // Retrieve the contents of the shared file. |
|
329 | $.post('share-text.php', |
316 | $.post('share-text.php', |
|
330 | { |
317 | { |
|
331 | timestamp: window.performance.now(), |
318 | timestamp: window.performance.now(), |
|
Line 334... | Line 321... | |||
334 | }).done((data) => {; |
321 | }).done((data) => {; |
|
335 | $('#trumbowyg') |
322 | $('#trumbowyg') |
|
336 | .trumbowyg('html', data); |
323 | .trumbowyg('html', data); |
|
337 | $('#trumbowyg').trumbowyg('enable'); |
324 | $('#trumbowyg').trumbowyg('enable'); |
|
338 | $('#trumbowyg').show(); |
325 | $('#trumbowyg').show(); |
|
- | 326 | |
||
- | 327 | if(fingerprint == nick) |
||
- | 328 | $('#home-icon').addClass("text-success").removeClass("text-danger"); |
||
- | 329 | else |
||
- | 330 | $('#home-icon').addClass("text-danger").removeClass("text-success"); |
||
339 | }).fail(() => { |
331 | }).fail(() => { |
|
340 | $('#trumbowyg').trumbowyg('enable'); |
332 | $('#trumbowyg').trumbowyg('enable'); |
|
341 | $('#trumbowyg').show(); |
333 | $('#trumbowyg').show(); |
|
342 | }); |
334 | }); |
|
343 | }); |
335 | }); |
|
344 | }); |
336 | }); |
|
345 | |
- | ||
346 | }); |
337 | }); |
|
347 | </script> |
338 | </script> |
|
348 | </body> |
339 | </body> |
|
349 | </html> |
340 | </html> |