Compare commits

...

25 Commits

Author SHA1 Message Date
60422a6400 Update data 2021-03-07 01:58:22 +01:00
47a0dcd200 Update divers 2021-03-07 01:55:34 +01:00
e923c9404e Update photos submodule 2021-03-07 01:46:13 +01:00
e31639d340 New photo in bio 2021-03-07 01:23:32 +01:00
61511ecc95 Update misc pages 2021-03-07 01:06:12 +01:00
e0ebd28dcb Fix exist photos tag 2021-03-07 00:44:29 +01:00
e41ccc5549 Fix visual appearance of "disponible" photos in explorer 2021-03-07 00:36:07 +01:00
862a7348e6 Simplification in explorer 2021-03-07 00:27:45 +01:00
3283d11c02 Simplification 2021-03-06 14:13:35 +01:00
25a09015d1 Working "tous" filter for tags 2021-03-06 14:05:04 +01:00
34e8fe9b12 Working "tous" filter for places 2021-03-06 12:30:44 +01:00
4effbe657e Fix iOS Safari dropdown visibility 2021-03-06 12:09:24 +01:00
35b1e06dfc Fix painting not working with filter 2021-03-06 11:43:53 +01:00
3a964098e7 Fix regression on tags 2021-03-06 01:32:09 +01:00
3fe24e502e Fix "Tous" not filtering visually in explorer 2021-03-06 01:22:59 +01:00
44a5f52e94 Fix issue with "exist" in photos that was not filtering 2021-03-05 01:18:52 +01:00
5b79f924cb Forgot this file. 2021-03-04 10:13:54 +01:00
936af2a9fd Merge branch 'dev' into filter 2021-03-04 10:13:28 +01:00
f37a2fde6e Fix tags handling that was broken with filter 2021-03-04 02:14:51 +01:00
ab5710e69e Fix cartel generation issue
Was preventing the ability to click on paintings
2021-03-03 19:32:59 +01:00
dae17821ad Clean up organisation and comments 2021-03-03 09:56:26 +01:00
10dea8e993 Working filters ; cleaning needs to be done 2021-03-03 09:38:55 +01:00
fece1eab16 Update on filter 2021-02-22 13:33:19 +01:00
4739726e5c WIP filter, has some basic features 2021-02-18 22:07:26 +01:00
bf60722e22 First test of separation of javascript 2021-02-17 18:48:52 +01:00
16 changed files with 922 additions and 669 deletions

View File

@ -34,6 +34,7 @@
<article class="main">
<h1>Biographie</h1>
<img src="images/ginou50.jpg" class="bio-img" alt="Ginou, peignant dans les années 50">
<p>Ginou, née Geneviève Collignon, était une artiste-peintre qui a vécu la plus grande partie de sa vie à Dugny-sur-Meuse, village de la vallée de la Meuse où elle trouvera de nombreux sujets dinspiration.</p>
<p>Comme l'écrit Ginou en 2016 dans un texte sur sa jeunesse, &laquo;&#8239;je suis née un jour de mars 1936 dans un petit village de la Meuse : Mouilly, le berceau des parents de mon père&#8239;&raquo;. Elle a 4 ans quand la Seconde Guerre Mondiale éclate, et en garde des souvenirs très précis, même 75 ans après. Après avoir passé le certificat d'études avec succès, Geneviève apprend le métier de couturière de son père Eugène, tailleur installé dans le bas du petit village isolé dans la forêt meusienne, dans une maison sur les berges du petit ruisseau qui serpente au fond d'une vallée accrochée aux contreforts des côtes de Meuse.</p>

File diff suppressed because one or more lines are too long

View File

@ -101,6 +101,10 @@
<a data-fancybox="divers" href="photos/divers/normal/exposaintjean.jpg" data-caption="Fête du collège Saint-Jean de Verdun (2005).">
<img src="photos/divers/mini/exposaintjean.jpg" alt="Fête du collège Saint-Jean de Verdun (2005).">
</a>
<a data-fancybox="divers" href="photos/divers/normal/expojeannot.jpg" data-caption="Exposition à la foire aux puces de Dugny, avec le Jeannot (1995).">
<img src="photos/divers/mini/expojeannot.jpg" alt="Exposition à la foire aux puces de Dugny, avec le Jeannot (1995).">
</a>
<a data-fancybox="divers" href="photos/divers/normal/foiredugny.jpg" data-caption="Foire aux puces de Dugny-sur-Meuse (2004).">
<img src="photos/divers/mini/foiredugny.jpg" alt="Foire aux puces de Dugny-sur-Meuse (2004).">
@ -109,6 +113,10 @@
<a data-fancybox="divers" href="photos/divers/normal/foirethierville.jpg" data-caption="Foire de Thierville-sur-Meuse (2002).">
<img src="photos/divers/mini/foirethierville.jpg" alt="Foire de Thierville-sur-Meuse (2002).">
</a>
<a data-fancybox="divers" href="photos/divers/normal/expobarleduc.jpg" data-caption="Exposition au siège du Conseil Général de Bar-le-Duc (1994).">
<img src="photos/divers/mini/expobarleduc.jpg" alt="Exposition au siège du Conseil Général de Bar-le-Duc (1994).">
</a>
<a data-fancybox="divers" href="photos/divers/normal/derniereexpo.jpg" data-caption="Dernière exposition où les tableaux de Ginou ont été présentés à titre posthume (2017).">
<img src="photos/divers/mini/derniereexpo.jpg" alt="Dernière exposition où les tableaux de Ginou ont été présentés à titre posthume (2017).">
@ -140,7 +148,7 @@
<p>
De 1956 à 2016, soit sur une période de 60 ans, Ginou a peint plus de de 385 tableaux.<br>
Parmi ceux-ci, elle a le plus souvent aimé travailler à la lumière printanière du mois de mai avec un total de 50 tableaux.<br>
Son année la plus active fut 1988 où elle réalisa 23 &oelig;uvres. Enfin, le format qu'elle privilégia fut le <em>55x46</em>, utilisé pour 53 toiles.
Son année la plus active fut 1988 où elle réalisa 23 &oelig;uvres. Enfin, le genre de tableau quelle préféra peindre était des paysages, plus particulièrement à la campagne.
</p>
<div id="stats">

View File

