Clean up organisation and comments
This commit is contained in:
@ -1,7 +1,5 @@
|
||||
function generateMenu(availableOptions)
|
||||
{
|
||||
console.log("generate menu", availableOptions);
|
||||
|
||||
function createPhotoName(photo)
|
||||
{
|
||||
if (photo == "none") return "☆ inexistant";
|
||||
@ -100,20 +98,16 @@ function generateMenu(availableOptions)
|
||||
|
||||
$(".box.places select").append('<option value="">Aucun</option');
|
||||
for (place of availableOptions.places)
|
||||
{
|
||||
//console.log(place);
|
||||
$(".box.places select").append('<option value="' + place + '">' + place + '</option');
|
||||
}
|
||||
|
||||
$(".box.tags select").append('<option value="">Aucun</option');
|
||||
for (tag of availableOptions.tags)
|
||||
$(".box.tags select").append('<option value="' + tag + '">' + tag + '</option');
|
||||
}
|
||||
|
||||
|
||||
function updateMenu(availableOptions)
|
||||
{
|
||||
console.log("updateMenu", availableOptions);
|
||||
|
||||
function checkItem(name, array)
|
||||
{
|
||||
$('.' + name + ' .item-cont span input').each(function()
|
||||
@ -149,10 +143,7 @@ function updateMenu(availableOptions)
|
||||
$(this).hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("show");
|
||||
$(this).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -234,7 +225,6 @@ function URLGeneration(availableOptions)
|
||||
// URL special case for photos with "exist"
|
||||
if (paramPhoto.includes("exist"))
|
||||
{
|
||||
console.log("paramPhoto!!!", paramPhoto);
|
||||
$('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);
|
||||
@ -242,6 +232,7 @@ function URLGeneration(availableOptions)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function userActionHandle(availableOptions)
|
||||
{
|
||||
// if "all" is selected, check all other options and disable them
|
||||
@ -262,7 +253,7 @@ function userActionHandle(availableOptions)
|
||||
});
|
||||
}
|
||||
|
||||
// for places and tags
|
||||
// for tags
|
||||
function listOptionSelected(selector, name, names)
|
||||
{
|
||||
$(selector).on('change', 'select[name="' + name + '"]', function()
|
||||
@ -303,7 +294,6 @@ function userActionHandle(availableOptions)
|
||||
allCheckBoxSelected("tags", "tag");
|
||||
allCheckBoxSelected("photos", "photo");
|
||||
allCheckBoxSelected("helps", "help");
|
||||
//listOptionSelected(".box.places", "place", availableOptions.places);
|
||||
listOptionSelected(".box.tags", "tag", availableOptions.tags);
|
||||
|
||||
// special case for photos with "exist"
|
||||
@ -322,4 +312,69 @@ function userActionHandle(availableOptions)
|
||||
$('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();
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user