scratch – Diff between revs 122 and 125

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 122 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 <!-- blueimp gallery --> 21 <!-- blueimp gallery -->
22 <link rel="stylesheet" href="bower_components/blueimp-gallery/css/blueimp-gallery.min.css"> 22 <link rel="stylesheet" href="bower_components/blueimp-gallery/css/blueimp-gallery.min.css">
23 <!-- Swiper --> 23 <!-- Swiper -->
24 <link rel="stylesheet" href="bower_components/swiper/dist/css/swiper.min.css"> 24 <link rel="stylesheet" href="bower_components/swiper/dist/css/swiper.min.css">
25   25  
26 <!-- Site-wide style CCS --> 26 <!-- Site-wide style CCS -->
27 <link href="css/style.css" rel="stylesheet"> 27 <link href="css/style.css" rel="stylesheet">
28 28
29 <!-- Local style --> 29 <!-- Local style -->
30 <link href="css/gallery/style.css" rel="stylesheet"> 30 <link href="css/gallery/style.css" rel="stylesheet">
-   31
-   32 <!-- Scratch Angular Includes -->
-   33 <ng-include src="'html/scratch-head-last.html'"></ng-include>
31 </head> 34 </head>
32   35  
33 <body> 36 <body>
-   37
-   38 <!-- Scratch Angular Includes -->
-   39 <ng-include src="'html/scratch-body-first.html'"></ng-include>
34   40  
35 <!-- Main component for a primary marketing message or call to action --> 41 <!-- Main component for a primary marketing message or call to action -->
36 <div class="paralax-background"></div> 42 <div class="paralax-background"></div>
37 <div class="jumbotron"> 43 <div class="jumbotron">
38 <h1>scratch copy</h1> 44 <h1>scratch copy</h1>
39 <p class="quote">the asset sharer</p> 45 <p class="quote">the asset sharer</p>
40 </div> 46 </div>
41   47  
42 <div class="container"> 48 <div class="container">
43 49
44 <ul class="nav nav-tabs"> 50 <ul class="nav nav-tabs">
45 <li><a href="index.html">Home</a></li> 51 <li><a href="index.html">Home</a></li>
46 <li><a href="file.html">File</a></li> 52 <li><a href="file.html">File</a></li>
47 <li><a href="text.html">Text</a></li> 53 <li><a href="text.html">Text</a></li>
48 <li><a href="draw.html">Draw</a></li> 54 <li><a href="draw.html">Draw</a></li>
49 <li><a href="link.html">Link</a></li> 55 <li><a href="link.html">Link</a></li>
50 <li class="active"><a href="#">View</a></li> 56 <li class="active"><a href="#">View</a></li>
51 </ul> 57 </ul>
52 58
53 <div id="main-panel" class="panel panel-default"> 59 <div id="main-panel" class="panel panel-default">
54 <div class="panel-body"> 60 <div class="panel-body">
55 <div class="input-group"> 61 <div class="input-group">
56 <input id="URL" type="text" class="form-control" readonly> 62 <input id="URL" type="text" class="form-control" readonly>
57 <span class="input-group-btn"> 63 <span class="input-group-btn">
58 <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> 64 <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>
59 </span> 65 </span>
60 <span class="input-group-btn"> 66 <span class="input-group-btn">
61 <button id="btn-facebook" class="btn btn-default" type="button" disabled><i class="fa fa-facebook"></i></button> 67 <button id="btn-facebook" class="btn btn-default" type="button" disabled><i class="fa fa-facebook"></i></button>
62 </span> 68 </span>
63 </div> 69 </div>
64 70
65 <!-- The Gallery as inline carousel, can be positioned anywhere on the page --> 71 <!-- The Gallery as inline carousel, can be positioned anywhere on the page -->
66 <div id="blueimp-gallery-carousel" class="blueimp-gallery blueimp-gallery-carousel"> 72 <div id="blueimp-gallery-carousel" class="blueimp-gallery blueimp-gallery-carousel">
67 <div class="slides"></div> 73 <div class="slides"></div>
68 <h3 class="title"></h3> 74 <h3 class="title"></h3>
69 <a class="prev">‹</a> 75 <a class="prev">‹</a>
70 <a class="next">›</a> 76 <a class="next">›</a>
71 <a class="play-pause"></a> 77 <a class="play-pause"></a>
72 <!-- <ol class="indicator"></ol> --> 78 <!-- <ol class="indicator"></ol> -->
73 </div> 79 </div>
74 80
75 <div class="swiper-container"> 81 <div class="swiper-container">
76 <div id="links" class="swiper-wrapper"> 82 <div id="links" class="swiper-wrapper">
77 </div> 83 </div>
78 <!-- If we need navigation buttons --> 84 <!-- If we need navigation buttons -->
79 <div class="swiper-button-prev"></div> 85 <div class="swiper-button-prev"></div>
80 <div class="swiper-button-next"></div> 86 <div class="swiper-button-next"></div>
81 </div> 87 </div>
82 </div> 88 </div>
83 </div> 89 </div>
84 90
85 </div> <!-- /container --> 91 </div> <!-- /container -->
86 92
87 <div id="footer"> 93 <div id="footer">
88 <div class="container"> 94 <div class="container">
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> 95 <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>
90 </div> 96 </div>
91 </div> 97 </div>
92   98  
93 <!-- jQuery --> 99 <!-- jQuery -->
94 <script src="bower_components/jquery/dist/jquery.min.js"></script> 100 <script src="bower_components/jquery/dist/jquery.min.js"></script>
-   101 <!-- Angular JS -->
-   102 <script src="bower_components/angular/angular.min.js"></script>
95 <!-- BootStrap --> 103 <!-- BootStrap -->
96 <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script> 104 <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
97 <!-- Bootstrap Validator --> 105 <!-- Bootstrap Validator -->
98 <script src="bower_components/bootstrap-validator/dist/validator.min.js"></script> 106 <script src="bower_components/bootstrap-validator/dist/validator.min.js"></script>
99 <!-- blueimp-gallery --> 107 <!-- blueimp-gallery -->
100 <script src="bower_components/blueimp-gallery/js/blueimp-gallery.min.js"></script> 108 <script src="bower_components/blueimp-gallery/js/blueimp-gallery.min.js"></script>
101 <!-- Clipboard --> 109 <!-- Clipboard -->
102 <script src="bower_components/clipboard/dist/clipboard.min.js"></script> 110 <script src="bower_components/clipboard/dist/clipboard.min.js"></script>
103 <!-- YAML --> 111 <!-- YAML -->
104 <script src="bower_components/yaml.js/dist/yaml.min.js"></script> 112 <script src="bower_components/yaml.js/dist/yaml.min.js"></script>
105 <!-- Swiper --> 113 <!-- Swiper -->
106 <script src="bower_components/swiper/dist/js/swiper.min.js"></script> 114 <script src="bower_components/swiper/dist/js/swiper.min.js"></script>
107 <!-- Wizardry and Steamworks --> 115 <!-- Wizardry and Steamworks -->
108 <script src="bower_components/was/dist/was.min.js"></script> 116 <script src="bower_components/was/dist/was.min.js"></script>
-   117 <!-- Angular Initialization. -->
-   118 <script>
-   119 var app = angular.module('scratch', []);
-   120 </script>
109 <script> 121 <script>
110 $(document).ready(() => { 122 $(document).ready(() => {
111 123
112 // Extend gallery for HTML. 124 // Extend gallery for HTML.
113 blueimp.Gallery.prototype.textFactory = function (obj, callback) { 125 blueimp.Gallery.prototype.textFactory = function (obj, callback) {
114 var $element = $('<div>') 126 var $element = $('<div>')
115 .addClass('text-content') 127 .addClass('text-content')
116 .attr('title', obj.title); 128 .attr('title', obj.title);
117 $.get(obj.href, { 129 $.get(obj.href, {
118 timestamp: window.performance.now() 130 timestamp: window.performance.now()
119 }).done(function (result) { 131 }).done(function (result) {
120 $element.html(result); 132 $element.html(result);
121 callback({ 133 callback({
122 type: 'load', 134 type: 'load',
123 target: $element[0] 135 target: $element[0]
124 }); 136 });
125 }) 137 })
126 .fail(function () { 138 .fail(function () {
127 callback({ 139 callback({
128 type: 'error', 140 type: 'error',
129 target: $element[0] 141 target: $element[0]
130 }); 142 });
131 }); 143 });
132 return $element[0]; 144 return $element[0];
133 }; 145 };
134 146
135 $.getJSON('view.php', { 147 $.getJSON('view.php', {
136 timestamp: window.performance.now() 148 timestamp: window.performance.now()
137 }).then((data) => { 149 }).then((data) => {
138 // Create slides. 150 // Create slides.
139 var indexPage = 0; 151 var indexPage = 0;
140 data.chunk(50).forEach((page) => { 152 data.chunk(50).forEach((page) => {
141 document.getElementById('links') 153 document.getElementById('links')
142 .insertAdjacentHTML( 154 .insertAdjacentHTML(
143 'beforeend', 155 'beforeend',
144 '<div id="swiper-slide-' + indexPage + '" class="swiper-slide"></div>' 156 '<div id="swiper-slide-' + indexPage + '" class="swiper-slide"></div>'
145 ); 157 );
146 page.forEach((link) => { 158 page.forEach((link) => {
147 // Generic icon for text / html items. 159 // Generic icon for text / html items.
148 switch(link.type) { 160 switch(link.type) {
149 case 'text/plain': 161 case 'text/plain':
150 link.preview ='img/text.png'; 162 link.preview ='img/text.png';
151 break; 163 break;
152 } 164 }
153 document.getElementById('swiper-slide-' + indexPage) 165 document.getElementById('swiper-slide-' + indexPage)
154 .insertAdjacentHTML( 166 .insertAdjacentHTML(
155 'beforeend', 167 'beforeend',
156 '<a href="' + 168 '<a href="' +
157 link.url + 169 link.url +
158 '" type="' + 170 '" type="' +
159 link.type + 171 link.type +
160 '"><img src="' + 172 '"><img src="' +
161 link.preview + 173 link.preview +
162 '" width="60" height="40"></a>' 174 '" width="60" height="40"></a>'
163 ); 175 );
164 }); 176 });
165 177
166 178
167 ++indexPage; 179 ++indexPage;
168 }); 180 });
169 181
170 // Initialize gallery. 182 // Initialize gallery.
171 document.getElementById('links').onclick = function (event) { 183 document.getElementById('links').onclick = function (event) {
172 event = event || window.event; 184 event = event || window.event;
173 var target = event.target || event.srcElement, 185 var target = event.target || event.srcElement,
174 link = target.src ? target.parentNode : target, 186 link = target.src ? target.parentNode : target,
175 options = { 187 options = {
176 index: link, 188 index: link,
177 event: event, 189 event: event,
178 carousel: true, 190 carousel: true,
179 container: '#blueimp-gallery-carousel', 191 container: '#blueimp-gallery-carousel',
180 stretchImages: true, 192 stretchImages: true,
181 startSlideshow: false, 193 startSlideshow: false,
182 onslideend: function(index, slide) { 194 onslideend: function(index, slide) {
183 // Set the URL. 195 // Set the URL.
184 $('#URL').val( 196 $('#URL').val(
185 location.protocol 197 location.protocol
186 .concat("//") 198 .concat("//")
187 .concat(window.location.hostname) 199 .concat(window.location.hostname)
188 .concat("/").concat(data[index].url) 200 .concat("/").concat(data[index].url)
189 ); 201 );
190 202
191 // Check if OpenGraph should be enabled. 203 // Check if OpenGraph should be enabled.
192 switch(data[index].opengraph) { 204 switch(data[index].opengraph) {
193 case true: 205 case true:
194 // Enable the facebook button. 206 // Enable the facebook button.
195 $('#btn-facebook') 207 $('#btn-facebook')
196 .prop("disabled", false); 208 .prop("disabled", false);
197 break; 209 break;
198 default: 210 default:
199 // Disable the facebook button. 211 // Disable the facebook button.
200 $('#btn-facebook') 212 $('#btn-facebook')
201 .prop("disabled", true); 213 .prop("disabled", true);
202 break; 214 break;
203 } 215 }
204 216
205 // Change the URL to OpenGraph when the user clicks the button. 217 // Change the URL to OpenGraph when the user clicks the button.
206 $('#btn-facebook').on('click', () => { 218 $('#btn-facebook').on('click', () => {
207 $('#URL') 219 $('#URL')
208 .val( 220 .val(
209 location.protocol.concat("//") 221 location.protocol.concat("//")
210 .concat(window.location.hostname) 222 .concat(window.location.hostname)
211 .concat("/") 223 .concat("/")
212 .concat("og") 224 .concat("og")
213 .concat("/") 225 .concat("/")
214 .concat(data[index].url) 226 .concat(data[index].url)
215 ); 227 );
216 }); 228 });
217 } 229 }
218 }, 230 },
219 links = this.getElementsByTagName('a'); 231 links = this.getElementsByTagName('a');
220 blueimp.Gallery(links, options); 232 blueimp.Gallery(links, options);
221 }; 233 };
222 234
223 new Swiper ('.swiper-container', { 235 new Swiper ('.swiper-container', {
224 // Optional parameters 236 // Optional parameters
225 direction: 'horizontal', 237 direction: 'horizontal',
226 // Creates duplicate element IDs if set to true. 238 // Creates duplicate element IDs if set to true.
227 loop: false, 239 loop: false,
228 240
229 // If we need pagination 241 // If we need pagination
230 //pagination: '.swiper-pagination', 242 //pagination: '.swiper-pagination',
231 243
232 // Navigation arrows 244 // Navigation arrows
233 nextButton: '.swiper-button-next', 245 nextButton: '.swiper-button-next',
234 prevButton: '.swiper-button-prev', 246 prevButton: '.swiper-button-prev',
235 247
236 // And if we need scrollbar 248 // And if we need scrollbar
237 //scrollbar: '.swiper-scrollbar', 249 //scrollbar: '.swiper-scrollbar',
238 }); 250 });
239 251
240 // Enable the Clipboard button. 252 // Enable the Clipboard button.
241 new Clipboard('#copy-url'); 253 new Clipboard('#copy-url');
242 }); 254 });
243 }); 255 });
244 </script> 256 </script>
245 <!-- Jumbotron parallax effect --> 257 <!-- Jumbotron parallax effect -->
246 <script> 258 <script>
247 var jumboHeight = $('.jumbotron').outerHeight(); 259 var jumboHeight = $('.jumbotron').outerHeight();
248 function parallax(){ 260 function parallax(){
249 var scrolled = $(window).scrollTop(); 261 var scrolled = $(window).scrollTop();
250 $('.paralax-background').css('height', (jumboHeight-scrolled) + 'px'); 262 $('.paralax-background').css('height', (jumboHeight-scrolled) + 'px');
251 } 263 }
252   264  
253 $(window).scroll(function(e){ 265 $(window).scroll(function(e){
254 parallax(); 266 parallax();
255 }); 267 });
256 </script> 268 </script>
257 </body> 269 </body>
258 </html> 270 </html>
259   271