From fece1eab161c67915ed7cd01feebc96ecf803b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Marchal?= Date: Mon, 22 Feb 2021 13:33:19 +0100 Subject: [PATCH] Update on filter --- scripts/explorer.js | 5 +++++ scripts/explorer_menu.js | 40 ++++++++++++++++++++++++---------------- styles/main.css | 5 +++++ 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/scripts/explorer.js b/scripts/explorer.js index 9d23f54..bed6058 100644 --- a/scripts/explorer.js +++ b/scripts/explorer.js @@ -288,6 +288,11 @@ jQuery(document).ready(function($) visualFilterListItem("photo", paramPhoto); visualFilterListItem("year", paramYear); + visualFilterListItem("month", paramMonth); + visualFilterListItem("genre", paramGenre); + visualFilterListItem("theme", paramTheme); + visualFilterListItem("dimension", paramDimension); + visualFilterListItem("help", paramHelp); }); diff --git a/scripts/explorer_menu.js b/scripts/explorer_menu.js index 55a9b18..1fd1337 100644 --- a/scripts/explorer_menu.js +++ b/scripts/explorer_menu.js @@ -109,26 +109,34 @@ function updateMenu(availableOptions) { console.log("updateMenu", availableOptions); - $('.photos input, .photos input + label').each(function() + function checkItem(name, array) { - if (this.value != "all") - $(this).css('color', 'red'); + $('.'+name+' .item-cont span').each(function() + { + $(this).addClass("filter"); + }); + for (a of array) + { + $('.'+name+' .item-cont span input[id="'+a+'"]').parent().removeClass("filter"); + } + } + + checkItem("photos", availableOptions.photos); + checkItem("years", availableOptions.years); + checkItem("months", availableOptions.months); + checkItem("genres", availableOptions.genres); + checkItem("themes", availableOptions.themes); + checkItem("dimensions", availableOptions.dimensions); + checkItem("help", availableOptions.helps); + + /*$('.photos .item-cont span').each(function() + { + $(this).addClass("filter"); }); for (a of availableOptions.photos) { - $('.photos input[id="' + a + '"], .photos input[id="' + a + '"] + label').css('color', 'black'); - } - - /*$('.photos input').each(function() - { - console.log(this.id); - for (i of availableOptions.photos) - { - console.log("fuck", this.id, i); - if (this.id != i) - $(this).hide(); - } - });*/ + $('.photos .item-cont span input[id="'+a+'"]').parent().removeClass("filter"); + }*/ } function URLGeneration(availableOptions) diff --git a/styles/main.css b/styles/main.css index f1eef1b..6aee70f 100644 --- a/styles/main.css +++ b/styles/main.css @@ -542,6 +542,11 @@ input:checked + label { font-weight:bold; } +.item-cont span.filter { + font-size:0.75rem; + /*text-decoration:line-through;*/ +} + @media only screen and (max-width:600px) { article.explorer form .container { display:block;