Fix issue for "inédits", new "existant" button, and CSS improvement
This commit is contained in:
@ -119,6 +119,15 @@ jQuery(document).ready(function($)
|
||||
checkBoxSelector("tags", "tag", paramTag);
|
||||
checkBoxSelector("photos", "photo", paramPhoto);
|
||||
checkBoxSelector("helps", "help", paramHelp);
|
||||
|
||||
// special case for photos with "exist"
|
||||
if (paramPhoto == "exist")
|
||||
{
|
||||
$('input[id="exist"]').prop("checked", true);
|
||||
$('input[id="bad"]').prop("checked", true); $('input[id="bad"]').prop("disabled", true);
|
||||
$('input[id="ok"]').prop("checked", true); $('input[id="ok"]').prop("disabled", true);
|
||||
$('input[id="good"]').prop("checked", true); $('input[id="good"]').prop("disabled", true);
|
||||
}
|
||||
}
|
||||
|
||||
// if "all" is selected, check all other options and disable them
|
||||
@ -150,6 +159,23 @@ jQuery(document).ready(function($)
|
||||
AllCheckBoxSelector("tags", "tag");
|
||||
AllCheckBoxSelector("photos", "photo");
|
||||
AllCheckBoxSelector("helps", "help");
|
||||
|
||||
// special case for photos with "exist"
|
||||
$('input[id="exist"]').click(function()
|
||||
{
|
||||
if ($(this).prop("checked") == true)
|
||||
{
|
||||
$('input[id="bad"]').prop("checked", true); $('input[id="bad"]').prop("disabled", true);
|
||||
$('input[id="ok"]').prop("checked", true); $('input[id="ok"]').prop("disabled", true);
|
||||
$('input[id="good"]').prop("checked", true); $('input[id="good"]').prop("disabled", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('input[id="bad"]').prop("checked", false); $('input[id="bad"]').prop("disabled", false);
|
||||
$('input[id="ok"]').prop("checked", false); $('input[id="ok"]').prop("disabled", false);
|
||||
$('input[id="good"]').prop("checked", false); $('input[id="good"]').prop("disabled", false);
|
||||
}
|
||||
});
|
||||
|
||||
// menu configurer show / hide
|
||||
$("article.explorer h2").click(function()
|
||||
@ -284,6 +310,7 @@ jQuery(document).ready(function($)
|
||||
if (paramPhoto.includes("bad") && photo == "bad") return true;
|
||||
if (paramPhoto.includes("ok") && photo == "ok") return true;
|
||||
if (paramPhoto.includes("good") && photo == "good") return true;
|
||||
if (paramPhoto.includes("exist") && (photo == "bad" || photo == "ok" || photo == "good")) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -369,7 +396,7 @@ jQuery(document).ready(function($)
|
||||
}
|
||||
$("#gallery").append(paintingHtml);
|
||||
}
|
||||
$(".explorer .result").append("La recherche donne un résultat de <strong>" + numberOfItem + " éléments</strong>.");
|
||||
$(".explorer .result").append("La recherche donne un résultat de <strong>" + numberOfItem + " élément" + (numberOfItem > 1 ? "s" : "") + "</strong>.");
|
||||
return hasResult;
|
||||
}
|
||||
|
||||
|
@ -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