Clean up organisation and comments

This commit is contained in:
2021-03-03 09:56:26 +01:00
parent 10dea8e993
commit dae17821ad
3 changed files with 74 additions and 204 deletions

View File

@ -41,9 +41,6 @@ jQuery(document).ready(function($)
/**********/
var availableOptions = [];
/*var selectedPhotos = []; var selectedYears = []; var selectedMonths = []; var selectedGenres = [];
var selectedThemes = []; var selectedPlaces = []; var selectedTags = []; var selectedDimensions = []; var selectedHelps = [];*/
var selectedOptions = [];
// filter data depending of parameters
@ -91,18 +88,6 @@ jQuery(document).ready(function($)
}
return false;
}
// change "exist" with the associeted value ; this needs to be done here (!), after visual menu generation
/*for (photo of selectedOptions.photos)
{
if (photo == "exist")
{
//removeFromArray(selectedOptions.photos, photo);
selectedOptions.photos.push("bad");
selectedOptions.photos.push("ok");
selectedOptions.photos.push("good");
}
}*/
data = data.filter(CheckTag);
data = data.filter(CheckDimension);
@ -228,9 +213,9 @@ jQuery(document).ready(function($)
if (p == "90") for (i = 90; i <= 99; i++) selectedDimensions.push(i);
if (p == "100") for (i = 100; i <= 109; i++) selectedDimensions.push(i);
}
// special case of a multi selector
if (selectedPhotos.includes("exist"))
{
//removeFromArray(selectedOptions.photos, photo);
selectedPhotos.push("bad");
selectedPhotos.push("ok");
selectedPhotos.push("good");
@ -243,59 +228,15 @@ jQuery(document).ready(function($)
var originalAvailableOptions = gatherData();
selectedOptions = gatherURLdata();
filterData(selectedOptions);
availableOptions = gatherData();
// menu initial generation
$.getScript("scripts/explorer_menu.js", function() {
$.getScript("scripts/explorer_menu.js", function()
{
generateMenu(originalAvailableOptions);
selectedOptions = gatherURLdata();
data = originalData;
console.log("gather url data", selectedOptions);
filterData(selectedOptions);
//availableOptions = [];
availableOptions = gatherData();
updateMenu(availableOptions);
// 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);
}
});
}
userActionHandle(availableOptions);
URLGeneration(availableOptions);
@ -304,15 +245,10 @@ jQuery(document).ready(function($)
$('input[name="' + name + '"]').change(function()
{
if (this.checked)
{
console.log("checked");
param.push(this.id);
}
else
{
console.log("unchecked");
removeFromArray(param, this.id);
}
selectedOptions = gatherURLdata();
data = originalData;
filterData(selectedOptions);
@ -336,8 +272,6 @@ jQuery(document).ready(function($)
filterData(selectedOptions);
availableOptions = [];
availableOptions = gatherData();
console.log("select", selectedOptions);
console.log("avail", availableOptions);
updateMenu(availableOptions);
});
}
@ -352,26 +286,6 @@ jQuery(document).ready(function($)
visualFilterListItem("place", paramPlace);
visualFilterListItem("tag", paramTag);
/*$('input[id="exist"]').click(function()
{
if (this.checked)
{
console.log("exsit checked");
paramPhoto.push(this.id);
paramPhoto.push("bad");
paramPhoto.push("ok");
paramPhoto.push("good");
}
else
{
console.log("exist unchecked");
removeFromArray(paramPhoto, this.id);
removeFromArray(paramPhoto, "bad");
removeFromArray(paramPhoto, "ok");
removeFromArray(paramPhoto, "good");
}
});*/
});
/*********************/
@ -438,6 +352,7 @@ jQuery(document).ready(function($)
$("table").append(result);
// gallery
paintingList.push(i.number);
if (paintingList.length % (pageSize + 1) == 0)
@ -477,14 +392,13 @@ 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
{
$(".style-select").show();
$("article.explorer h2").removeClass("active")
//$("form").slideUp(200);
$("form").slideUp(200);
$("article.explorer p.result").css("display", "block");
// pagination configuration
@ -503,29 +417,6 @@ 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
$.getScript("scripts/fancybox.js", function() {