Fix issue for "inédits", new "existant" button, and CSS improvement
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user