54 lines
2.0 KiB
JavaScript
54 lines
2.0 KiB
JavaScript
jQuery(document).ready(function($)
|
|
{
|
|
$.getJSON("data.json", function(data)
|
|
{
|
|
fancyboxInit(data, false);
|
|
|
|
window.pageSize = 14;
|
|
var paintingList = [];
|
|
|
|
canDisplay = true;
|
|
for (i of data)
|
|
{
|
|
if (i.expo == "yes")
|
|
{
|
|
paintingList.push(i.number);
|
|
if (paintingList.length % (pageSize + 1) == 0)
|
|
canDisplay = false;
|
|
|
|
paintingHtml = '<div class="gallery-item ';
|
|
if (canDisplay)
|
|
{
|
|
paintingHtml += 'active"><a data-fancybox="exposition" href="photos/paintings/normal/' + i.number + '.jpg" data-fancybox-index="' + i.number + '">'
|
|
paintingHtml += '<img src="photos/paintings/mini/' + i.number + '.jpg" alt="Tableau ' + i.number + '"></a>';
|
|
}
|
|
else
|
|
{
|
|
paintingHtml += 'inactive"><a data-fancybox="exposition" href="photos/paintings/normal/' + i.number + '.jpg" data-fancybox-index="' + i.number + '">'
|
|
paintingHtml += '<img src="photos/paintings/mini/' + i.number + '.jpg" alt="Tableau ' + i.number + '"></a>';
|
|
}
|
|
paintingHtml += '<span class="item-title">' + i.title;
|
|
if (i.year != '—')
|
|
paintingHtml += ' (' + i.year + ')';
|
|
paintingHtml += '</span></div>';
|
|
$(".gallery").append(paintingHtml);
|
|
}
|
|
}
|
|
|
|
var targetPage = 0;
|
|
urlParams = new URLSearchParams(window.location.search);
|
|
if (urlParams.get('page') != "")
|
|
targetPage = urlParams.get('page');
|
|
|
|
// pagination configuration
|
|
window.currentPage = 0;
|
|
window.previousArray = [];
|
|
$.getScript("scripts/pagination.js", function() {
|
|
paginationInit(data, paintingList, false);
|
|
|
|
if (targetPage > 0)
|
|
$("#pagination").pagination('go', targetPage);
|
|
|
|
});
|
|
});
|
|
}); |