scratch – Diff between revs 92 and 97
?pathlinks?
Rev 92 | Rev 97 | |||
---|---|---|---|---|
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>scratch</title> |
15 | <title>scratch</title> |
|
16 | |
16 | |
|
17 | <!-- Bootstrap core CSS --> |
17 | <!-- Bootstrap core CSS --> |
|
18 | <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> |
18 | <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> |
|
19 | <!-- Font Awesome --> |
19 | <!-- Font Awesome --> |
|
20 | <link href="bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet"> |
20 | <link href="bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet"> |
|
21 | <!-- DrawingBoard --> |
21 | <!-- DrawingBoard --> |
|
22 | <link href="bower_components/drawingboard.js/dist/drawingboard.min.css" rel="stylesheet"> |
22 | <link href="bower_components/drawingboard.js/dist/drawingboard.min.css" rel="stylesheet"> |
|
23 | |
23 | |
|
24 | <!-- Site-wide style CCS --> |
24 | <!-- Site-wide style CCS --> |
|
25 | <link href="css/style.css" rel="stylesheet"> |
25 | <link href="css/style.css" rel="stylesheet"> |
|
26 | |
26 | |
|
27 | <!-- Local style --> |
27 | <!-- Local style --> |
|
28 | <link href="css/draw/style.css" rel="stylesheet"> |
28 | <link href="css/draw/style.css" rel="stylesheet"> |
|
29 | </head> |
29 | </head> |
|
30 | |
30 | |
|
31 | <body> |
31 | <body> |
|
32 | |
32 | |
|
33 | <!-- Main component for a primary marketing message or call to action --> |
33 | <!-- Main component for a primary marketing message or call to action --> |
|
34 | <div class="paralax-background"></div> |
34 | <div class="paralax-background"></div> |
|
35 | <div class="jumbotron"> |
35 | <div class="jumbotron"> |
|
36 | <h1>scratch copy</h1> |
36 | <h1>scratch copy</h1> |
|
37 | <p class="quote">the asset sharer</p> |
37 | <p class="quote">the asset sharer</p> |
|
38 | </div> |
38 | </div> |
|
39 | |
39 | |
|
40 | <div class="container"> |
40 | <div class="container"> |
|
41 | |
41 | |
|
42 | <ul class="nav nav-tabs"> |
42 | <ul class="nav nav-tabs"> |
|
43 | <li><a href="index.html">Home</a></li> |
43 | <li><a href="index.html">Home</a></li> |
|
44 | <li><a href="file.html">File</a></li> |
44 | <li><a href="file.html">File</a></li> |
|
45 | <li><a href="text.html">Text</a></li> |
45 | <li><a href="text.html">Text</a></li> |
|
46 | <li class="active"><a href="#">Draw</a></li> |
46 | <li class="active"><a href="#">Draw</a></li> |
|
47 | <li><a href="link.html">Link</a></li> |
47 | <li><a href="link.html">Link</a></li> |
|
48 | </ul> |
48 | </ul> |
|
49 | |
49 | |
|
50 | <div id="main-panel" class="panel panel-default"> |
50 | <div id="main-panel" class="panel panel-default"> |
|
51 | <div class="panel-heading"> |
51 | <div class="panel-heading"> |
|
52 | <div class="form-group"> |
52 | <div class="form-group"> |
|
53 | <div class="input-group"> |
53 | <div class="input-group"> |
|
54 | <span class="input-group-btn"> |
54 | <span class="input-group-btn"> |
|
55 | <button id="save" class="btn btn-default" type="button" data-toggle="tooltip" data-placement="auto" title="Generate link."> |
55 | <button id="save" class="btn btn-default" type="button" data-toggle="tooltip" data-placement="auto" title="Generate link."> |
|
56 | <i class="glyphicon glyphicon-share"></i> |
56 | <i class="glyphicon glyphicon-share"></i> |
|
57 | </button> |
57 | </button> |
|
58 | </span> |
58 | </span> |
|
59 | <input id="URL" type="text" class="form-control" readonly> |
59 | <input id="URL" type="text" class="form-control" readonly> |
|
60 | <span class="input-group-btn"> |
60 | <span class="input-group-btn"> |
|
61 | <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> |
61 | <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> |
|
62 | </span> |
62 | </span> |
|
63 | </div> |
63 | </div> |
|
64 | <div class="input-group"> |
64 | <div class="input-group"> |
|
65 | <input id="deleteURL" type="text" class="form-control" readonly> |
65 | <input id="deleteURL" type="text" class="form-control" readonly> |
|
66 | <span class="input-group-btn"> |
66 | <span class="input-group-btn"> |
|
67 | <button id="delete-url" class="btn btn-default" type="button" data-clipboard-target="#deleteURL"><i class="glyphicon glyphicon-paperclip"></i></button> |
67 | <button id="delete-url" class="btn btn-default" type="button" data-clipboard-target="#deleteURL"><i class="glyphicon glyphicon-paperclip"></i></button> |
|
68 | </span> |
68 | </span> |
|
69 | </div> |
69 | </div> |
|
70 | </div> |
70 | </div> |
|
71 | </div> |
71 | </div> |
|
72 | <div class="panel-body" id="drawing-panel"> |
72 | <div class="panel-body" id="drawing-panel"> |
|
73 | <div id="drawingboard"> |
73 | <div id="drawingboard"> |
|
74 | </div> |
74 | </div> |
|
75 | </div> |
75 | </div> |
|
76 | </div> |
76 | </div> |
|
77 | |
77 | |
|
78 | </div> <!-- /container --> |
78 | </div> <!-- /container --> |
|
79 | |
79 | |
|
80 | <div id="footer"> |
80 | <div id="footer"> |
|
81 | <div class="container"> |
81 | <div class="container"> |
|
82 | <p class="text-muted credit text-center">Copyright <i class="glyphicon glyphicon-copyright-mark"></i> 2017 <a href="http://grimore.org">Wizardry and Steamworks</a>.</p> |
82 | <p class="text-muted credit text-center">Copyright <i class="glyphicon glyphicon-copyright-mark"></i> 2017 <a href="http://grimore.org">Wizardry and Steamworks</a>.</p> |
|
83 | </div> |
83 | </div> |
|
84 | </div> |
84 | </div> |
|
85 | |
85 | |
|
86 | <!-- jQuery --> |
86 | <!-- jQuery --> |
|
87 | <script src="bower_components/jquery/dist/jquery.min.js"></script> |
87 | <script src="bower_components/jquery/dist/jquery.min.js"></script> |
|
88 | <!-- BootStrap --> |
88 | <!-- BootStrap --> |
|
89 | <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script> |
89 | <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script> |
|
90 | |
90 | |
|
91 | <!-- DrawingBoard --> |
91 | <!-- DrawingBoard --> |
|
92 | <script src="bower_components/drawingboard.js/dist/drawingboard.min.js"></script> |
92 | <script src="bower_components/drawingboard.js/dist/drawingboard.min.js"></script> |
|
93 | <!-- Clipboard --> |
93 | <!-- Clipboard --> |
|
94 | <script src="bower_components/clipboard/dist/clipboard.min.js"></script> |
94 | <script src="bower_components/clipboard/dist/clipboard.min.js"></script> |
|
95 | |
95 | |
|
96 | <!-- Local javascript --> |
96 | <!-- Local javascript --> |
|
97 | <script src="js/Base64ToBlob.js"></script> |
97 | <script src="js/Base64ToBlob.js"></script> |
|
98 | <script> |
98 | <script> |
|
99 | $(document).ready(() => { |
99 | $(document).ready(() => { |
|
100 | // Setup the drawing board. |
100 | // Setup the drawing board. |
|
101 | var drawingBoard = new DrawingBoard.Board('drawingboard', { |
101 | var drawingBoard = new DrawingBoard.Board('drawingboard', { |
|
102 | controls: [ |
102 | controls: [ |
|
103 | 'Color', |
103 | 'Color', |
|
104 | { Size: { type: 'dropdown' } }, |
104 | { Size: { type: 'dropdown' } }, |
|
105 | { DrawingMode: { filler: false } }, |
105 | { DrawingMode: { filler: false } }, |
|
106 | 'Navigation' |
106 | 'Navigation' |
|
107 | ], |
107 | ], |
|
108 | size: 8, |
108 | size: 8, |
|
109 | color: "#ff99ff", |
109 | color: "#ff99ff", |
|
110 | webStorage: 'session', |
110 | webStorage: 'session', |
|
111 | enlargeYourContainer: true, |
111 | enlargeYourContainer: true, |
|
112 | droppable: true |
112 | droppable: true |
|
113 | }); |
113 | }); |
|
114 | |
114 | |
|
115 | // Save image and create URL. |
115 | // Save image and create URL. |
|
116 | $('#save').click(() => { |
116 | $('#save').click(() => { |
|
117 | var formData = new FormData(); |
117 | var formData = new FormData(); |
|
118 | formData.append('file', new Blob( |
118 | formData.append('file', new Blob( |
|
119 | [ |
119 | [ |
|
120 | base64toBlob( |
120 | base64toBlob( |
|
121 | drawingBoard |
121 | drawingBoard |
|
122 | .getImg() |
122 | .getImg() |
|
123 | .replace(/^data:image\/(png|jpg);base64,/, ''), |
123 | .replace(/^data:image\/(png|jpg);base64,/, ''), |
|
124 | 'image/png') |
124 | 'image/png') |
|
125 | ] |
125 | ] |
|
126 | ), |
126 | ), |
|
127 | '.png' |
127 | '.png' |
|
128 | ); |
128 | ); |
|
129 | |
- | ||
- | 129 | $.get('session.php').then((token) => { |
||
- | 130 | formData.append('token', token); |
||
130 | $.ajax({ |
131 | $.ajax({ |
|
131 | url: 'file.php', |
132 | url: 'file.php', |
|
132 | type: 'POST', |
133 | type: 'POST', |
|
133 | data: formData, |
134 | data: formData, |
|
134 | // cache: false // FF |
135 | // cache: false // FF |
|
135 | processData: false, |
136 | processData: false, |
|
136 | contentType: false |
137 | contentType: false |
|
137 | }).done((data) => { |
138 | }).done((data) => { |
|
138 | // Serialize JSON to object. |
139 | // Serialize JSON to object. |
|
139 | data = JSON.parse(data); |
140 | data = JSON.parse(data); |
|
140 | |
141 | |
|
141 | $('#URL') |
142 | $('#URL') |
|
142 | .val( |
143 | .val( |
|
143 | location.protocol |
144 | location.protocol |
|
- | 145 | .concat("//") |
||
- | 146 | .concat(window.location.hostname) |
||
- | 147 | .concat("/") |
||
- | 148 | .concat(data.hash) |
||
- | 149 | ); |
||
- | 150 | |
||
- | 151 | $('#deleteURL') |
||
- | 152 | .val( |
||
- | 153 | location |
||
144 | .concat("//") |
154 | .protocol.concat("//") |
|
145 | .concat(window.location.hostname) |
155 | .concat(window.location.hostname) |
|
- | 156 | .concat("/") |
||
- | 157 | .concat(data.timestamp) |
||
146 | .concat("/") |
158 | .concat("/") |
|
147 | .concat(data.hash) |
159 | .concat(data.hash) |
|
148 | ); |
- | ||
149 | |
- | ||
150 | $('#deleteURL') |
- | ||
151 | .val( |
- | ||
152 | location |
- | ||
153 | .protocol.concat("//") |
- | ||
154 | .concat(window.location.hostname) |
- | ||
155 | .concat("/") |
- | ||
156 | .concat(data.timestamp) |
- | ||
157 | .concat("/") |
- | ||
158 | .concat(data.hash) |
160 | ); |
|
159 | ); |
161 | }); |
|
160 | }); |
162 | }); |
|
161 | }); |
163 | }); |
|
162 | |
164 | |
|
163 | // Enable the Clipboard button. |
165 | // Enable the Clipboard button. |
|
164 | new Clipboard('#copy-url'); |
166 | new Clipboard('#copy-url'); |
|
165 | new Clipboard('#delete-url'); |
167 | new Clipboard('#delete-url'); |
|
166 | |
168 | |
|
167 | // Scroll to the panel. |
169 | // Scroll to the panel. |
|
168 | $('html, body').animate({ |
170 | $('html, body').animate({ |
|
169 | scrollTop: $('#main-panel').offset().top |
171 | scrollTop: $('#main-panel').offset().top |
|
170 | }, 'slow'); |
172 | }, 'slow'); |
|
171 | }); |
173 | }); |
|
172 | </script> |
174 | </script> |
|
173 | <!-- Jumbotron parallax effect --> |
175 | <!-- Jumbotron parallax effect --> |
|
174 | <script> |
176 | <script> |
|
175 | var jumboHeight = $('.jumbotron').outerHeight(); |
177 | var jumboHeight = $('.jumbotron').outerHeight(); |
|
176 | function parallax(){ |
178 | function parallax(){ |
|
177 | var scrolled = $(window).scrollTop(); |
179 | var scrolled = $(window).scrollTop(); |
|
178 | $('.paralax-background').css('height', (jumboHeight-scrolled) + 'px'); |
180 | $('.paralax-background').css('height', (jumboHeight-scrolled) + 'px'); |
|
179 | } |
181 | } |
|
180 | |
182 | |
|
181 | $(window).scroll(function(e){ |
183 | $(window).scroll(function(e){ |
|
182 | parallax(); |
184 | parallax(); |
|
183 | }); |
185 | }); |
|
184 | </script> |
186 | </script> |
|
185 | </body> |
187 | </body> |
|
186 | </html> |
188 | </html> |
|
187 | |
189 | |