53 lines
2.3 KiB
JavaScript
53 lines
2.3 KiB
JavaScript
jQuery(document).ready(function($)
|
|
{
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const pageId = urlParams.get('number');
|
|
i = pageId - 1; // index is 0
|
|
|
|
$.getJSON("data.json", function(data)
|
|
{
|
|
// page title
|
|
$("head title").append(data[i].number);
|
|
|
|
// photo
|
|
if (data[i].photo != "none")
|
|
$(".photo img").attr("src", "photos/paintings/normal/" + data[i].number + ".jpg");
|
|
else
|
|
$(".photo img").attr("src", "images/unknown.jpg");
|
|
|
|
// metadata
|
|
$(".metadata .content.number").append(data[i].number);
|
|
if (data[i].month != "—") $(".metadata .content.date").append(data[i].month + " " + data[i].year);
|
|
else $(".metadata .content.date").append(data[i].year);
|
|
$(".metadata .content.dimension").append(data[i].dimension);
|
|
$(".metadata .content.support").append(data[i].support);
|
|
$(".metadata .content.theme").append(data[i].theme);
|
|
$(".metadata .content.place").append(data[i].place);
|
|
$(".metadata .content.category").append(data[i].category);
|
|
|
|
if (data[i].photo == "none") photoState = "aucune";
|
|
if (data[i].photo == "bad") photoState = "mauvais";
|
|
if (data[i].photo == "ok") photoState = "acceptable";
|
|
if (data[i].photo == "good") photoState = "bon";
|
|
$(".metadata .content.photo").append(photoState);
|
|
|
|
if (data[i].help == "yes") $(".metadata .content.help").append('<a href="informations.html"><strong>oui (!)</strong></a>');
|
|
else $(".metadata .content.help").append("non");
|
|
|
|
$(".metadata .content.comment").append(data[i].comment);
|
|
|
|
if (data[i].photo != "none")
|
|
$(".metadata .content.original a").attr("href", "photos/paintings/original/" + data[i].number + ".jpg");
|
|
else
|
|
$(".metadata .content.original").parent().css("display", "none");
|
|
|
|
// cartel
|
|
$("#info .title").append(data[i].title);
|
|
if (data[i].month != "—") $("#info .year").append(data[i].month + " " + data[i].year);
|
|
else $("#info .year").append(data[i].year);
|
|
format = data[i].paint + " sur " + data[i].support;
|
|
format += " (" + data[i].dimension + ")";
|
|
$("#info .format").append(format);
|
|
$("#info .comment").prepend(data[i].comment);
|
|
});
|
|
}); |