@ -61,16 +61,7 @@
<div class="item-cont">
<span><input type="checkbox" id="photos" name="photos" value="all">
<label for="photos">Tout état</label></span>
<span><input type="checkbox" id="none" name="photo" value="none">
<label for="none">&#x2606; manquant</label></span>
<span><input type="checkbox" id="exist" name="photo" value="exist">
<label for="exist">Disponible</label></span>
<span><input type="checkbox" id="bad" name="photo" value="bad">
<label for="bad">&#x2605; mauvais</label></span>
<span><input type="checkbox" id="ok" name="photo" value="ok">
<label for="ok">&#x2605;&#x2605; acceptable</label></span>
<span><input type="checkbox" id="good" name="photo" value="good">
<label for="good">&#x2605;&#x2605;&#x2605; bon</label></span>
<div class="generated"></div>
</div>
</div>
<div class="box years">
@ -78,20 +69,7 @@
<div class="item-cont">
<span><input type="checkbox" id="years" name="years" value="all">
<label for="years">Toutes</label></span>
<span><input type="checkbox" id="50s" name="year" value="50s">
<label for="50s">1956 - 1959</label></span>
<span><input type="checkbox" id="60s" name="year" value="60s">
<label for="60s">1960 - 1969</label></span>
<span><input type="checkbox" id="70s" name="year" value="70s">
<label for="70s">1970 - 1979</label></span>
<span><input type="checkbox" id="80s" name="year" value="80s">
<label for="80s">1980 - 1989</label></span>
<span><input type="checkbox" id="90s" name="year" value="90s">
<label for="90s">1990 - 1999</label></span>
<span><input type="checkbox" id="00s" name="year" value="00s">
<label for="00s">2000 - 2009</label></span>
<span><input type="checkbox" id="10s" name="year" value="10s">
<label for="10s">2010 - 2016</label></span>
<div class="generated"></div>
</div>
</div>
<div class="box months">
@ -99,30 +77,7 @@
<div class="item-cont">
<span><input type="checkbox" id="months" name="months" value="all">
<label for="months">Tous</label></span>
<span><input type="checkbox" id="01" name="month" value="01">
<label for="01">Janvier</label></span>
<span><input type="checkbox" id="02" name="month" value="02">
<label for="02">Février</label></span>
<span><input type="checkbox" id="03" name="month" value="03">
<label for="03">Mars</label></span>
<span><input type="checkbox" id="04" name="month" value="04">
<label for="04">Avril</label></span>
<span><input type="checkbox" id="05" name="month" value="05">
<label for="05">Mai</label></span>
<span><input type="checkbox" id="06" name="month" value="06">
<label for="06">Juin</label></span>
<span><input type="checkbox" id="07" name="month" value="07">
<label for="07">Juillet</label></span>
<span><input type="checkbox" id="08" name="month" value="08">
<label for="08">Août</label></span>
<span><input type="checkbox" id="09" name="month" value="09">
<label for="09">Septembre</label></span>
<span><input type="checkbox" id="10" name="month" value="10">
<label for="10">Octobre</label></span>
<span><input type="checkbox" id="11" name="month" value="11">
<label for="11">Novembre</label></span>
<span><input type="checkbox" id="12" name="month" value="12">
<label for="12">Décembre</label></span>
<div class="generated"></div>
</div>
</div>
<div class="box genres">
@ -130,6 +85,7 @@
<div class="item-cont">
<span><input type="checkbox" id="genres" name="genres" value="all">
<label for="genres">Tous</label></span>
<div class="generated"></div>
</div>
</div>
<div class="box themes">
@ -137,6 +93,7 @@
<div class="item-cont">
<span><input type="checkbox" id="themes" name="themes" value="all">
<label for="themes">Tous</label></span>
<div class="generated"></div>
</div>
</div>
<div class="box places">
@ -152,7 +109,7 @@
<div class="item-cont">
<span><input type="checkbox" id="tags" name="tags" value="all">
<label for="tags">Tous</label></span>
<span><span class="inline">&#x203B;&nbsp;</span><select name="tag"></select></span>
<span class="first"><span class="inline">&#x203B;&nbsp;</span><select name="tag"></select></span>
</div>
</div>
<div class="box dimensions">
@ -160,26 +117,7 @@
<div class="item-cont">
<span><input type="checkbox" id="dimensions" name="dimensions" value="all">
<label for="dimensions">Toutes</label></span>
<span><input type="checkbox" id="18" name="dimension" value="18">
<label for="18">&lt; 20cm</label></span>
<span><input type="checkbox" id="20" name="dimension" value="20">
<label for="20">20cm - 29cm</label></span>
<span><input type="checkbox" id="30" name="dimension" value="30">
<label for="30">30cm - 39cm</label></span>
<span><input type="checkbox" id="40" name="dimension" value="40">
<label for="40">40cm - 49cm</label></span>
<span><input type="checkbox" id="50" name="dimension" value="50">
<label for="50">50cm - 59cm</label></span>
<span><input type="checkbox" id="60" name="dimension" value="60">
<label for="60">60cm - 69cm</label></span>
<span><input type="checkbox" id="70" name="dimension" value="70">
<label for="70">70cm - 79cm</label></span>
<span><input type="checkbox" id="80" name="dimension" value="80">
<label for="80">80cm - 89cm</label></span>
<span><input type="checkbox" id="90" name="dimension" value="90">
<label for="90">90cm - 99cm</label></span>
<span><input type="checkbox" id="100" name="dimension" value="100">
<label for="100">>= 100cm</label></span>
<div class="generated"></div>
</div>
</div>
<div class="box help">
@ -187,14 +125,14 @@
<div class="item-cont">
<span><input type="checkbox" id="helps" name="helps" value="all">
<label for="helps">Toute</label></span>
<span><input type="checkbox" id="no" name="help" value="no">
<label for="no">Non</label></span>
<span><input type="checkbox" id="yes" name="help" value="yes">
<label for="yes"><img width="5rem" src="styles/icons/exclamation-mark.svg" alt="Oui"> Oui</label></span>
<div class="generated"></div>
</div>
</div>
</div>
<input type="submit" value="Générer">
<div class="button-cont">
<input type="submit" value="Générer">
<input type="button" value="Réinitialiser">
</div>
</form>
<p class="no-result"><strong>Aucun résultat.</strong> Veuillez réessayer avec d'autres paramètres.</p>
<div id="style-container">

BIN
images/ginou50.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

View File

@ -35,7 +35,7 @@
<h1>L'art de Ginou</h1>
<p>Ginou était une artiste peintre autodidacte très appréciée dans son entourage. Elle a réalisé de nombreuses &oelig;uvres, principalement à la <strong>peinture à lhuile</strong>, occasionnellement à l<strong>aquarelle</strong>, mais aussi par le biais de la <strong>peinture sur soie</strong> et <strong>sur bois</strong> ou bien encore dans les cahiers où elle écrivait des <strong>poèmes illustrés</strong>.</p>
<p>Tout au long de sa vie, Ginou a tenu à jour un petit carnet où elle consignait ses tableaux, en leur attribuant un numéro et un titre et reportait les dimensions et leur destinataires / acheteurs / commanditaires. Dans ce petit carnet, <strong>de 1958 à 2017</strong>, sont référencés 383 tableaux. Cependant 2 tableaux (nº33 et nº49) ont été recouverts par Ginou elle-même. Nous avons aussi retrouvé 4 inédits. Ginou a commencé à prendre en photos certains tableaux quelle peignait dans les années 1980 puis plus systématiquement à partir des années 2000. Pour compléter cette base iconographique, nous avons repris en photo haute résolution les tableaux en notre possession. Ainsi, pour le moment, nous pouvons présenter sur ce site <strong>249 des 385 tableaux recensés.</strong></p>
<p>Tout au long de sa vie, Ginou a tenu à jour un petit carnet où elle consignait ses tableaux, en leur attribuant un numéro et un titre et reportait les dimensions et leur destinataires / acheteurs / commanditaires. Dans ce petit carnet, <strong>de 1958 à 2017</strong>, sont référencés 383 tableaux. Cependant deux tableaux (nº33 et nº49) ont été recouverts par Ginou elle-même. Nous avons aussi retrouvé 4 inédits. Ginou a commencé à prendre en photos certains tableaux quelle peignait dans les années 1980 puis plus systématiquement à partir des années 2000. Pour compléter cette base iconographique, nous avons repris en photo haute résolution les tableaux en notre possession. Ainsi, pour le moment, nous pouvons présenter sur ce site <strong>249 des 385 tableaux recensés.</strong></p>
<p>Ce site est conçu pour présenter un aperçu de son talent et pour que tout le monde puisse apprécier son &oelig;uvre.</p>

View File

@ -44,7 +44,7 @@
<div class="stat">
<canvas id="photo"></canvas>
<span class="legend-cont"><span class="legend none"></span><span>Pas de photo</span></span>
<span class="legend-cont"><span class="legend none"></span><span>Photo manquante</span></span>
<span class="legend-cont"><span class="legend bad"></span><span>Photo de mauvaise qualité</span></span>
<span class="legend-cont"><span class="legend ok"></span><span>Photo de qualité acceptable</span></span>
<span class="legend-cont"><span class="legend good"></span><span>Photo de bonne qualité</span></span>
@ -70,7 +70,7 @@
<p>Le code source est librement disponible <em>via git</em> en <a href="https://git.n700.ovh/keb/ginou">cliquant ici</a>. Cela signifie qu'il est possible d'obtenir le site en local pour son utilisation personnelle, moyennant quelques connaissances techniques.</p>
<p>Site réalisé par <a href="https://theo.marchal.dev">Théo</a> et Denis Marchal avec la participation de toute la famille. Dernière mise à jour en février 2021.</p>
<p>Site réalisé par <a href="https://theo.marchal.dev">Théo</a> et Denis Marchal avec la participation de toute la famille. Dernière mise à jour en mars 2021.</p>
</article>
</body>
</html>

2
photos

@ -1 +1 @@
Subproject commit 06d11b6b2f872ffb7bfcabf4e098000ff70b24fb
Subproject commit cb8156ed916c95b1f3012ae769434414bcbb134e

View File

