Fix issue for "inédits", new "existant" button, and CSS improvement

This commit is contained in:
2021-02-10 22:21:02 +01:00
parent d55c1bf238
commit a2a2dc97c0
6 changed files with 99 additions and 54 deletions

View File

@ -2,12 +2,29 @@ jQuery(document).ready(function($)
{
const urlParams = new URLSearchParams(window.location.search);
const pageId = urlParams.get('number');
i = pageId - 1; // index is 0
if (pageId > 1000)
i = pageId - 1000 + 383 - 1; // inédit: index starts at 1000 // 383: total number of paintings except inédit
else
i = pageId - 1; // index is 0
$.getJSON("data.json", function(data)
{
if (!data[i]) // the number specified in URL does not exist
{
$(".container").css("display", "none");
$("#info").css("display", "none");
$("article").append('<p class="center">Aucun tableau n\'existe pour cet index.</p>');
}
function GetNumber()
{
if (data[i].number > 1000)
return "Inédit";
return data[i].number;
}
// page title
$("head title").append(data[i].number);
$("head title").append(GetNumber());
// photo
if (data[i].photo != "none")
@ -16,7 +33,7 @@ jQuery(document).ready(function($)
$(".photo img").attr("src", "images/unknown.jpg");
// metadata
$(".metadata .content.number").append(data[i].number);
$(".metadata .content.number").append(GetNumber());
if (data[i].month != "—")
$(".metadata .content.date").append(data[i].month + " " + data[i].year);
else