/gallery.html |
@@ -69,21 +69,15 @@ |
<a class="prev">‹</a> |
<a class="next">›</a> |
<a class="play-pause"></a> |
<ol class="indicator"></ol> |
<!-- <ol class="indicator"></ol> --> |
</div> |
|
<div class="swiper-container"> |
<div id="links" class="swiper-wrapper"> |
</div> |
<!-- If we need pagination --> |
<div class="swiper-pagination"></div> |
|
<!-- If we need navigation buttons --> |
<div class="swiper-button-prev"></div> |
<div class="swiper-button-next"></div> |
|
<!-- If we need scrollbar --> |
<div class="swiper-scrollbar"></div> |
</div> |
</div> |
</div> |
@@ -141,15 +135,13 @@ |
$.getJSON('gallery.php', { |
timestamp: window.performance.now() |
}).then((data) => { |
//alert(JSON.stringify(data, null, 4)); |
|
// Create slides. |
var index = 0; |
var indexPage = 0; |
data.chunk(50).forEach((page) => { |
document.getElementById('links') |
.insertAdjacentHTML( |
'beforeend', |
'<div id="swiper-slide-' + index + '" class="swiper-slide"></div>' |
'<div id="swiper-slide-' + indexPage + '" class="swiper-slide"></div>' |
); |
page.forEach((link) => { |
// Generic icon for text / html items. |
@@ -158,7 +150,7 @@ |
link.preview ='img/text.png'; |
break; |
} |
document.getElementById('swiper-slide-' + index) |
document.getElementById('swiper-slide-' + indexPage) |
.insertAdjacentHTML( |
'beforeend', |
'<a href="' + |
@@ -170,8 +162,12 @@ |
'" width="60" height="40"></a>' |
); |
}); |
++index; |
|
|
++indexPage; |
}); |
|
// Initialize gallery. |
document.getElementById('links').onclick = function (event) { |
event = event || window.event; |
var target = event.target || event.srcElement, |
@@ -179,7 +175,7 @@ |
options = { |
index: link, |
event: event, |
carousel: true, |
carousel: true, |
container: '#blueimp-gallery-carousel', |
stretchImages: true, |
startSlideshow: false, |
@@ -191,7 +187,7 @@ |
.concat(window.location.hostname) |
.concat("/").concat(data[index].url) |
); |
|
|
// Check if OpenGraph should be enabled. |
switch(data[index].opengraph) { |
case true: |
@@ -205,7 +201,7 @@ |
.prop("disabled", true); |
break; |
} |
|
|
// Change the URL to OpenGraph when the user clicks the button. |
$('#btn-facebook').on('click', () => { |
$('#URL') |
@@ -227,10 +223,11 @@ |
new Swiper ('.swiper-container', { |
// Optional parameters |
direction: 'horizontal', |
loop: true, |
// Creates duplicate element IDs if set to true. |
loop: false, |
|
// If we need pagination |
pagination: '.swiper-pagination', |
//pagination: '.swiper-pagination', |
|
// Navigation arrows |
nextButton: '.swiper-button-next', |
@@ -237,7 +234,7 @@ |
prevButton: '.swiper-button-prev', |
|
// And if we need scrollbar |
scrollbar: '.swiper-scrollbar', |
//scrollbar: '.swiper-scrollbar', |
}); |
|
// Enable the Clipboard button. |