scratch – Blame information for rev 51

Subversion Repositories:
Rev:
Rev Author Line No. Line
25 office 1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
35 office 6 <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
7 <meta http-equiv="Pragma" content="no-cache" />
8 <meta http-equiv="Expires" content="0" />
25 office 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 -->
11 <meta name="description" content="quick asset upload">
12 <meta name="author" content="Wizardry and Steamworks">
13 <link rel="icon" href="favicon.ico">
14  
15 <title>Quickload</title>
31 office 16  
17 <!-- Polyfill -->
32 office 18 <script src="js/polyfill/polyfill.min.js"></script>
25 office 19  
20 <!-- Bootstrap core CSS -->
21 <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet">
22  
23 <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
24 <link href="css/bootstrap/ie10-viewport-bug-workaround.css" rel="stylesheet">
25  
26 <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
27 <!--[if lt IE 9]><script src="js/bootstrap/ie8-responsive-file-warning.js"></script><![endif]-->
28 <script src="js/bootstrap/ie-emulation-modes-warning.js"></script>
29  
30 <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
31 <!--[if lt IE 9]>
32 <script src="js/bootstrap/html5shiv.min.js"></script>
33 <script src="js/bootstrap/respond.min.js"></script>
34 <![endif]-->
35  
36 <!-- Trumbowyg -->
37 <link href="css/trumbowyg/trumbowyg.min.css" rel="stylesheet">
38 <!-- Local style -->
32 office 39 <link href="css/text/style.css" rel="stylesheet">
25 office 40 </head>
41  
42 <body>
43  
44 <div class="container">
45  
46 <!-- Main component for a primary marketing message or call to action -->
47 <div class="jumbotron">
48 <h1>Quickload</h1>
49 <p>Asset sharing platform.</p>
50 </div>
51  
52 <ul class="nav nav-tabs">
53 <li><a href="index.html">Home</a></li>
54 <li><a href="files.html">Files</a></li>
55 <li class="active"><a href="#">Text</a></li>
56 </ul>
57  
31 office 58 <div class="panel panel-default">
59 <div class="panel-heading">
37 office 60 <div class="form-group">
31 office 61 <div class="input-group">
62 <span class="input-group-btn">
39 office 63 <button id="save" class="btn btn-default" type="button" data-toggle="tooltip" data-placement="auto" title="Generate link.">
41 office 64 <i class="glyphicon glyphicon-share"></i>
31 office 65 </button>
66 </span>
38 office 67 <input id="URL" type="text" class="form-control" readonly>
32 office 68 <span class="input-group-btn">
39 office 69 <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>
32 office 70 </span>
31 office 71 </div>
72 </div>
38 office 73 <form id="nick-form" role="form">
37 office 74 <div class="form-group has-feedback">
75 <div class="input-group">
76 <span class="input-group-btn">
39 office 77 <button id="go" class="btn btn-default" type="button" data-toggle="tooltip" data-placement="auto" title="Load document.">
37 office 78 <i class="glyphicon glyphicon-play"></i>
79 </button>
80 </span>
81 <span class="input-group-btn">
39 office 82 <button id="reset" class="btn btn-default" type="button" data-toggle="tooltip" data-placement="auto" title="Reset document.">
42 office 83 <i id="home-icon" class="glyphicon glyphicon-home"></i>
38 office 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">
39 office 88 <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>
37 office 89 </span>
90 </div>
91 </div>
92 </form>
93 </div>
32 office 94 <div class="panel-body" id="editorpanel">
95 <div id="trumbowyg" style="display: none; font-family: monospace;">
31 office 96 </div>
97 </div>
25 office 98 </div>
99  
100 </div> <!-- /container -->
101  
102 <div id="footer">
103 <div class="container">
104 <p class="text-muted credit">Copyright <i class="glyphicon glyphicon-copyright-mark"></i> 2017 <a href="http://grimore.org">Wizardry and Steamworks</a>.</p>
105 </div>
106 </div>
107  
108 <script src="js/jquery/jquery.min.js"></script>
109 <script src="js/bootstrap/bootstrap.min.js"></script>
110 <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
111 <script src="js/bootstrap/ie10-viewport-bug-workaround.js"></script>
112  
113 <!-- Trumbowyg -->
114 <script src="js/trumbowyg/trumbowyg.min.js"></script>
32 office 115 <!-- Clipboard -->
116 <script src="js/clipboard/clipboard.min.js"></script>
37 office 117 <!-- Fingerprint 2 -->
118 <script src="js/fingerprintjs/fingerprint2.min.js"></script>
119 <!-- js-cookie -->
120 <script src="js/jscookie/js.cookie.js"></script>
121 <!-- Bootstrap Validator -->
122 <script src="js/validator/validator.min.js"></script>
25 office 123 <script>
124 $(document).ready(() => {
38 office 125 // Attach the form validator.
126 $('#nick-form').validator({
127 focus: false
128 });
129  
43 office 130 // Enable the Clipboard button.
131 new Clipboard('#copy-url');
132  
37 office 133 // Get the fingerprint.
134 new Fingerprint2().get((result, components) => {
135 // Set the nick as a cookie.
38 office 136 const fingerprint = result;
37 office 137 var nick = Cookies.get('nick');
43 office 138 if(!nick || nick.length !== 32) {
37 office 139 Cookies.set('nick', result, { path: '' });
43 office 140 nick = result;
141 }
37 office 142 else
143 result = nick;
144  
145 // Set the nick.
146 $('#nick').val(result);
147 new Clipboard('#copy-nick');
148  
42 office 149 if(fingerprint == nick)
150 $('#home-icon').addClass("text-success");
151 else
152 $('#home-icon').addClass("text-danger");
153  
37 office 154 // Load the editor.
155 $('#trumbowyg').trumbowyg({
156 autogrow: true,
157 disabled: true
158 }).on('tbwchange', () => {
159 $('#editor').trumbowyg('disable');
49 office 160 $.post('text.php', {
37 office 161 data: $('#trumbowyg').trumbowyg('html'),
162 fingerprint: result,
51 office 163 action: 'SAVE',
164 timeout: 0
37 office 165 }).done((data) => {
166 $('#trumbowyg').trumbowyg('enable');
167 }).fail(() => {
168 $('#trumbowyg').trumbowyg('enable');
169 });
170 });
171  
172 // Retrieve the contents of the shared file.
49 office 173 $.post('text.php',
37 office 174 {
175 timestamp: window.performance.now(),
176 fingerprint: result,
177 action: 'LOAD'
178 }).done((data) => {;
179 $('#trumbowyg')
180 .trumbowyg('html', data);
29 office 181 $('#trumbowyg').trumbowyg('enable');
37 office 182 $('#trumbowyg').show();
29 office 183 }).fail(() => {
184 $('#trumbowyg').trumbowyg('enable');
37 office 185 $('#trumbowyg').show();
25 office 186 });
31 office 187  
37 office 188 $('#save').click(() => {
189 $('#editor').trumbowyg('disable');
31 office 190  
37 office 191 var formData = new FormData();
192 formData.append('file', new Blob(
193 [
194 $('#trumbowyg').trumbowyg('html')
195 ]
196 ),
197 '.html'
198 );
31 office 199  
37 office 200 $.ajax({
49 office 201 url: 'file.php',
37 office 202 type: 'POST',
203 data: formData,
204 // cache: false // FF
205 processData: false,
206 contentType: false
207 }).done((data) => {
208 $('#URL').val(data);
209 $('#trumbowyg').trumbowyg('enable');
210 }).fail(() => {
211 $('#trumbowyg').trumbowyg('enable');
212 });
31 office 213 });
37 office 214  
41 office 215 // When the button is clicked, navigate to the fingerprint.
37 office 216 $('#go').click(() => {
217 nick = $('#nick').val();
218 if(!nick || nick.length != 32)
219 return;
220 Cookies.set('nick', nick, { path: '' });
40 office 221 result = nick;
37 office 222  
223 // Retrieve the contents of the shared file.
49 office 224 $.post('text.php',
37 office 225 {
226 timestamp: window.performance.now(),
227 fingerprint: nick,
228 action: 'LOAD'
229 }).done((data) => {;
230 $('#trumbowyg')
231 .trumbowyg('html', data);
232 $('#trumbowyg').trumbowyg('enable');
233 $('#trumbowyg').show();
42 office 234  
235 if(fingerprint == nick)
43 office 236 $('#home-icon').addClass("text-success").removeClass("text-danger");
42 office 237 else
43 office 238 $('#home-icon').addClass("text-danger").removeClass("text-success");
42 office 239  
37 office 240 }).fail(() => {
241 $('#trumbowyg').trumbowyg('enable');
242 $('#trumbowyg').show();
243 });
244 });
38 office 245  
41 office 246 // When the form is submitted, naigate to the fingerprint.
38 office 247 $('#nick-form').submit((e) => {
248 e.preventDefault();
249  
250 nick = $('#nick').val();
251 if(!nick || nick.length != 32)
252 return;
253 Cookies.set('nick', nick, { path: '' });
40 office 254 result = nick;
38 office 255  
256 // Retrieve the contents of the shared file.
49 office 257 $.post('text.php',
38 office 258 {
259 timestamp: window.performance.now(),
260 fingerprint: nick,
261 action: 'LOAD'
262 }).done((data) => {;
263 $('#trumbowyg')
264 .trumbowyg('html', data);
265 $('#trumbowyg').trumbowyg('enable');
266 $('#trumbowyg').show();
42 office 267  
268 if(fingerprint == nick)
269 $('#home-icon').addClass("text-success").removeClass("text-danger");
270 else
271 $('#home-icon').addClass("text-danger").removeClass("text-success");
272  
38 office 273 }).fail(() => {
274 $('#trumbowyg').trumbowyg('enable');
275 $('#trumbowyg').show();
276 });
277 });
278  
41 office 279 // While the nick is changing, navigate to the changed fingerprint.
280 $("#nick").on('input', () => {
281 nick = $('#nick').val();
282 if(!nick || nick.length != 32)
283 return;
284 Cookies.set('nick', nick, { path: '' });
285 result = nick;
286  
287 // Retrieve the contents of the shared file.
49 office 288 $.post('text.php',
41 office 289 {
290 timestamp: window.performance.now(),
291 fingerprint: nick,
292 action: 'LOAD'
293 }).done((data) => {;
294 $('#trumbowyg')
295 .trumbowyg('html', data);
296 $('#trumbowyg').trumbowyg('enable');
297 $('#trumbowyg').show();
43 office 298  
299 if(fingerprint == nick)
300 $('#home-icon').addClass("text-success").removeClass("text-danger");
301 else
302 $('#home-icon').addClass("text-danger").removeClass("text-success");
41 office 303 }).fail(() => {
304 $('#trumbowyg').trumbowyg('enable');
305 $('#trumbowyg').show();
306 });
307 });
308  
309 // When the reset button is pressed, navigate to the fingerprint.
38 office 310 $('#reset').click(() => {
311 Cookies.set('nick', fingerprint, { path: '' });
312 $('#nick').val(fingerprint);
40 office 313 result = fingerprint;
42 office 314 nick = fingerprint;
38 office 315  
316 // Retrieve the contents of the shared file.
49 office 317 $.post('text.php',
38 office 318 {
319 timestamp: window.performance.now(),
320 fingerprint: fingerprint,
321 action: 'LOAD'
322 }).done((data) => {;
323 $('#trumbowyg')
324 .trumbowyg('html', data);
325 $('#trumbowyg').trumbowyg('enable');
326 $('#trumbowyg').show();
43 office 327  
328 if(fingerprint == nick)
329 $('#home-icon').addClass("text-success").removeClass("text-danger");
330 else
331 $('#home-icon').addClass("text-danger").removeClass("text-success");
38 office 332 }).fail(() => {
333 $('#trumbowyg').trumbowyg('enable');
334 $('#trumbowyg').show();
335 });
336 });
31 office 337 });
25 office 338 });
339 </script>
340 </body>
341 </html>