scratch – Diff between revs 121 and 125

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