scratch – Diff between revs 37 and 38

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 37 Rev 38
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>Quickload</title> 15 <title>Quickload</title>
16 16
17 <!-- Polyfill --> 17 <!-- Polyfill -->
18 <script src="js/polyfill/polyfill.min.js"></script> 18 <script src="js/polyfill/polyfill.min.js"></script>
19   19  
20 <!-- Bootstrap core CSS --> 20 <!-- Bootstrap core CSS -->
21 <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet"> 21 <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet">
22   22  
23 <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> 23 <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
24 <link href="css/bootstrap/ie10-viewport-bug-workaround.css" rel="stylesheet"> 24 <link href="css/bootstrap/ie10-viewport-bug-workaround.css" rel="stylesheet">
25   25  
26 <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> 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]--> 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> 28 <script src="js/bootstrap/ie-emulation-modes-warning.js"></script>
29   29  
30 <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> 30 <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
31 <!--[if lt IE 9]> 31 <!--[if lt IE 9]>
32 <script src="js/bootstrap/html5shiv.min.js"></script> 32 <script src="js/bootstrap/html5shiv.min.js"></script>
33 <script src="js/bootstrap/respond.min.js"></script> 33 <script src="js/bootstrap/respond.min.js"></script>
34 <![endif]--> 34 <![endif]-->
35 35
36 <!-- Trumbowyg --> 36 <!-- Trumbowyg -->
37 <link href="css/trumbowyg/trumbowyg.min.css" rel="stylesheet"> 37 <link href="css/trumbowyg/trumbowyg.min.css" rel="stylesheet">
38 <!-- Local style --> 38 <!-- Local style -->
39 <link href="css/text/style.css" rel="stylesheet"> 39 <link href="css/text/style.css" rel="stylesheet">
40 </head> 40 </head>
41   41  
42 <body> 42 <body>
43   43  
44 <div class="container"> 44 <div class="container">
45   45  
46 <!-- Main component for a primary marketing message or call to action --> 46 <!-- Main component for a primary marketing message or call to action -->
47 <div class="jumbotron"> 47 <div class="jumbotron">
48 <h1>Quickload</h1> 48 <h1>Quickload</h1>
49 <p>Asset sharing platform.</p> 49 <p>Asset sharing platform.</p>
50 </div> 50 </div>
51 51
52 <ul class="nav nav-tabs"> 52 <ul class="nav nav-tabs">
53 <li><a href="index.html">Home</a></li> 53 <li><a href="index.html">Home</a></li>
54 <li><a href="files.html">Files</a></li> 54 <li><a href="files.html">Files</a></li>
55 <li class="active"><a href="#">Text</a></li> 55 <li class="active"><a href="#">Text</a></li>
56 </ul> 56 </ul>
57 57
58 <div class="panel panel-default"> 58 <div class="panel panel-default">
59 <div class="panel-heading"> 59 <div class="panel-heading">
60 <div class="form-group"> 60 <div class="form-group">
61 <div class="input-group"> 61 <div class="input-group">
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">
91 <div id="trumbowyg" style="display: none; font-family: monospace;"> 95 <div id="trumbowyg" style="display: none; font-family: monospace;">
92 </div> 96 </div>
93 </div> 97 </div>
94 </div> 98 </div>
95   99  
96 </div> <!-- /container --> 100 </div> <!-- /container -->
97 101
98 <div id="footer"> 102 <div id="footer">
99 <div class="container"> 103 <div class="container">
100 <p class="text-muted credit">Copyright <i class="glyphicon glyphicon-copyright-mark"></i> 2017 <a href="http://grimore.org">Wizardry and Steamworks</a>.</p> 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>
101 </div> 105 </div>
102 </div> 106 </div>
103   107  
104 <script src="js/jquery/jquery.min.js"></script> 108 <script src="js/jquery/jquery.min.js"></script>
105 <script src="js/bootstrap/bootstrap.min.js"></script> 109 <script src="js/bootstrap/bootstrap.min.js"></script>
106 <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> 110 <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
107 <script src="js/bootstrap/ie10-viewport-bug-workaround.js"></script> 111 <script src="js/bootstrap/ie10-viewport-bug-workaround.js"></script>
108 112
109 <!-- Trumbowyg --> 113 <!-- Trumbowyg -->
110 <script src="js/trumbowyg/trumbowyg.min.js"></script> 114 <script src="js/trumbowyg/trumbowyg.min.js"></script>
111 <!-- Clipboard --> 115 <!-- Clipboard -->
112 <script src="js/clipboard/clipboard.min.js"></script> 116 <script src="js/clipboard/clipboard.min.js"></script>
113 <!-- Fingerprint 2 --> 117 <!-- Fingerprint 2 -->
114 <script src="js/fingerprintjs/fingerprint2.min.js"></script> 118 <script src="js/fingerprintjs/fingerprint2.min.js"></script>
115 <!-- js-cookie --> 119 <!-- js-cookie -->
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;
129 139
130 // Set the nick. 140 // Set the nick.
131 $('#nick').val(result); 141 $('#nick').val(result);
132 new Clipboard('#copy-nick'); 142 new Clipboard('#copy-nick');
133 143
134 // Load the editor. 144 // Load the editor.
135 $('#trumbowyg').trumbowyg({ 145 $('#trumbowyg').trumbowyg({
136 autogrow: true, 146 autogrow: true,
137 disabled: true 147 disabled: true
138 }).on('tbwchange', () => { 148 }).on('tbwchange', () => {
139 $('#editor').trumbowyg('disable'); 149 $('#editor').trumbowyg('disable');
140 $.post('share-text.php', { 150 $.post('share-text.php', {
141 data: $('#trumbowyg').trumbowyg('html'), 151 data: $('#trumbowyg').trumbowyg('html'),
142 fingerprint: result, 152 fingerprint: result,
143 action: 'SAVE' 153 action: 'SAVE'
144 }).done((data) => { 154 }).done((data) => {
145 $('#trumbowyg').trumbowyg('enable'); 155 $('#trumbowyg').trumbowyg('enable');
146 }).fail(() => { 156 }).fail(() => {
147 $('#trumbowyg').trumbowyg('enable'); 157 $('#trumbowyg').trumbowyg('enable');
148 }); 158 });
149 }); 159 });
150 160
151 // Retrieve the contents of the shared file. 161 // Retrieve the contents of the shared file.
152 $.post('share-text.php', 162 $.post('share-text.php',
153 { 163 {
154 timestamp: window.performance.now(), 164 timestamp: window.performance.now(),
155 fingerprint: result, 165 fingerprint: result,
156 action: 'LOAD' 166 action: 'LOAD'
157 }).done((data) => {; 167 }).done((data) => {;
158 $('#trumbowyg') 168 $('#trumbowyg')
159 .trumbowyg('html', data); 169 .trumbowyg('html', data);
160 $('#trumbowyg').trumbowyg('enable'); 170 $('#trumbowyg').trumbowyg('enable');
161 $('#trumbowyg').show(); 171 $('#trumbowyg').show();
162 }).fail(() => { 172 }).fail(() => {
163 $('#trumbowyg').trumbowyg('enable'); 173 $('#trumbowyg').trumbowyg('enable');
164 $('#trumbowyg').show(); 174 $('#trumbowyg').show();
165 }); 175 });
166 176
167 // Enable the Clipboard button. 177 // Enable the Clipboard button.
168 new Clipboard('#copy-url'); 178 new Clipboard('#copy-url');
169 179
170 $('#save').click(() => { 180 $('#save').click(() => {
171 $('#editor').trumbowyg('disable'); 181 $('#editor').trumbowyg('disable');
172 182
173 var formData = new FormData(); 183 var formData = new FormData();
174 formData.append('file', new Blob( 184 formData.append('file', new Blob(
175 [ 185 [
176 $('#trumbowyg').trumbowyg('html') 186 $('#trumbowyg').trumbowyg('html')
177 ] 187 ]
178 ), 188 ),
179 '.html' 189 '.html'
180 ); 190 );
181 191
182 $.ajax({ 192 $.ajax({
183 url: 'upload-files.php', 193 url: 'upload-files.php',
184 type: 'POST', 194 type: 'POST',
185 data: formData, 195 data: formData,
186 // cache: false // FF 196 // cache: false // FF
187 processData: false, 197 processData: false,
188 contentType: false 198 contentType: false
189 }).done((data) => { 199 }).done((data) => {
190 $('#URL').val(data); 200 $('#URL').val(data);
191 $('#trumbowyg').trumbowyg('enable'); 201 $('#trumbowyg').trumbowyg('enable');
192 }).fail(() => { 202 }).fail(() => {
193 alert('failed'); 203 alert('failed');
194 $('#trumbowyg').trumbowyg('enable'); 204 $('#trumbowyg').trumbowyg('enable');
195 }); 205 });
196 }); 206 });
197 207
198 // When the user wants to assume a nickname. 208 // When the user wants to assume a nickname.
199 $('#go').click(() => { 209 $('#go').click(() => {
200 nick = $('#nick').val(); 210 nick = $('#nick').val();
201 if(!nick || nick.length != 32) 211 if(!nick || nick.length != 32)
202 return; 212 return;
203 Cookies.set('nick', nick, { path: '' }); 213 Cookies.set('nick', nick, { path: '' });
204 214
205 // Retrieve the contents of the shared file. 215 // Retrieve the contents of the shared file.
206 $.post('share-text.php', 216 $.post('share-text.php',
207 { 217 {
208 timestamp: window.performance.now(), 218 timestamp: window.performance.now(),
209 fingerprint: nick, 219 fingerprint: nick,
210 action: 'LOAD' 220 action: 'LOAD'
-   221 }).done((data) => {;
-   222 $('#trumbowyg')
-   223 .trumbowyg('html', data);
-   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'
211 }).done((data) => {; 268 }).done((data) => {;
212 $('#trumbowyg') 269 $('#trumbowyg')
213 .trumbowyg('html', data); 270 .trumbowyg('html', data);
214 $('#trumbowyg').trumbowyg('enable'); 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 });
220 }); 277 });
221 }); 278 });
222 279
223 }); 280 });
224 </script> 281 </script>
225 </body> 282 </body>
226 </html> 283 </html>
227   284