@ -12,6 +12,13 @@ function onSubmit() {
return true;
}
function removeFromArray(array, item)
{
index = array.indexOf(item);
if (index > -1)
array.splice(index, 1);
}
jQuery(document).ready(function($)
{
// get URL parameters
@ -25,6 +32,7 @@ jQuery(document).ready(function($)
paramTag = (urlParams.get('tags') == null ? urlParams.getAll('tag') : urlParams.getAll('tags'));
paramPhoto = (urlParams.get('photos') == null ? urlParams.getAll('photo') : urlParams.getAll('photos'));
paramHelp = (urlParams.get('helps') == null ? urlParams.getAll('help') : urlParams.getAll('helps'));
params = { "year": paramYear, "month": paramMonth, "dimension": paramDimension, "genre": paramGenre, "theme": paramTheme, "place": paramPlace, "tag": paramTag, "photo": paramPhoto, "help": paramHelp }
$.getJSON("data.json", function(data)
{
@ -33,21 +41,118 @@ jQuery(document).ready(function($)
/** MENU **/
/**********/
var genres = [];
var themes = [];
var places = [];
var tags = [];
var availableOptions = [];
var selectedOptions = [];
function generateMenu()
// filter data depending of parameters
function filterData(selectedOptions)
{
function CheckItem(name, selectedElements)
{
return function(item)
{
if (selectedElements.length == 0)
return true;
for (elem of selectedElements)
{
if (elem == "all")
return true;
if (item[name] == elem)
return true;
}
return false;
}
}
function CheckTag(item)
{
for (tag of selectedOptions.tags)
{
if (tag == "all")
return true;
if (!item.tags.includes(tag))
return false;
}
return true;
}
function CheckDimension(item)
{
if (selectedOptions.dimensions.length == 0)
return true;
for (dimension of selectedOptions.dimensions)
{
if (dimension == "all")
return true;
if (item.dimension.split("x")[0] == dimension)
return true;
}
return false;
}
data = data.filter(CheckTag);
data = data.filter(CheckDimension);
data = data.filter(CheckItem("year", selectedOptions.years));
data = data.filter(CheckItem("photo", selectedOptions.photos));
data = data.filter(CheckItem("month", selectedOptions.months));
data = data.filter(CheckItem("genre", selectedOptions.genres));
data = data.filter(CheckItem("theme", selectedOptions.themes));
data = data.filter(CheckItem("place", selectedOptions.places));
data = data.filter(CheckItem("help", selectedOptions.helps));
}
// gather data from json to make form
function gatherData()
{
var photos = []; var years = []; var months = []; var genres = [];
var themes = []; var places = []; var tags = []; var dimensions = []; var helps = [];
function makeItem(item, array, displayName, min, max)
{
if (item >= min && item <= max)
{
if (array.indexOf(displayName) === -1)
array.push(displayName);
}
}
for (i of data)
{
if (photos.indexOf(i.photo) === -1 && i.photo != "" && i.photo != "—")
photos.push(i.photo);
if (months.indexOf(i.month) === -1 && i.month != "" && i.month != "—")
months.push(i.month);
if (genres.indexOf(i.genre) === -1 && i.genre != "" && i.genre != "—")
genres.push(i.genre);
if (themes.indexOf(i.theme) === -1 && i.theme != "" && i.theme != "—")
themes.push(i.theme);
if (places.indexOf(i.place) === -1 && i.place != "" && i.place != "—")
places.push(i.place);
if (helps.indexOf(i.help) === -1 && i.help != "" && i.help != "—")
helps.push(i.help);
if (i.year != "" && i.year != "—")
{
makeItem(i.year, years, "50s", 1956, 1959);
makeItem(i.year, years, "60s", 1960, 1969);
makeItem(i.year, years, "70s", 1970, 1979);
makeItem(i.year, years, "80s", 1980, 1989);
makeItem(i.year, years, "90s", 1990, 1999);
makeItem(i.year, years, "00s", 2000, 2009);
makeItem(i.year, years, "10s", 2010, 2016);
}
if (i.dimension != "" && i.dimension != "—")
{
makeItem(i.dimension.split("x")[0], dimensions, "18", 0, 19);
makeItem(i.dimension.split("x")[0], dimensions, "20", 20, 29);
makeItem(i.dimension.split("x")[0], dimensions, "30", 30, 39);
makeItem(i.dimension.split("x")[0], dimensions, "40", 40, 49);
makeItem(i.dimension.split("x")[0], dimensions, "50", 50, 59);
makeItem(i.dimension.split("x")[0], dimensions, "60", 60, 69);
makeItem(i.dimension.split("x")[0], dimensions, "70", 70, 79);
makeItem(i.dimension.split("x")[0], dimensions, "80", 80, 89);
makeItem(i.dimension.split("x")[0], dimensions, "90", 90, 99);
makeItem(i.dimension.split("x")[0], dimensions, "100", 100, 109);
}
if (tags.indexOf(i.tags) === -1 && i.tags != "" && i.tags != "—")
{
splitTags = i.tags.split(", ");
@ -62,145 +167,134 @@ jQuery(document).ready(function($)
genres.sort();
themes.sort();
helps.sort();
places.sort(Intl.Collator().compare);
tags.sort(Intl.Collator().compare);
dimensions.sort(function(a, b) { return a - b; });
var targetMonths = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"];
months.sort(function(a, b) { return targetMonths.indexOf(a) - targetMonths.indexOf(b); });
var targetPhotos = ["none", "bad", "ok", "good"];
photos.sort(function(a, b) { return targetPhotos.indexOf(a) - targetPhotos.indexOf(b); });
for (genre of genres)
return {"photos": photos, "years": years, "months": months, "genres": genres, "themes": themes, "places": places, "tags": tags, "dimensions": dimensions, "helps": helps};
}
// gather data from url to check available options
function gatherURLdata()
{
selectedYears = [];
selectedDimensions = [];
selectedPhotos = params.photo;
if (selectedPhotos.includes("exist"))
{
html = '<span><input type="checkbox" id="' + genre + '" name="genre" value="' + genre + '"></input>\n';
html += '<label for="' + genre + '">' + genre + '</label></span>';
$(".box.genres .item-cont").append(html);
if (selectedPhotos.indexOf("bad") === -1) selectedPhotos.push("bad");
if (selectedPhotos.indexOf("ok") === -1) selectedPhotos.push("ok");
if (selectedPhotos.indexOf("good") === -1) selectedPhotos.push("good");
}
for (theme of themes)
selectedMonths = params.month;
selectedGenres = params.genre;
selectedThemes = params.theme;
selectedPlaces = params.place;
selectedTags = params.tag;
selectedHelps = params.help;
for (p of params.year)
{
html = '<span><input type="checkbox" id="' + theme + '" name="theme" value="' + theme + '"></input>\n';
html += '<label for="' + theme + '">' + theme + '</label></span>';
$(".box.themes .item-cont").append(html);
if (p == "50s") for (i = 1956; i <= 1959; i++) selectedYears.push(i);
if (p == "60s") for (i = 1960; i <= 1969; i++) selectedYears.push(i);
if (p == "70s") for (i = 1970; i <= 1979; i++) selectedYears.push(i);
if (p == "80s") for (i = 1980; i <= 1989; i++) selectedYears.push(i);
if (p == "90s") for (i = 1990; i <= 1999; i++) selectedYears.push(i);
if (p == "00s") for (i = 2000; i <= 2009; i++) selectedYears.push(i);
if (p == "10s") for (i = 2010; i <= 2016; i++) selectedYears.push(i);
}
$(".box.places select").append('<option value="">Aucun</option');
for (place of places)
$(".box.places select").append('<option value="' + place + '">' + place + '</option');
$(".box.tags select").append('<option value="">Aucun</option');
for (tag of tags)
$(".box.tags select").append('<option value="' + tag + '">' + tag + '</option');
function URLGeneration()
for (p of params.dimension)
{
// populate checkboxes depending on URL
function URLcheckBoxSelector(names, name, urlParam)
if (p == "18") for (i = 18; i <= 19; i++) selectedDimensions.push(i);
if (p == "20") for (i = 20; i <= 29; i++) selectedDimensions.push(i);
if (p == "30") for (i = 30; i <= 39; i++) selectedDimensions.push(i);
if (p == "40") for (i = 40; i <= 49; i++) selectedDimensions.push(i);
if (p == "50") for (i = 50; i <= 59; i++) selectedDimensions.push(i);
if (p == "60") for (i = 60; i <= 69; i++) selectedDimensions.push(i);
if (p == "70") for (i = 70; i <= 79; i++) selectedDimensions.push(i);
if (p == "80") for (i = 80; i <= 89; i++) selectedDimensions.push(i);
if (p == "90") for (i = 90; i <= 99; i++) selectedDimensions.push(i);
if (p == "100") for (i = 100; i <= 109; i++) selectedDimensions.push(i);
}
return {"photos": selectedPhotos, "years": selectedYears, "months": selectedMonths, "genres": selectedGenres, "themes": selectedThemes,
"places": selectedPlaces, "tags": selectedTags, "dimensions": selectedDimensions, "helps": selectedHelps};
}
var originalData = data;
var originalAvailableOptions = gatherData();
selectedOptions = gatherURLdata();
filterData(selectedOptions);
// menu initial generation
$.getScript("scripts/explorer_menu.js", function()
{
generateMenu(originalAvailableOptions);
availableOptions = gatherData();
userActionHandle(availableOptions);
URLGeneration(originalAvailableOptions);
updateMenu(availableOptions);
function handleVisualFilterChanges()
{
function makeFilterChanges()
{
if (urlParam == "all")
{
$('input[name="'+names+'"]').prop("checked", true);
$('input[name="'+name+'"]').prop("disabled", true);
$('input[name="'+name+'"]').prop("checked", true);
}
else
{
for (a of urlParam)
{
$('input[id="'+a+'"]').prop("checked", true);
}
}
selectedOptions = gatherURLdata();
data = originalData;
filterData(selectedOptions);
availableOptions = [];
availableOptions = gatherData();
updateMenu(availableOptions);
}
// populate list depending on URL
function URLlistSelector(selector, name, param, names)
// handle tags
function handleTags()
{
if (param.length >= 1)
$(selector + ' select').parent().remove();
for (a of param)
$('input[name="tags"]').change(function()
{
html = '<span><span class="inline">&#x203B;&nbsp;</span><select name="' + name + '">';
html += '<option value="">Aucun</option>';
for (i of names)
params["tag"] = []; // remove filter
if (this.checked)
{
if (i == a)
html += '<option value="' + i + '" selected>' + i + '</option>';
else
html += '<option value="' + i + '">' + i + '</option>';
$('select[name="tag"] option[value=""]').prop('selected', true);
$('select[name="tag"]').attr('disabled', 'disabled');
$(".box.tags span:not(.first) select").parent().remove();
}
html += '</select></span>';
$(selector + ' .item-cont').append(html);
}
if (!param.includes("all") && param.length >= 1)
{
html = '<span><span class="inline">&#x203B;&nbsp;</span><select name="' + name + '">';
html += '<option value="">Aucun</option>';
for (i of names)
html += '<option value="' + i + '">' + i + '</option>';
html += '</select></span>';
$(selector + ' .item-cont').append(html);
}
}
else
$('select[name="tag"]').removeAttr('disabled');
URLcheckBoxSelector("years", "year", paramYear)
URLcheckBoxSelector("months", "month", paramMonth);
URLcheckBoxSelector("dimensions", "dimension", paramDimension);
URLcheckBoxSelector("genres", "genre", paramGenre);
URLcheckBoxSelector("themes", "theme", paramTheme);
URLcheckBoxSelector("places", "place", paramPlace);
URLcheckBoxSelector("tags", "tag", paramTag);
URLcheckBoxSelector("photos", "photo", paramPhoto);
URLcheckBoxSelector("helps", "help", paramHelp);
URLlistSelector(".box.places", "place", paramPlace, places);
URLlistSelector(".box.tags", "tag", paramTag, tags);
// URL 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);
}
}
function userActionHandle()
{
// if "all" is selected, check all other options and disable them
function allCheckBoxSelected(names, name)
{
$('input[id="' + names + '"]').click(function()
{
if ($(this).prop("checked") == true)
{
$('input[name="' + name + '"]').prop("checked", true);
$('input[name="' + name + '"]').prop("disabled", true);
}
else if ($(this).prop("checked") == false)
{
$('input[name="' + name + '"]').prop("checked", false);
$('input[name="' + name + '"]').prop("disabled", false);
}
makeFilterChanges();
});
}
// for places and tags
function listOptionSelected(selector, name, names)
{
$(selector).on('change', 'select[name="' + name + '"]', function()
$('.box.tags .item-cont').delegate('select[name="tag"]', 'change', function()
{
params.tag = []; // collect all tags from all dropdowns
$('.box.tags .item-cont select[name="tag"]').each(function()
{
if (params.tag.indexOf(this.value) === -1 && this.value != "")
params.tag.push(this.value);
});
if (this.value != "")
{
createNewElem = true; // if we modify an existing element to a value, we don't delete it
$(selector + ' select').each(function()
$('.box.tags select').each(function()
{
if ($(this).val() == "")
createNewElem = false;
});
if (createNewElem)
{
html = '<span><span class="inline">&#x203B;&nbsp;</span><select name="' + name + '">';
html += '<option value="">Aucun</option>';
for (a of names)
html = '<span><span class="inline">&#x203B;&nbsp;</span><select name="tag">';
html += '<option value="">Aucun filtre</option>';
for (a of originalAvailableOptions.tags)
html += '<option value="' + a + '">' + a + '</option>';
html += '</select></span>';
$(selector + " .item-cont").append(html);
$(".box.tags .item-cont").append(html);
}
}
else
@ -208,191 +302,93 @@ jQuery(document).ready(function($)
// if the element has no value, we delete it
$(this).parent().remove();
}
makeFilterChanges();
});
}
handleTags();
function visualFilterCheckboxItem(name)
{
$('input[name="' + name + 's"]').change(function()
{
params[name] = []; // remove filter
makeFilterChanges();
});
$('input[name="' + name + '"]').change(function()
{
if (this.checked)
{
if (this.id == "exist") // photos special case
{
params[name].push("bad");
params[name].push("ok");
params[name].push("good");
}
params[name].push(this.id);
}
else
{
if (this.id == "exist") // photos special case
{
removeFromArray(params[name], "bad");
removeFromArray(params[name], "ok");
removeFromArray(params[name], "good");
}
removeFromArray(params[name], this.id);
}
makeFilterChanges();
});
}
$("input").prop("checked", false); // by default, uncheck all options
allCheckBoxSelected("years", "year");
allCheckBoxSelected("months", "month");
allCheckBoxSelected("dimensions", "dimension");
allCheckBoxSelected("genres", "genre");
allCheckBoxSelected("themes", "theme");
allCheckBoxSelected("places", "place");
allCheckBoxSelected("tags", "tag");
allCheckBoxSelected("photos", "photo");
allCheckBoxSelected("helps", "help");
listOptionSelected(".box.places", "place", places);
listOptionSelected(".box.tags", "tag", tags);
// special case for photos with "exist"
$('input[id="exist"]').click(function()
function visualFilterListItem(name)
{
if ($(this).prop("checked") == true)
$('input[name="' + name + 's"]').change(function()
{
$('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);
}
});
}
params[name] = []; // remove filter
if (this.checked)
{
$('select[name="' + name + '"] option[value=""]').prop('selected', true);
$('select[name="' + name + '"]').attr('disabled', 'disabled');
}
else
$('select[name="' + name + '"]').removeAttr('disabled');
// menu configurer show / hide
$("article.explorer h2").click(function()
{
if ($(this).hasClass("active"))
{
$(this).removeClass("active");
$("form").slideUp(200);
makeFilterChanges();
});
$('select[name="' + name + '"]').change(function()
{
if (this.value == "" && name == "place")
params[name].pop();
else
params[name].push(this.value);
makeFilterChanges();
});
}
else
{
$(this).addClass("active");
$("form").slideDown(200);
}
});
// menu configurer child on mobile show/hide
if ($(window).width() <= 600)
{
$("article.explorer .box h3").click(function()
{
if ($(this).parent().hasClass("active"))
{
$(this).parent().removeClass("active");
$(this).parent().children(".item-cont").slideUp(200);
}
else
{
$(this).parent().addClass("active");
$(this).parent().children(".item-cont").slideDown(200);
}
});
visualFilterCheckboxItem("photo");
visualFilterCheckboxItem("year");
visualFilterCheckboxItem("month");
visualFilterCheckboxItem("genre");
visualFilterCheckboxItem("theme");
visualFilterCheckboxItem("dimension");
visualFilterCheckboxItem("help");
visualFilterListItem("place");
}
userActionHandle();
URLGeneration();
}
handleVisualFilterChanges();
});
/*********************/
/** TABLE & GALLERY **/
/*********************/
function checkYear(year)
{
if (paramYear == "all") return true;
if (paramYear.includes("50s") && year >= 1950 && year <= 1959) return true;
if (paramYear.includes("60s") && year >= 1960 && year <= 1969) return true;
if (paramYear.includes("70s") && year >= 1970 && year <= 1979) return true;
if (paramYear.includes("80s") && year >= 1980 && year <= 1989) return true;
if (paramYear.includes("90s") && year >= 1990 && year <= 1999) return true;
if (paramYear.includes("00s") && year >= 2000 && year <= 2009) return true;
if (paramYear.includes("10s") && year >= 2010 && year <= 2020) return true;
return false;
}
function checkMonth(month)
{
if (paramMonth == "all") return true;
if (paramMonth.includes("01") && month == "Janvier") return true;
if (paramMonth.includes("02") && month == "Février") return true;
if (paramMonth.includes("03") && month == "Mars") return true;
if (paramMonth.includes("04") && month == "Avril") return true;
if (paramMonth.includes("05") && month == "Mai") return true;
if (paramMonth.includes("06") && month == "Juin") return true;
if (paramMonth.includes("07") && month == "Juillet") return true;
if (paramMonth.includes("08") && month == "Août") return true;
if (paramMonth.includes("09") && month == "Septembre") return true;
if (paramMonth.includes("10") && month == "Octobre") return true;
if (paramMonth.includes("11") && month == "Novembre") return true;
if (paramMonth.includes("12") && month == "Décembre") return true;
return false;
}
function checkDimension(dimension)
{
if (paramDimension == "all") return true;
if (paramDimension.includes("18") && dimension.split("x")[0] >= 18 && dimension.split("x")[0] <= 19) return true;
if (paramDimension.includes("20") && dimension.split("x")[0] >= 20 && dimension.split("x")[0] <= 29) return true;
if (paramDimension.includes("30") && dimension.split("x")[0] >= 30 && dimension.split("x")[0] <= 39) return true;
if (paramDimension.includes("40") && dimension.split("x")[0] >= 40 && dimension.split("x")[0] <= 49) return true;
if (paramDimension.includes("50") && dimension.split("x")[0] >= 50 && dimension.split("x")[0] <= 59) return true;
if (paramDimension.includes("60") && dimension.split("x")[0] >= 60 && dimension.split("x")[0] <= 69) return true;
if (paramDimension.includes("70") && dimension.split("x")[0] >= 70 && dimension.split("x")[0] <= 79) return true;
if (paramDimension.includes("80") && dimension.split("x")[0] >= 80 && dimension.split("x")[0] <= 89) return true;
if (paramDimension.includes("90") && dimension.split("x")[0] >= 90 && dimension.split("x")[0] <= 99) return true;
if (paramDimension.includes("100") && dimension.split("x")[0] >= 100 && dimension.split("x")[0] <= 109) return true;
return false;
}
function checkGenre(genre)
{
if (paramGenre == "all")
return true;
if (paramGenre.includes(genre))
return true;
return false;
}
function checkTheme(theme)
{
if (paramTheme == "all")
return true;
if (paramTheme.includes(theme))
return true;
return false;
}
function checkPlace(place)
{
if (paramPlace == "all")
return true;
if (paramPlace.includes(place))
return true;
return false;
}
function checkTag(tag)
{
if (paramTag == "all")
return true;
splitTag = tag.split(", ");
for (t of paramTag)
{
if (!splitTag.includes(t))
return false;
}
return true;
}
function checkPhoto(photo)
{
if (paramPhoto == "all") return true;
if (paramPhoto.includes("none") && photo == "none") return true;
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;
}
function checkHelp(help)
{
if (paramHelp == "all") return true;
if (paramHelp.includes("no") && help == "no") return true;
if (paramHelp.includes("yes") && help == "yes") return true;
return false;
}
// gallery vars
var pageSize = 14;
var paintingList = [];
window.pageSize = 14;
window.paintingList = [];
function generateTable()
{
@ -407,17 +403,6 @@ jQuery(document).ready(function($)
else
res = true;
// check URL parameters and compute result
if (paramYear != "") res = res && checkYear(i.year);
if (paramMonth != "") res = res && checkMonth(i.month);
if (paramDimension != "") res = res && checkDimension(i.dimension);
if (paramGenre != "") res = res && checkGenre(i.genre);
if (paramTheme != "") res = res && checkTheme(i.theme);
if (paramPlace != "") res = res && checkPlace(i.place);
if (paramTag != "") res = res && checkTag(i.tags);
if (paramPhoto != "") res = res && checkPhoto(i.photo);
if (paramHelp != "") res = res && checkHelp(i.help);
if (!res)
continue;
@ -461,6 +446,7 @@ jQuery(document).ready(function($)
$("table").append(result);
// gallery
paintingList.push(i.number);
if (paintingList.length % (pageSize + 1) == 0)
@ -469,8 +455,9 @@ jQuery(document).ready(function($)
paintingHtml = '<div class="gallery-item ';
if (canDisplay)
paintingHtml += 'active">';
else
paintingHtml += 'inactive">';
else
paintingHtml += 'inactive">';
if (i.photo == "none")
{
paintingHtml += '<a data-fancybox="exposition" href="images/unknown.jpg" data-fancybox-index="' + i.number + '">'
@ -481,6 +468,7 @@ jQuery(document).ready(function($)
paintingHtml += '<a data-fancybox="exposition" href="photos/paintings/normal/' + i.number + '.jpg" data-fancybox-index="' + i.number + '">'
paintingHtml += '<img src="photos/paintings/mini/" alt="Tableau ' + i.number + '"></a>'
}
paintingHtml += '<span class="item-title">' + i.title;
if (i.year != '—')
paintingHtml += ' (' + i.year + ')';
@ -498,7 +486,6 @@ jQuery(document).ready(function($)
if (urlParams.get('page') != "")
targetPage = urlParams.get('page');
generateMenu();
var res = generateTable();
if (res) // display table or no result depending of computed result
@ -508,70 +495,15 @@ jQuery(document).ready(function($)
$("form").slideUp(200);
$("article.explorer p.result").css("display", "block");
// pagination configuration
window.currentPage = 0;
window.previousArray = []
$.getScript("scripts/pagination.js", function() {
paginationInit(data, paintingList, true);
// pagination
function getPageRange()
{
if (window.innerWidth >= 600)
return 6;
else if (window.innerWidth < 600 && window.innerWidth > 450)
return 4;
else
return 1;
}
var currentPage = 0;
var previousArray = []
var options =
{
dataSource: paintingList,
pageSize: pageSize,
pageRange: getPageRange(),
className: 'paginationjs-theme-ginou',
hideWhenLessThanOnePage: true,
callback: function (response, pagination)
{
currentPage = pagination.pageNumber;
urlParams = new URLSearchParams(window.location.search)
if (urlParams.get('page') == undefined)
{
window.history.replaceState('', '', window.location.pathname + window.location.search + '&page=' + currentPage + window.location.hash);
}
else
{
trimSearch = window.location.search.substr(0, window.location.search.lastIndexOf('&'));
window.history.replaceState('', '', window.location.pathname + trimSearch + '&page=' + currentPage + window.location.hash);
}
if (previousArray.length > 0)
{
for (i of previousArray)
$('[data-fancybox-index="'+i+'"]').parent().removeClass("active").addClass("inactive");
}
previousArray = response;
$.each(response, function(index, item)
{
$('[data-fancybox="exposition"][data-fancybox-index="'+item+'"]').parent().removeClass("inactive").addClass("active");
idx = item-1;
if (item >= 1000)
idx = item - 1000 + 383 - 1; // inédit: index starts at 1000 // 383: total number of paintings except inédit
if (data[idx].photo != "none")
$('[data-fancybox="exposition"][data-fancybox-index="'+item+'"] img').attr("src", "photos/paintings/mini/"+item+".jpg");
else
$('[data-fancybox="exposition"][data-fancybox-index="'+item+'"] img').attr("src", "images/unknown.jpg");
});
}
};
$('#pagination').pagination(options);
if (targetPage > 0)
$("#pagination").pagination('go', targetPage);
if (targetPage > 0)
$("#pagination").pagination('go', targetPage);
});
}
else
{
@ -579,90 +511,10 @@ jQuery(document).ready(function($)
$("article.explorer p.result").css("display", "none");
}
// on mobile, show only the first item slided down
if ($(window).width() <= 600)
{
$("article.explorer .container .box").each(function()
{
if (!$(this).hasClass('active'))
{
$(this).children(".item-cont").slideUp(200);
}
});
}
// change display: gallery/table
$(".style-select.frame").click(function()
{
$("table").hide();
$("#gallery").show();
})
$(".style-select.list").click(function()
{
$("#gallery").hide();
$("table").show();
})
// fancybox configuration
$('[data-fancybox="exposition"], [data-fancybox="exposition-list"]').fancybox(
{
infobar: false,
toolbar: true,
smallBtn: false,
buttons: ["arrowLeft", "arrowRight", "close"],
arrows: false,
transitionEffect: "fade",
baseClass: 'fancybox-custom-layout',
mobile: {
preventCaptionOverlap: true,
},
caption: function(instance, item)
{
var idx = item.opts.fancyboxIndex - 1; // painting number
if (item.opts.fancyboxIndex >= 1000)
idx = item.opts.fancyboxIndex - 1000 + 383 - 1; // inédit: index starts at 1000 // 383: total number of paintings except inédit
function generateCartel()
{
cartel = '<div id="info"><span class="info">';
cartel += '<a href="painting.html?number=' + data[idx].number + '">&#8505;&#xFE0E;</span></a></span>';
cartel += '<span class="title">' + data[idx].title + '</span><span class="year">';
if (data[idx].month != '—')
cartel += data[idx].month + '&nbsp;';
if (data[idx].year != '—')
cartel += data[idx].year;
cartel += '&nbsp;</span><span class="format">' + data[idx].paint + ' sur ' + data[idx].support.toLowerCase();
if (data[idx].dimension != '—')
cartel += ' (' + data[idx].dimension + ')';
cartel += '</span>';
if (data[idx].comment != '—')
cartel += '<span class="comment">' + data[idx].comment + '</span>';
cartel += '</div>';
return cartel;
}
return generateCartel();
},
beforeShow : function(instance, current)
{
if (current.opts.fancyboxIndex > previousArray[previousArray.length - 1])
$('#pagination').pagination('next');
if (current.opts.fancyboxIndex < previousArray[0])
$('#pagination').pagination('previous');
},
afterClose : function(instance)
{
// after closing, changing the URL again. I guess there's no better way except by changing fancybox code...
// (apparently fancybox changes back to the original url it had when starting)
urlParams = new URLSearchParams(window.location.search)
trimSearch = window.location.search.substr(0, window.location.search.lastIndexOf('&'));
window.history.replaceState('', '', window.location.pathname + trimSearch + '&page=' + currentPage + window.location.hash);
}
$.getScript("scripts/fancybox.js", function() {
fancyboxInit(data, true);
});
});
});

350
scripts/explorer_menu.js Normal file
View File

@ -0,0 +1,350 @@
function generateMenu(availableOptions)
{
function createPhotoName(photo)
{
if (photo == "none") return "&#x2606; manquant";
if (photo == "bad") return "&#x2605; mauvais";
if (photo == "ok") return "&#x2605;&#x2605; acceptable";
if (photo == "good") return "&#x2605;&#x2605;&#x2605; bon";
}
function createYearName(year)
{
if (year == "50s") return "1956 - 1959";
if (year == "60s") return "1960 - 1969";
if (year == "70s") return "1970 - 1979";
if (year == "80s") return "1980 - 1989";
if (year == "90s") return "1990 - 1999";
if (year == "00s") return "2000 - 2009";
if (year == "10s") return "2010 - 2016";
}
function createDimensionName(dimension)
{
if (dimension == "18") return "< 20cm";
if (dimension == "20") return "20cm - 29cm";
if (dimension == "30") return "30cm - 39cm";
if (dimension == "40") return "40cm - 49cm";
if (dimension == "50") return "50cm - 59cm";
if (dimension == "60") return "60cm - 69cm";
if (dimension == "70") return "70cm - 79cm";
if (dimension == "80") return "80cm - 89cm";
if (dimension == "90") return "90cm - 99cm";
if (dimension == "100") return ">= 100cm";
}
function createHelpName(photo)
{
if (photo == "yes") return '<img width="5rem" src="styles/icons/exclamation-mark.svg" alt="Oui"> Oui';
if (photo == "no") return "Non";
}
hasExist = false;
for (photo of availableOptions.photos)
{
if (!hasExist && (photo == "bad" || photo == "ok" || photo == "good"))
{
html = '<span><input type="checkbox" id="exist" name="photo" value="exist"></input>\n';
html += '<label for="exist">Disponible</label></span>';
$(".box.photos .item-cont .generated").append(html);
hasExist = true;
}
html = '<span><input type="checkbox" id="' + photo + '" name="photo" value="' + photo + '"></input>\n';
html += '<label for="' + photo + '">' + createPhotoName(photo) + '</label></span>';
$(".box.photos .item-cont .generated").append(html);
}
for (year of availableOptions.years)
{
html = '<span><input type="checkbox" id="' + year + '" name="year" value="' + year + '"></input>\n';
html += '<label for="' + year + '">' + createYearName(year) + '</label></span>';
$(".box.years .item-cont .generated").append(html);
}
for (month of availableOptions.months)
{
html = '<span><input type="checkbox" id="' + month + '" name="month" value="' + month + '"></input>\n';
html += '<label for="' + month + '">' + month + '</label></span>';
$(".box.months .item-cont .generated").append(html);
}
for (genre of availableOptions.genres)
{
html = '<span><input type="checkbox" id="' + genre + '" name="genre" value="' + genre + '"></input>\n';
html += '<label for="' + genre + '">' + genre + '</label></span>';
$(".box.genres .item-cont .generated").append(html);
}
for (theme of availableOptions.themes)
{
html = '<span><input type="checkbox" id="' + theme + '" name="theme" value="' + theme + '"></input>\n';
html += '<label for="' + theme + '">' + theme + '</label></span>';
$(".box.themes .item-cont .generated").append(html);
}
for (dimension of availableOptions.dimensions)
{
html = '<span><input type="checkbox" id="' + dimension + '" name="dimension" value="' + dimension + '"></input>\n';
html += '<label for="' + dimension + '">' + createDimensionName(dimension) + '</label></span>';
$(".box.dimensions .item-cont .generated").append(html);
}
for (help of availableOptions.helps)
{
html = '<span><input type="checkbox" id="' + help + '" name="help" value="' + help + '"></input>\n';
html += '<label for="' + help + '">' + createHelpName(help) + '</label></span>';
$(".box.help .item-cont .generated").append(html);
}
$(".box.places select").append('<option value="">Aucun filtre</option');
for (place of availableOptions.places)
$(".box.places select").append('<option value="' + place + '">' + place + '</option');
$(".box.tags select").append('<option value="">Aucun filtre</option');
for (tag of availableOptions.tags)
$(".box.tags select").append('<option value="' + tag + '">' + tag + '</option');
}
function updateMenu(availableOptions)
{
function checkItem(name, array)
{
$('.' + name + ' .item-cont span input').each(function()
{
if (!array.includes($(this).prop("value")))
{
if ($(this).prop("value") != "all" && $(this).prop("value") != "exist")
$(this).parent().addClass("filter");
if ($(this).prop("value") == "exist") // special case for "exist" in photos
{
if (array.includes("none") && !array.includes("bad") && !array.includes("ok") && !array.includes("good"))
$(this).parent().addClass("filter");
else
$(this).parent().removeClass("filter");
}
}
else
$(this).parent().removeClass("filter");
});
}
function checkListItem(name, array)
{
$('.' + name + ' select option').each(function()
{
if (!array.includes($(this).prop("value")))
{
if ($(this).prop("value") != "")
{
$(this).hide();
$(this).attr('disabled', 'disabled'); // for iOS
}
}
else
{
$(this).show();
$(this).removeAttr('disabled'); // for iOS
}
});
}
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);
checkListItem("places", availableOptions.places);
checkListItem("tags", availableOptions.tags);
}
function URLGeneration(availableOptions)
{
// populate checkboxes depending on URL
function URLcheckBoxSelector(names, name, urlParam)
{
if (urlParam == "all")
{
$('input[name="'+names+'"]').prop("checked", true);
$('input[name="'+name+'"]').prop("disabled", true);
$('input[name="'+name+'"]').prop("checked", true);
}
else
{
for (a of urlParam)
{
$('input[id="'+a+'"]').prop("checked", true);
}
}
}
// populate list depending on URL
function URLlistSelector(selector, name, param, names)
{
if (param.length >= 1)
$(selector + ' select').parent().remove();
for (a of param)
{
html = '<span><span class="inline">&#x203B;&nbsp;</span><select name="' + name + '">';
html += '<option value="">Aucun filtre</option>';
for (i of names)
{
if (i == a)
html += '<option value="' + i + '" selected>' + i + '</option>';
else
html += '<option value="' + i + '">' + i + '</option>';
}
html += '</select></span>';
$(selector + ' .item-cont').append(html);
}
if (!param.includes("all") && param.length >= 1 && name != "place")
{
html = '<span><span class="inline">&#x203B;&nbsp;</span><select name="' + name + '">';
html += '<option value="">Aucun filtre</option>';
for (i of names)
html += '<option value="' + i + '">' + i + '</option>';
html += '</select></span>';
$(selector + ' .item-cont').append(html);
}
}
URLcheckBoxSelector("years", "year", paramYear)
URLcheckBoxSelector("months", "month", paramMonth);
URLcheckBoxSelector("dimensions", "dimension", paramDimension);
URLcheckBoxSelector("genres", "genre", paramGenre);
URLcheckBoxSelector("themes", "theme", paramTheme);
URLcheckBoxSelector("places", "place", paramPlace);
URLcheckBoxSelector("tags", "tag", paramTag);
URLcheckBoxSelector("photos", "photo", paramPhoto);
URLcheckBoxSelector("helps", "help", paramHelp);
URLlistSelector(".box.places", "place", paramPlace, availableOptions.places);
URLlistSelector(".box.tags", "tag", paramTag, availableOptions.tags);
// URL special case for photos with "exist"
if (paramPhoto.includes("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);
}
}
function userActionHandle(availableOptions)
{
// if "all" is selected, check all other options and disable them
function allCheckBoxSelected(names, name)
{
$('input[id="' + names + '"]').click(function()
{
if ($(this).prop("checked") == true)
{
$('input[name="' + name + '"]').prop("checked", true);
$('input[name="' + name + '"]').prop("disabled", true);
}
else if ($(this).prop("checked") == false)
{
$('input[name="' + name + '"]').prop("checked", false);
$('input[name="' + name + '"]').prop("disabled", false);
}
});
}
$("input").prop("checked", false); // by default, uncheck all options
allCheckBoxSelected("years", "year");
allCheckBoxSelected("months", "month");
allCheckBoxSelected("dimensions", "dimension");
allCheckBoxSelected("genres", "genre");
allCheckBoxSelected("themes", "theme");
allCheckBoxSelected("places", "place");
allCheckBoxSelected("tags", "tag");
allCheckBoxSelected("photos", "photo");
allCheckBoxSelected("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()
{
if ($(this).hasClass("active"))
{
$(this).removeClass("active");
$("form").slideUp(200);
}
else
{
$(this).addClass("active");
$("form").slideDown(200);
}
});
// menu configurer child on mobile show/hide
if ($(window).width() <= 600)
{
$("article.explorer .box h3").click(function()
{
if ($(this).parent().hasClass("active"))
{
$(this).parent().removeClass("active");
$(this).parent().children(".item-cont").slideUp(200);
}
else
{
$(this).parent().addClass("active");
$(this).parent().children(".item-cont").slideDown(200);
}
});
}
// on mobile, show only the first item slided down
if ($(window).width() <= 600)
{
$("article.explorer .container .box").each(function()
{
if (!$(this).hasClass('active'))
{
$(this).children(".item-cont").slideUp(200);
}
});
}
// change display: gallery/table
$(".style-select.frame").click(function()
{
$("table").hide();
$("#gallery").show();
});
$(".style-select.list").click(function()
{
$("#gallery").hide();
$("table").show();
});
}

View File

@ -2,7 +2,7 @@ jQuery(document).ready(function($)
{
$.getJSON("data.json", function(data)
{
var pageSize = 14;
window.pageSize = 14;
var paintingList = [];
canDisplay = true;
@ -38,110 +38,19 @@ jQuery(document).ready(function($)
if (urlParams.get('page') != "")
targetPage = urlParams.get('page');
function getPageRange()
{
if (window.innerWidth >= 600)
return null;
else if (window.innerWidth < 600 && window.innerWidth > 450)
return 4;
else
return 1;
}
var currentPage = 0;
var previousArray = []
var options =
{
dataSource: paintingList,
pageSize: pageSize,
pageRange: getPageRange(),
className: 'paginationjs-theme-ginou',
hideWhenLessThanOnePage: true,
callback: function (response, pagination)
{
currentPage = pagination.pageNumber;
window.history.replaceState('', '', window.location.pathname + '?page=' + currentPage + window.location.hash);
// pagination configuration
window.currentPage = 0;
window.previousArray = [];
$.getScript("scripts/pagination.js", function() {
paginationInit(data, paintingList, false);
if (previousArray.length > 0)
{
for (i of previousArray)
$('[data-fancybox-index="'+i+'"]').parent().removeClass("active").addClass("inactive");
}
if (targetPage > 0)
$("#pagination").pagination('go', targetPage);
});
previousArray = response;
$.each(response, function(index, item)
{
$('[data-fancybox-index="'+item+'"]').parent().removeClass("inactive").addClass("active");
$('[data-fancybox-index="'+item+'"] img').attr("src", "photos/paintings/mini/"+item+".jpg");
});
}
};
$('#pagination').pagination(options);
if (targetPage > 0)
$("#pagination").pagination('go', targetPage);
$('[data-fancybox="exposition"]').fancybox(
{
selector: '.gallery a',
infobar: false,
toolbar: true,
smallBtn: false,
buttons: ["arrowLeft", "arrowRight", "close"],
arrows: false,
transitionEffect: "fade",
baseClass: 'fancybox-custom-layout',
mobile: {
preventCaptionOverlap: true,
},
caption: function(instance, item)
{
var idx = item.opts.fancyboxIndex - 1; // painting number
if (item.opts.fancyboxIndex >= 1000)
idx = item.opts.fancyboxIndex - 1000 + 383 - 1; // inédit: index starts at 1000 // 383: total number of paintings except inédit
function generateCartel()
{
cartel = '<div id="info"><span class="info">';
cartel += '<a href="painting.html?number=' + data[idx].number + '">&#8505;&#xFE0E;</span></a></span>';
cartel += '<span class="title">' + data[idx].title + '</span><span class="year">';
if (data[idx].month != '—')
cartel += data[idx].month + '&nbsp;';
if (data[idx].year != '—')
cartel += data[idx].year;
cartel += '&nbsp;</span><span class="format">' + data[idx].paint + ' sur ' + data[idx].support.toLowerCase();
if (data[idx].dimension != '—')
cartel += ' (' + data[idx].dimension + ')';
cartel += '</span>';
if (data[idx].comment != '—')
cartel += '<span class="comment">' + data[idx].comment + '</span>';
cartel += '</div>';
return cartel;
}
return generateCartel();
},
beforeShow : function(instance, current)
{
if (current.opts.fancyboxIndex > previousArray[previousArray.length - 1])
$('#pagination').pagination('next');
if (current.opts.fancyboxIndex < previousArray[0])
$('#pagination').pagination('previous');
},
afterClose : function(instance)
{
// after closing, changing the URL again. I guess there's no better way except by changing fancybox code...
// (apparently fancybox changes back to the original url it had when starting)
window.history.replaceState('', '', window.location.pathname + '?page=' + currentPage + window.location.hash);
}
});
// fancybox configuration
$.getScript("scripts/fancybox.js", function() {
fancyboxInit(data, false);
});
});
});

71
scripts/fancybox.js Normal file
View File

@ -0,0 +1,71 @@
function fancyboxInit(data, explorer)
{
$('[data-fancybox="exposition"], [data-fancybox="exposition-list"]').fancybox(
{
selector: '.gallery a',
infobar: false,
toolbar: true,
smallBtn: false,
buttons: ["arrowLeft", "arrowRight", "close"],
arrows: false,
transitionEffect: "fade",
baseClass: 'fancybox-custom-layout',
mobile: {
preventCaptionOverlap: true,
},
caption: function(instance, item)
{
var idx = 0; // search the index of the painting of filtered data
for (i = 0; i < data.length; i++)
{
if (data[i].number == item.opts.fancyboxIndex)
idx = i;
}
function generateCartel()
{
cartel = '<div id="info"><span class="info">';
cartel += '<a href="painting.html?number=' + data[idx].number + '">&#8505;&#xFE0E;</span></a></span>';
cartel += '<span class="title">' + data[idx].title + '</span><span class="year">';
if (data[idx].month != '—')
cartel += data[idx].month + '&nbsp;';
if (data[idx].year != '—')
cartel += data[idx].year;
cartel += '&nbsp;</span><span class="format">' + data[idx].paint + ' sur ' + data[idx].support.toLowerCase();
if (data[idx].dimension != '—')
cartel += ' (' + data[idx].dimension + ')';
cartel += '</span>';
if (data[idx].comment != '—')
cartel += '<span class="comment">' + data[idx].comment + '</span>';
cartel += '</div>';
return cartel;
}
return generateCartel();
},
beforeShow : function(instance, current)
{
if (current.opts.fancyboxIndex > previousArray[previousArray.length - 1])
$('#pagination').pagination('next');
if (current.opts.fancyboxIndex < previousArray[0])
$('#pagination').pagination('previous');
},
afterClose : function(instance)
{
// after closing, changing the URL again. I guess there's no better way except by changing fancybox code...
// (apparently fancybox changes back to the original url it had when starting)
if (explorer)
{
urlParams = new URLSearchParams(window.location.search)
trimSearch = window.location.search.substr(0, window.location.search.lastIndexOf('&'));
window.history.replaceState('', '', window.location.pathname + trimSearch + '&page=' + currentPage + window.location.hash);
}
else
window.history.replaceState('', '', window.location.pathname + '?page=' + currentPage + window.location.hash);
}
});
}

78
scripts/pagination.js Normal file
View File

@ -0,0 +1,78 @@
function paginationInit(data, paintingList, explorer)
{
function getPageRange()
{
if (window.innerWidth >= 600)
return explorer ? 6 : null;
else if (window.innerWidth < 600 && window.innerWidth > 450)
return 4;
else
return 1;
}
var options =
{
dataSource: paintingList,
pageSize: pageSize,
pageRange: getPageRange(),
className: 'paginationjs-theme-ginou',
hideWhenLessThanOnePage: true,
callback: function (response, pagination)
{
currentPage = pagination.pageNumber;
// url handling
if (explorer)
{
urlParams = new URLSearchParams(window.location.search)
if (urlParams.get('page') == undefined)
{
window.history.replaceState('', '', window.location.pathname + window.location.search + '&page=' + currentPage + window.location.hash);
}
else
{
trimSearch = window.location.search.substr(0, window.location.search.lastIndexOf('&'));
window.history.replaceState('', '', window.location.pathname + trimSearch + '&page=' + currentPage + window.location.hash);
}
}
else
{
window.history.replaceState('', '', window.location.pathname + '?page=' + currentPage + window.location.hash);
}
if (previousArray.length > 0)
{
for (i of previousArray)
$('[data-fancybox-index="'+i+'"]').parent().removeClass("active").addClass("inactive");
}
previousArray = response;
infoArray = []
for (a of response)
{
for (d of data)
{
if (a == d.number)
infoArray.push({"number": d.number, "photo": d.photo});
}
}
$.each(response, function(index, item)
{
for (i of infoArray)
{
if (i.number == item)
{
$('[data-fancybox="exposition"][data-fancybox-index="' + item + '"]').parent().removeClass("inactive").addClass("active");
if (i.photo != "none")
$('[data-fancybox="exposition"][data-fancybox-index="' + item + '"] img').attr("src", "photos/paintings/mini/" + item + ".jpg");
else
$('[data-fancybox="exposition"][data-fancybox-index="' + item + '"] img').attr("src", "images/unknown.jpg");
}
}
});
}
};
$('#pagination').pagination(options);
}

View File

@ -2,14 +2,17 @@ jQuery(document).ready(function($)
{
const urlParams = new URLSearchParams(window.location.search);
const pageId = urlParams.get('number');
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
var idx = 0; // search the index of the painting of filtered data
for (i = 0; i < data.length; i++)
{
if (data[i].number == pageId)
idx = i;
}
if (!data[idx]) // the number specified in URL does not exist
{
$(".container").css("display", "none");
$("#info").css("display", "none");
@ -18,75 +21,75 @@ jQuery(document).ready(function($)
function GetNumber()
{
if (data[i].number > 1000)
if (data[idx].number > 1000)
return "Inédit";
return data[i].number;
return data[idx].number;
}
// page title
$("head title").append(GetNumber());
// photo
if (data[i].photo != "none")
$(".photo img").attr("src", "photos/paintings/normal/" + data[i].number + ".jpg");
if (data[idx].photo != "none")
$(".photo img").attr("src", "photos/paintings/normal/" + data[idx].number + ".jpg");
else
$(".photo img").attr("src", "images/unknown.jpg");
$(".photo img").attr("alt", "Tableau " + data[i].number);
$(".photo img").attr("alt", "Tableau " + data[idx].number);
// metadata
$(".metadata .content.number").append(GetNumber());
if (data[i].month != "—")
$(".metadata .content.date").append(data[i].month + " " + data[i].year);
if (data[idx].month != "—")
$(".metadata .content.date").append(data[idx].month + " " + data[idx].year);
else
$(".metadata .content.date").append(data[i].year);
$(".metadata .content.date").append(data[idx].year);
$(".metadata .content.dimension").append(data[i].dimension);
$(".metadata .content.support").append(data[i].support);
$(".metadata .content.genre").append(data[i].genre);
$(".metadata .content.theme").append(data[i].theme);
$(".metadata .content.place").append(data[i].place);
$(".metadata .content.dimension").append(data[idx].dimension);
$(".metadata .content.support").append(data[idx].support);
$(".metadata .content.genre").append(data[idx].genre);
$(".metadata .content.theme").append(data[idx].theme);
$(".metadata .content.place").append(data[idx].place);
if (data[i].photo == "none") photoState = "aucune";
if (data[i].photo == "bad") photoState = "mauvais";
if (data[i].photo == "ok") photoState = "acceptable";
if (data[i].photo == "good") photoState = "bon";
if (data[idx].photo == "none") photoState = "aucune";
if (data[idx].photo == "bad") photoState = "mauvais";
if (data[idx].photo == "ok") photoState = "acceptable";
if (data[idx].photo == "good") photoState = "bon";
$(".metadata .content.photo").append(photoState);
if (data[i].help == "yes")
if (data[idx].help == "yes")
$(".metadata .content.help").append('<a href="informations.html"><strong>oui (!)</strong></a>');
else
$(".metadata .content.help").append("non");
if (data[i].tags != "—")
$(".metadata .content.tag").append(data[i].tags);
if (data[idx].tags != "—")
$(".metadata .content.tag").append(data[idx].tags);
else
$(".metadata .content.tag").parent().css("display", "none");
if (data[i].comment != "—")
$(".metadata .content.comment").append(data[i].comment);
if (data[idx].comment != "—")
$(".metadata .content.comment").append(data[idx].comment);
else
$(".metadata .content.comment").parent().css("display", "none");
if (data[i].photo != "none")
$(".metadata .content.original a").attr("href", "photos/paintings/original/" + data[i].number + ".jpg");
if (data[idx].photo != "none")
$(".metadata .content.original a").attr("href", "photos/paintings/original/" + data[idx].number + ".jpg");
else
$(".metadata .content.original").parent().css("display", "none");
// cartel
$("#info .title").append(data[i].title);
if (data[i].month != "—")
$("#info .year").append(data[i].month + " " + data[i].year);
$("#info .title").append(data[idx].title);
if (data[idx].month != "—")
$("#info .year").append(data[idx].month + " " + data[idx].year);
else
$("#info .year").append(data[i].year);
$("#info .year").append(data[idx].year);
format = data[i].paint + " sur " + data[i].support.toLowerCase();
format = data[idx].paint + " sur " + data[idx].support.toLowerCase();
if (data[i].dimension != "—")
format += " (" + data[i].dimension + ")";
if (data[idx].dimension != "—")
format += " (" + data[idx].dimension + ")";
$("#info .format").append(format);
if (data[i].comment != "—")
$("#info .comment").prepend(data[i].comment);
if (data[idx].comment != "—")
$("#info .comment").prepend(data[idx].comment);
else
$("#info .comment").css("display", "none");
});

View File

@ -80,10 +80,10 @@ jQuery(document).ready(function($)
var chartDimension = new Chart(canvasDimension, {
type: 'bar',
data: {
labels: ["Allégorique", "Animal domestique", "Animalier", "Campagne", "Forêt", "Marine", "Montagne", "Métier", "Personne", "Urbain", "Végétal"],
labels: ["Histoire", "Nature morte", "Paysage", "Portrait", "Scène"],
datasets: [{
label: 'nombre de tableaux',
data: [2, 11, 67, 126, 3, 10, 5, 10, 46, 39, 39],
data: [2, 42, 173, 59, 107],
backgroundColor: '#2589BD',
borderColor: '#187795',
borderWidth: 1

View File

@ -208,6 +208,23 @@ article.main p.signature {
}
article.main .bio-img {
float:right;
padding:1rem;
padding-top:0.25rem;
padding-right:0;
max-width:25vw;
}
@media only screen and (max-width:1200px) {
article.main .bio-img {
float:none;
padding:0;
max-width:90vw;
}
}
/* Exposition */
article #pagination {
@ -495,25 +512,51 @@ article.explorer form .inline {
margin:0.1rem;
}
.button-cont {
margin:auto;
margin-top:1.5rem;
display:flex;
justify-content:center;
align-items:flex-end;
width:-moz-fit-content;
width:fit-content;
}
article.explorer input[type = submit] {
display:block;
margin:auto;
text-align:center;
border:none;
padding:0.8rem;
margin-top:1.5rem;
border-radius:5%;
background:#2589BD;
text-decoration:none;
font-size:1.1rem;
cursor:pointer;
color:white;
margin-right:1rem;
}
article.explorer input[type = button] {
margin:auto;
text-align:center;
border:none;
padding:0.4rem;
border-radius:5%;
background:grey;
text-decoration:none;
font-size:1.1rem;
cursor:pointer;
color:white;
}
input:checked + label {
font-weight:bold;
}
.item-cont span.filter {
color:gray;
}
@media only screen and (max-width:600px) {
article.explorer form .container {
display:block;