scratch – Blame information for rev 40

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.">
31 office 64 <i class="glyphicon glyphicon-globe"></i>
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.">
83 <i class="glyphicon glyphicon-erase"></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  
37 office 130 // Get the fingerprint.
131 new Fingerprint2().get((result, components) => {
132 // Set the nick as a cookie.
38 office 133 const fingerprint = result;
37 office 134 var nick = Cookies.get('nick');
135 if(!nick || nick.length !== 32)
136 Cookies.set('nick', result, { path: '' });
137 else
138 result = nick;
139  
140 // Set the nick.
141 $('#nick').val(result);
142 new Clipboard('#copy-nick');
143  
144 // Load the editor.
145 $('#trumbowyg').trumbowyg({
146 autogrow: true,
147 disabled: true
148 }).on('tbwchange', () => {
149 $('#editor').trumbowyg('disable');
150 $.post('share-text.php', {
151 data: $('#trumbowyg').trumbowyg('html'),
152 fingerprint: result,
153 action: 'SAVE'
154 }).done((data) => {
155 $('#trumbowyg').trumbowyg('enable');
156 }).fail(() => {
157 $('#trumbowyg').trumbowyg('enable');
158 });
159 });
160  
161 // Retrieve the contents of the shared file.
162 $.post('share-text.php',
163 {
164 timestamp: window.performance.now(),
165 fingerprint: result,
166 action: 'LOAD'
167 }).done((data) => {;
168 $('#trumbowyg')
169 .trumbowyg('html', data);
29 office 170 $('#trumbowyg').trumbowyg('enable');
37 office 171 $('#trumbowyg').show();
29 office 172 }).fail(() => {
173 $('#trumbowyg').trumbowyg('enable');
37 office 174 $('#trumbowyg').show();
25 office 175 });
31 office 176  
37 office 177 // Enable the Clipboard button.
178 new Clipboard('#copy-url');
31 office 179  
37 office 180 $('#save').click(() => {
181 $('#editor').trumbowyg('disable');
31 office 182  
37 office 183 var formData = new FormData();
184 formData.append('file', new Blob(
185 [
186 $('#trumbowyg').trumbowyg('html')
187 ]
188 ),
189 '.html'
190 );
31 office 191  
37 office 192 $.ajax({
193 url: 'upload-files.php',
194 type: 'POST',
195 data: formData,
196 // cache: false // FF
197 processData: false,
198 contentType: false
199 }).done((data) => {
200 $('#URL').val(data);
201 $('#trumbowyg').trumbowyg('enable');
202 }).fail(() => {
203 alert('failed');
204 $('#trumbowyg').trumbowyg('enable');
205 });
31 office 206 });
37 office 207  
208 // When the user wants to assume a nickname.
209 $('#go').click(() => {
210 nick = $('#nick').val();
211 if(!nick || nick.length != 32)
212 return;
213 Cookies.set('nick', nick, { path: '' });
40 office 214 result = nick;
37 office 215  
216 // Retrieve the contents of the shared file.
217 $.post('share-text.php',
218 {
219 timestamp: window.performance.now(),
220 fingerprint: nick,
221 action: 'LOAD'
222 }).done((data) => {;
223 $('#trumbowyg')
224 .trumbowyg('html', data);
225 $('#trumbowyg').trumbowyg('enable');
226 $('#trumbowyg').show();
227 }).fail(() => {
228 $('#trumbowyg').trumbowyg('enable');
229 $('#trumbowyg').show();
230 });
231 });
38 office 232  
233 $('#nick-form').submit((e) => {
234 e.preventDefault();
235  
236 nick = $('#nick').val();
237 if(!nick || nick.length != 32)
238 return;
239 Cookies.set('nick', nick, { path: '' });
40 office 240 result = nick;
38 office 241  
242 // Retrieve the contents of the shared file.
243 $.post('share-text.php',
244 {
245 timestamp: window.performance.now(),
246 fingerprint: nick,
247 action: 'LOAD'
248 }).done((data) => {;
249 $('#trumbowyg')
250 .trumbowyg('html', data);
251 $('#trumbowyg').trumbowyg('enable');
252 $('#trumbowyg').show();
253 }).fail(() => {
254 $('#trumbowyg').trumbowyg('enable');
255 $('#trumbowyg').show();
256 });
257 });
258  
259 $('#reset').click(() => {
260 Cookies.set('nick', fingerprint, { path: '' });
261 $('#nick').val(fingerprint);
40 office 262 result = fingerprint;
38 office 263  
264 // Retrieve the contents of the shared file.
265 $.post('share-text.php',
266 {
267 timestamp: window.performance.now(),
268 fingerprint: fingerprint,
269 action: 'LOAD'
270 }).done((data) => {;
271 $('#trumbowyg')
272 .trumbowyg('html', data);
273 $('#trumbowyg').trumbowyg('enable');
274 $('#trumbowyg').show();
275 }).fail(() => {
276 $('#trumbowyg').trumbowyg('enable');
277 $('#trumbowyg').show();
278 });
279 });
31 office 280 });
32 office 281  
25 office 282 });
283 </script>
284 </body>
285 </html>