Fix "Tous" not filtering visually in explorer
This commit is contained in:
parent
44a5f52e94
commit
3fe24e502e
@ -32,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)
|
||||
{
|
||||
@ -183,14 +184,14 @@ jQuery(document).ready(function($)
|
||||
{
|
||||
selectedYears = [];
|
||||
selectedDimensions = [];
|
||||
selectedPhotos = paramPhoto;
|
||||
selectedMonths = paramMonth;
|
||||
selectedGenres = paramGenre;
|
||||
selectedThemes = paramTheme;
|
||||
selectedPlaces = paramPlace;
|
||||
selectedTags = paramTag;
|
||||
selectedHelps = paramHelp;
|
||||
for (p of paramYear)
|
||||
selectedPhotos = params.photo;
|
||||
selectedMonths = params.month;
|
||||
selectedGenres = params.genre;
|
||||
selectedThemes = params.theme;
|
||||
selectedPlaces = params.place;
|
||||
selectedTags = params.tag;
|
||||
selectedHelps = params.help;
|
||||
for (p of params.year)
|
||||
{
|
||||
if (p == "50s") for (i = 1956; i <= 1959; i++) selectedYears.push(i);
|
||||
if (p == "60s") for (i = 1960; i <= 1969; i++) selectedYears.push(i);
|
||||
@ -200,7 +201,7 @@ jQuery(document).ready(function($)
|
||||
if (p == "00s") for (i = 2000; i <= 2009; i++) selectedYears.push(i);
|
||||
if (p == "10s") for (i = 2010; i <= 2016; i++) selectedYears.push(i);
|
||||
}
|
||||
for (p of paramDimension)
|
||||
for (p of params.dimension)
|
||||
{
|
||||
if (p == "18") for (i = 18; i <= 19; i++) selectedDimensions.push(i);
|
||||
if (p == "20") for (i = 20; i <= 29; i++) selectedDimensions.push(i);
|
||||
@ -279,29 +280,45 @@ jQuery(document).ready(function($)
|
||||
}
|
||||
handleTags();
|
||||
|
||||
function visualFilterCheckboxItem(name, param)
|
||||
function visualFilterCheckboxItem(name)
|
||||
{
|
||||
$('input[name="' + name + 's"]').change(function()
|
||||
{
|
||||
// set back array with original available
|
||||
if (this.checked)
|
||||
params[name] = originalAvailableOptions[name + "s"];
|
||||
else
|
||||
params[name] = []
|
||||
|
||||
selectedOptions = gatherURLdata();
|
||||
data = originalData;
|
||||
filterData(selectedOptions);
|
||||
availableOptions = [];
|
||||
availableOptions = gatherData();
|
||||
updateMenu(availableOptions);
|
||||
});
|
||||
|
||||
$('input[name="' + name + '"]').change(function()
|
||||
{
|
||||
if (this.checked)
|
||||
{
|
||||
if (this.id == "exist") // photos special case
|
||||
{
|
||||
param.push("bad");
|
||||
param.push("ok");
|
||||
param.push("good");
|
||||
params[name].push("bad");
|
||||
params[name].push("ok");
|
||||
params[name].push("good");
|
||||
}
|
||||
param.push(this.id);
|
||||
params[name].push(this.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.id == "exist") // photos special case
|
||||
{
|
||||
removeFromArray(param, "bad");
|
||||
removeFromArray(param, "ok");
|
||||
removeFromArray(param, "good");
|
||||
removeFromArray(params[name], "bad");
|
||||
removeFromArray(params[name], "ok");
|
||||
removeFromArray(params[name], "good");
|
||||
}
|
||||
removeFromArray(param, this.id);
|
||||
removeFromArray(params[name], this.id);
|
||||
}
|
||||
|
||||
selectedOptions = gatherURLdata();
|
||||
@ -331,14 +348,13 @@ jQuery(document).ready(function($)
|
||||
});
|
||||
}
|
||||
|
||||
visualFilterCheckboxItem("photo", paramPhoto);
|
||||
visualFilterCheckboxItem("year", paramYear);
|
||||
visualFilterCheckboxItem("month", paramMonth);
|
||||
visualFilterCheckboxItem("genre", paramGenre);
|
||||
visualFilterCheckboxItem("theme", paramTheme);
|
||||
visualFilterCheckboxItem("dimension", paramDimension);
|
||||
visualFilterCheckboxItem("help", paramHelp);
|
||||
|
||||
visualFilterCheckboxItem("photo");
|
||||
visualFilterCheckboxItem("year");
|
||||
visualFilterCheckboxItem("month");
|
||||
visualFilterCheckboxItem("genre");
|
||||
visualFilterCheckboxItem("theme");
|
||||
visualFilterCheckboxItem("dimension");
|
||||
visualFilterCheckboxItem("help");
|
||||
visualFilterListItem("place", paramPlace);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user