scratch – Diff between revs 125 and 139
?pathlinks?
Rev 125 | Rev 139 | |||
---|---|---|---|---|
Line 20... | Line 20... | |||
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 | <!-- Bootstrap TokenField --> |
||
- | 26 | <link href="bower_components/bootstrap-tokenfield/dist/css/bootstrap-tokenfield.min.css" rel="stylesheet"> |
||
Line 25... | Line 27... | |||
25 | |
27 | |
|
26 | <!-- Site-wide style CCS --> |
28 | <!-- Site-wide style CCS --> |
|
Line 27... | Line 29... | |||
27 | <link href="css/style.css" rel="stylesheet"> |
29 | <link href="css/style.css" rel="stylesheet"> |
|
Line 65... | Line 67... | |||
65 | </span> |
67 | </span> |
|
66 | <span class="input-group-btn"> |
68 | <span class="input-group-btn"> |
|
67 | <button id="btn-facebook" class="btn btn-default" type="button" disabled><i class="fa fa-facebook"></i></button> |
69 | <button id="btn-facebook" class="btn btn-default" type="button" disabled><i class="fa fa-facebook"></i></button> |
|
68 | </span> |
70 | </span> |
|
69 | </div> |
71 | </div> |
|
- | 72 | <div class="input-group"> |
||
- | 73 | <input type="text" class="form-control tokenfield file-tags" id="file-tags" data-minLength="3" data-delimiter=" "/> |
||
- | 74 | <span class="input-group-btn"> |
||
- | 75 | <button id="btn-filter" class="btn btn-default" type="button"><i class="fa fa-remove"></i></button> |
||
- | 76 | </span> |
||
- | 77 | </div> |
||
- | 78 | |
||
- | 79 | <!-- Create swiper container --> |
||
- | 80 | <div class="swiper-container"> |
||
- | 81 | <div id="links" class="swiper-wrapper"> |
||
- | 82 | </div> |
||
- | 83 | <!-- If we need navigation buttons --> |
||
- | 84 | <div class="swiper-button-prev"></div> |
||
- | 85 | <div class="swiper-button-next"></div> |
||
- | 86 | </div> |
||
Line 70... | Line 87... | |||
70 | |
87 | |
|
71 | <!-- The Gallery as inline carousel, can be positioned anywhere on the page --> |
88 | <!-- The Gallery as inline carousel, can be positioned anywhere on the page --> |
|
72 | <div id="blueimp-gallery-carousel" class="blueimp-gallery blueimp-gallery-carousel"> |
89 | <div id="blueimp-gallery-carousel" class="blueimp-gallery blueimp-gallery-carousel"> |
|
73 | <div class="slides"></div> |
90 | <div class="slides"></div> |
|
Line 76... | Line 93... | |||
76 | <a class="next">›</a> |
93 | <a class="next">›</a> |
|
77 | <a class="play-pause"></a> |
94 | <a class="play-pause"></a> |
|
78 | <!-- <ol class="indicator"></ol> --> |
95 | <!-- <ol class="indicator"></ol> --> |
|
79 | </div> |
96 | </div> |
|
Line 80... | Line -... | |||
80 | |
- | ||
81 | <div class="swiper-container"> |
- | ||
82 | <div id="links" class="swiper-wrapper"> |
- | ||
83 | </div> |
- | ||
84 | <!-- If we need navigation buttons --> |
- | ||
85 | <div class="swiper-button-prev"></div> |
- | ||
86 | <div class="swiper-button-next"></div> |
- | ||
87 | </div> |
97 | |
|
88 | </div> |
98 | </div> |
|
Line 89... | Line 99... | |||
89 | </div> |
99 | </div> |
|
Line 106... | Line 116... | |||
106 | <script src="bower_components/bootstrap-validator/dist/validator.min.js"></script> |
116 | <script src="bower_components/bootstrap-validator/dist/validator.min.js"></script> |
|
107 | <!-- blueimp-gallery --> |
117 | <!-- blueimp-gallery --> |
|
108 | <script src="bower_components/blueimp-gallery/js/blueimp-gallery.min.js"></script> |
118 | <script src="bower_components/blueimp-gallery/js/blueimp-gallery.min.js"></script> |
|
109 | <!-- Clipboard --> |
119 | <!-- Clipboard --> |
|
110 | <script src="bower_components/clipboard/dist/clipboard.min.js"></script> |
120 | <script src="bower_components/clipboard/dist/clipboard.min.js"></script> |
|
- | 121 | <!-- BootStrap TokenField --> |
||
- | 122 | <script src="bower_components/bootstrap-tokenfield/dist/bootstrap-tokenfield.min.js"></script> |
||
111 | <!-- YAML --> |
123 | <!-- YAML --> |
|
112 | <script src="bower_components/yaml.js/dist/yaml.min.js"></script> |
124 | <script src="bower_components/yaml.js/dist/yaml.min.js"></script> |
|
113 | <!-- Swiper --> |
125 | <!-- Swiper --> |
|
114 | <script src="bower_components/swiper/dist/js/swiper.min.js"></script> |
126 | <script src="bower_components/swiper/dist/js/swiper.min.js"></script> |
|
115 | <!-- Wizardry and Steamworks --> |
127 | <!-- Wizardry and Steamworks --> |
|
Line 142... | Line 154... | |||
142 | }); |
154 | }); |
|
143 | }); |
155 | }); |
|
144 | return $element[0]; |
156 | return $element[0]; |
|
145 | }; |
157 | }; |
|
Line -... | Line 158... | |||
- | 158 | |
||
146 | |
159 | function createGallery(tags, swiper) { |
|
- | 160 | $.getJSON('view.php', { |
||
147 | $.getJSON('view.php', { |
161 | tags: JSON.stringify(tags), |
|
148 | timestamp: window.performance.now() |
162 | timestamp: window.performance.now() |
|
- | 163 | }).then((data) => { |
||
- | 164 | // Remove current links. |
||
149 | }).then((data) => { |
165 | document.getElementById('links').innerHTML = ''; |
|
150 | // Create slides. |
166 | // Create slides. |
|
151 | var indexPage = 0; |
167 | var indexPage = 0; |
|
152 | data.chunk(50).forEach((page) => { |
168 | data.chunk(50).forEach((page) => { |
|
153 | document.getElementById('links') |
169 | document.getElementById('links') |
|
Line 163... | Line 179... | |||
163 | break; |
179 | break; |
|
164 | } |
180 | } |
|
165 | document.getElementById('swiper-slide-' + indexPage) |
181 | document.getElementById('swiper-slide-' + indexPage) |
|
166 | .insertAdjacentHTML( |
182 | .insertAdjacentHTML( |
|
167 | 'beforeend', |
183 | 'beforeend', |
|
168 | '<a href="' + |
184 | '<a class="swiper-thumb" href="' + |
|
169 | link.url + |
185 | link.url + |
|
170 | '" type="' + |
186 | '" type="' + |
|
171 | link.type + |
187 | link.type + |
|
172 | '"><img src="' + |
188 | '"><img src="' + |
|
173 | link.preview + |
189 | link.preview + |
|
Line 230... | Line 246... | |||
230 | }, |
246 | }, |
|
231 | links = this.getElementsByTagName('a'); |
247 | links = this.getElementsByTagName('a'); |
|
232 | blueimp.Gallery(links, options); |
248 | blueimp.Gallery(links, options); |
|
233 | }; |
249 | }; |
|
Line -... | Line 250... | |||
- | 250 | |
||
- | 251 | swiper.update(); |
||
- | 252 | swiper.slideTo(1, 0, false); |
||
- | 253 | }); |
||
- | 254 | } |
||
- | 255 | |
||
234 | |
256 | // Create swiper. |
|
235 | new Swiper ('.swiper-container', { |
257 | var swiper = new Swiper ('.swiper-container', { |
|
236 | // Optional parameters |
258 | // Optional parameters |
|
237 | direction: 'horizontal', |
259 | direction: 'horizontal', |
|
238 | // Creates duplicate element IDs if set to true. |
260 | // Creates duplicate element IDs if set to true. |
|
Line 244... | Line 266... | |||
244 | // Navigation arrows |
266 | // Navigation arrows |
|
245 | nextButton: '.swiper-button-next', |
267 | nextButton: '.swiper-button-next', |
|
246 | prevButton: '.swiper-button-prev', |
268 | prevButton: '.swiper-button-prev', |
|
Line 247... | Line 269... | |||
247 | |
269 | |
|
248 | // And if we need scrollbar |
270 | // And if we need scrollbar |
|
249 | //scrollbar: '.swiper-scrollbar', |
271 | //scrollbar: '.swiper-scrollbar' |
|
Line 250... | Line 272... | |||
250 | }); |
272 | }); |
|
251 | |
273 | |
|
- | 274 | // Enable the Clipboard button. |
||
- | 275 | new Clipboard('#copy-url'); |
||
- | 276 | |
||
- | 277 | // Create token field. |
||
- | 278 | $('#file-tags').tokenfield(); |
||
- | 279 | |
||
- | 280 | // Bind to token field tag add and remove events. |
||
- | 281 | $('#file-tags') |
||
- | 282 | .on('tokenfield:createdtoken', function (e) { |
||
- | 283 | createGallery($('#file-tags').tokenfield('getTokens'), swiper); |
||
- | 284 | }) |
||
- | 285 | .on('tokenfield:removedtoken', function (e) { |
||
- | 286 | // Happens when all the tags are removed. |
||
- | 287 | if(e.attrs.value == null || typeof e.attrs.value === undefined) { |
||
- | 288 | createGallery([], swiper); |
||
- | 289 | return; |
||
252 | // Enable the Clipboard button. |
290 | } |
|
- | 291 | createGallery($('#file-tags').tokenfield('getTokens')); |
||
- | 292 | }); |
||
- | 293 | |
||
- | 294 | // Create clear button for tags. |
||
- | 295 | $('#btn-filter').click(() => { |
||
- | 296 | $('#file-tags').tokenfield('setTokens', []); |
||
- | 297 | createGallery([], swiper); |
||
- | 298 | }); |
||
- | 299 | |
||
253 | new Clipboard('#copy-url'); |
300 | // Generate the gallery. |
|
254 | }); |
301 | createGallery([], swiper); |
|
255 | }); |
302 | }); |
|
256 | </script> |
303 | </script> |
|
257 | <!-- Jumbotron parallax effect --> |
304 | <!-- Jumbotron parallax effect --> |