diff --git a/explorer.html b/explorer.html index 8dc4f4f..746f5d5 100644 --- a/explorer.html +++ b/explorer.html @@ -46,6 +46,23 @@
diff --git a/painting.html b/painting.html index 860e757..0e2a96d 100644 --- a/painting.html +++ b/painting.html @@ -2,7 +2,7 @@
-
+
diff --git a/scripts/explorer.js b/scripts/explorer.js index 4827a1e..6d93335 100644 --- a/scripts/explorer.js +++ b/scripts/explorer.js @@ -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 " + numberOfItem + " éléments."); + $(".explorer .result").append("La recherche donne un résultat de " + numberOfItem + " élément" + (numberOfItem > 1 ? "s" : "") + "."); return hasResult; } diff --git a/scripts/painting.js b/scripts/painting.js index b53a112..7fef1d6 100644 --- a/scripts/painting.js +++ b/scripts/painting.js @@ -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('
Aucun tableau n\'existe pour cet index.
'); + } + + 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 diff --git a/styles/main.css b/styles/main.css index 4fe13d6..2c46bae 100644 --- a/styles/main.css +++ b/styles/main.css @@ -26,6 +26,10 @@ a { text-decoration:none; } +.center { + text-align:center; +} + header { border-top:.2rem solid #187795; box-shadow:0 .4rem .4rem 0 rgba(0,0,0,.04); @@ -406,7 +410,6 @@ article.explorer form h3, article.explorer form span { } article.explorer form .container { - /*max-width:80vw;*/ margin:auto; display:flex; align-self:flex-start; @@ -423,11 +426,6 @@ article.explorer form select { margin-left:0.2rem; } -/* does not seem to work */ -article.explorer form .box { - margin:1rem; -} - article.explorer input[type = submit] { display:block; margin:auto; @@ -443,6 +441,10 @@ article.explorer input[type = submit] { color:white; } +input:checked + label { + font-weight:bold; +} + @media only screen and (max-width:600px) { article.explorer form .container { display:block; @@ -535,7 +537,6 @@ article.explorer tr td:first-child { } article.explorer tr td:nth-child(2) { - width:25%; white-space:nowrap; }