scratch – Diff between revs 37 and 38
?pathlinks?
Rev 37 | Rev 38 | |||
---|---|---|---|---|
Line 62... | Line 62... | |||
62 | <span class="input-group-btn"> |
62 | <span class="input-group-btn"> |
|
63 | <button id="save" class="btn btn-default" type="button"> |
63 | <button id="save" class="btn btn-default" type="button"> |
|
64 | <i class="glyphicon glyphicon-globe"></i> |
64 | <i class="glyphicon glyphicon-globe"></i> |
|
65 | </button> |
65 | </button> |
|
66 | </span> |
66 | </span> |
|
- | 67 | <input id="URL" type="text" class="form-control" readonly> |
||
67 | <span class="input-group-btn"> |
68 | <span class="input-group-btn"> |
|
68 | <button id="copy-url" class="btn btn-default" type="button" data-clipboard-target="#URL"><img class="clippy" src="img/clipboard/clippy.svg" width="13" alt="Copy to Clipboard"></button> |
69 | <button id="copy-url" class="btn btn-default" type="button" data-clipboard-target="#URL"><img class="clippy" src="img/clipboard/clippy.svg" width="13" alt="Copy to Clipboard"></button> |
|
69 | </span> |
70 | </span> |
|
70 | <input id="URL" type="text" class="form-control" readonly> |
- | ||
71 | |
- | ||
72 | </div> |
71 | </div> |
|
73 | </div> |
72 | </div> |
|
74 | <form id="nick-form" data-toggle="validator" role="form"> |
73 | <form id="nick-form" role="form"> |
|
75 | <div class="form-group has-feedback"> |
74 | <div class="form-group has-feedback"> |
|
76 | <div class="input-group"> |
75 | <div class="input-group"> |
|
77 | <span class="input-group-btn"> |
76 | <span class="input-group-btn"> |
|
78 | <button id="go" class="btn btn-default" type="button"> |
77 | <button id="go" class="btn btn-default" type="button"> |
|
79 | <i class="glyphicon glyphicon-play"></i> |
78 | <i class="glyphicon glyphicon-play"></i> |
|
80 | </button> |
79 | </button> |
|
81 | </span> |
80 | </span> |
|
82 | <span class="input-group-btn"> |
81 | <span class="input-group-btn"> |
|
- | 82 | <button id="reset" class="btn btn-default" type="button"> |
||
- | 83 | <i class="glyphicon glyphicon-retweet"></i> |
||
- | 84 | </button> |
||
- | 85 | </span> |
||
- | 86 | <input id="nick" type="text" class="form-control" pattern="^[A-Za-z0-9]{32}$" maxlength="32"> |
||
- | 87 | <span class="input-group-btn"> |
||
83 | <button id="copy-nick" class="btn btn-default" type="button" data-clipboard-target="#nick"><img class="clippy" src="img/clipboard/clippy.svg" width="13" alt="Copy to Clipboard"></button> |
88 | <button id="copy-nick" class="btn btn-default" type="button" data-clipboard-target="#nick"><img class="clippy" src="img/clipboard/clippy.svg" width="13" alt="Copy to Clipboard"></button> |
|
84 | </span> |
89 | </span> |
|
85 | <input id="nick" type="text" class="form-control" pattern="^[A-Za-z0-9]{32}$" maxlength="32" minlength="32" data-error="The fingerprint is malformed." required> |
- | ||
86 | </div> |
90 | </div> |
|
87 | </div> |
91 | </div> |
|
88 | </form> |
92 | </form> |
|
89 | </div> |
93 | </div> |
|
90 | <div class="panel-body" id="editorpanel"> |
94 | <div class="panel-body" id="editorpanel"> |
|
Line 116... | Line 120... | |||
116 | <script src="js/jscookie/js.cookie.js"></script> |
120 | <script src="js/jscookie/js.cookie.js"></script> |
|
117 | <!-- Bootstrap Validator --> |
121 | <!-- Bootstrap Validator --> |
|
118 | <script src="js/validator/validator.min.js"></script> |
122 | <script src="js/validator/validator.min.js"></script> |
|
119 | <script> |
123 | <script> |
|
120 | $(document).ready(() => { |
124 | $(document).ready(() => { |
|
- | 125 | // Attach the form validator. |
||
- | 126 | $('#nick-form').validator({ |
||
- | 127 | focus: false |
||
- | 128 | }); |
||
- | 129 | |
||
121 | // Get the fingerprint. |
130 | // Get the fingerprint. |
|
122 | new Fingerprint2().get((result, components) => { |
131 | new Fingerprint2().get((result, components) => { |
|
123 | // Set the nick as a cookie. |
132 | // Set the nick as a cookie. |
|
- | 133 | const fingerprint = result; |
||
124 | var nick = Cookies.get('nick'); |
134 | var nick = Cookies.get('nick'); |
|
125 | if(!nick || nick.length !== 32) |
135 | if(!nick || nick.length !== 32) |
|
126 | Cookies.set('nick', result, { path: '' }); |
136 | Cookies.set('nick', result, { path: '' }); |
|
127 | else |
137 | else |
|
128 | result = nick; |
138 | result = nick; |
|
Line 210... | Line 220... | |||
210 | action: 'LOAD' |
220 | action: 'LOAD' |
|
211 | }).done((data) => {; |
221 | }).done((data) => {; |
|
212 | $('#trumbowyg') |
222 | $('#trumbowyg') |
|
213 | .trumbowyg('html', data); |
223 | .trumbowyg('html', data); |
|
214 | $('#trumbowyg').trumbowyg('enable'); |
224 | $('#trumbowyg').trumbowyg('enable'); |
|
- | 225 | $('#trumbowyg').show(); |
||
- | 226 | }).fail(() => { |
||
- | 227 | $('#trumbowyg').trumbowyg('enable'); |
||
- | 228 | $('#trumbowyg').show(); |
||
- | 229 | }); |
||
- | 230 | }); |
||
- | 231 | |
||
- | 232 | $('#nick-form').submit((e) => { |
||
- | 233 | e.preventDefault(); |
||
- | 234 | |
||
- | 235 | nick = $('#nick').val(); |
||
- | 236 | if(!nick || nick.length != 32) |
||
- | 237 | return; |
||
- | 238 | Cookies.set('nick', nick, { path: '' }); |
||
- | 239 | |
||
- | 240 | // Retrieve the contents of the shared file. |
||
- | 241 | $.post('share-text.php', |
||
- | 242 | { |
||
- | 243 | timestamp: window.performance.now(), |
||
- | 244 | fingerprint: nick, |
||
- | 245 | action: 'LOAD' |
||
- | 246 | }).done((data) => {; |
||
- | 247 | $('#trumbowyg') |
||
- | 248 | .trumbowyg('html', data); |
||
- | 249 | $('#trumbowyg').trumbowyg('enable'); |
||
- | 250 | $('#trumbowyg').show(); |
||
- | 251 | }).fail(() => { |
||
- | 252 | $('#trumbowyg').trumbowyg('enable'); |
||
- | 253 | $('#trumbowyg').show(); |
||
- | 254 | }); |
||
- | 255 | }); |
||
- | 256 | |
||
- | 257 | $('#reset').click(() => { |
||
- | 258 | Cookies.set('nick', fingerprint, { path: '' }); |
||
- | 259 | $('#nick').val(fingerprint); |
||
- | 260 | result = nick; |
||
- | 261 | |
||
- | 262 | // Retrieve the contents of the shared file. |
||
- | 263 | $.post('share-text.php', |
||
- | 264 | { |
||
- | 265 | timestamp: window.performance.now(), |
||
- | 266 | fingerprint: fingerprint, |
||
- | 267 | action: 'LOAD' |
||
- | 268 | }).done((data) => {; |
||
- | 269 | $('#trumbowyg') |
||
- | 270 | .trumbowyg('html', data); |
||
- | 271 | $('#trumbowyg').trumbowyg('enable'); |
||
215 | $('#trumbowyg').show(); |
272 | $('#trumbowyg').show(); |
|
216 | }).fail(() => { |
273 | }).fail(() => { |
|
217 | $('#trumbowyg').trumbowyg('enable'); |
274 | $('#trumbowyg').trumbowyg('enable'); |
|
218 | $('#trumbowyg').show(); |
275 | $('#trumbowyg').show(); |
|
219 | }); |
276 | }); |