to reload

This commit is contained in:
lenovo
2022-11-13 15:46:34 +01:00
parent 4397b4376e
commit 6e67fb8c05
3 changed files with 56 additions and 24 deletions

View File

@@ -22,7 +22,7 @@ function mp_filter_drop_down($key, &$filter) {
<p id="'.$value->_name.'" onfocusout="filter_show_only_selection('.json_encode($value->indexes).')">'.$value->_name.'</p> <p id="'.$value->_name.'" onfocusout="filter_show_only_selection('.json_encode($value->indexes).')">'.$value->_name.'</p>
*/ */
$content .= ' $content .= '
<p id="'.$value->_name. '" onclick="filter_show_only_selection('.json_encode($value->indexes).')">'.$value->_name.'</p> <p id="'.$value->_name. '" onclick="filter_show_only_selection(this, '.json_encode($value->indexes).')">'.$value->_name.'</p>
'; ';
} }
$content .= ' $content .= '
@@ -37,19 +37,17 @@ function mp_filter_buttons($key, &$filter) {
// <p onclick="filter_show_all()">TOUT DESELECTIONNER</p> // <p onclick="filter_show_all()">TOUT DESELECTIONNER</p>
$content = ' $content = '';
<div class="filter_menu filter_menu_buttons" style="display:none;">
';
foreach ($filter as $value) { foreach ($filter as $value) {
$content .= ' $content .= '
<div class="filter_menu_title filter_menu_buttons_title" tabindex=0> <input id="checkbox_'.$value->_name.'" class="filter_menu_checkbox" type="checkbox" style="display:none;" onclick="filter_show_only_selection(this, '.json_encode($value->indexes).')">
<p id="'.$value->_name.'" onclick="filter_show_only_selection('.json_encode($value->indexes).')">'.$value->_name.'</p> <label for="checkbox_'.$value->_name.'" class="filter_menu_checkbox filter_menu">
</div> <div class="filter_menu_title filter_menu_checkbox_title" tabindex=0>
<p>'.$value->_name.'</p>
</div>
</label>
'; ';
} }
$content .= '
</div>
';
return $content; return $content;
}; };
@@ -69,8 +67,8 @@ function mp_create_div(&$filters) {
}; };
$mp_map_div .= ' $mp_map_div .= '
<div class="filter_menu filter_menu_reset"> <div class="filter_menu filter_menu_button">
<div class="filter_menu_title filter_menu_reset_title"> <div class="filter_menu_title filter_menu_button_title">
<p onclick="filter_show_all()">sans filtre</p> <p onclick="filter_show_all()">sans filtre</p>
</div> </div>
</div> </div>

View File

@@ -8,7 +8,7 @@
* return intersection of both arrays : indexes and g_indexes * return intersection of both arrays : indexes and g_indexes
*/ */
function filter_selection_indexes(indexes) { function filter_selection_indexes(indexes, invert) {
// if g_indexes empty, just fill it with indexes // if g_indexes empty, just fill it with indexes
// because it's like intersection of indexes and g_indexes if g_indexes was the list of all markers // because it's like intersection of indexes and g_indexes if g_indexes was the list of all markers
if (g_indexes.length == 0) { if (g_indexes.length == 0) {
@@ -34,9 +34,24 @@ function filter_selection_indexes(indexes) {
* even if already visible in current view * even if already visible in current view
*/ */
function filter_show_only_selection(indexes, zoom_in = false) { function filter_show_only_selection(element, indexes, zoom_in = false) {
//console.log("element:");
//console.log(element);
//console.log("element.checked:");
//console.log(element.checked);
//console.log("element.attributes.type:");
//console.log(element.attributes.type);
//console.log("element.attributes.type.value:");
//console.log(element.attributes.type.value);
filter_selection_indexes(indexes); let type = element.attributes.type;
let invert = false;
if (type != null)
type = type.value;
if (type === "checkbox")
invert = true;
// if checkbox is unchecked, re-add filters
filter_selection_indexes(indexes, invert);
let indexes_count = g_indexes.length; let indexes_count = g_indexes.length;
if (indexes_count === 0) if (indexes_count === 0)

View File

@@ -16,6 +16,8 @@
position: relative; position: relative;
width: 100%; width: 100%;
z-index: 1; z-index: 1;
gap: 10px;
margin-bottom: 10px;
} }
/* /*
@@ -28,16 +30,27 @@
width: 100%; width: 100%;
overflow: visible; overflow: visible;
cursor: pointer; cursor: pointer;
}
#ljdp_map_filters .filter_menu_title {
border: 1px solid #ba197a; border: 1px solid #ba197a;
} }
#ljdp_map_filters .filter_menu_title p { #ljdp_map_filters .filter_menu * {
cursor: pointer;
}
#ljdp_map_filters .filter_menu_title {
width: 100%;
padding: 5px; padding: 5px;
} }
#ljdp_map_filters .filter_menu_title p {
/* display inline-block for text-align to work */
display: inline-block;
width: 100%;
text-align: center;
}
/* ************************************** /* **************************************
DROP DOWN MENU DROP DOWN MENU
@@ -57,7 +70,6 @@
left: 0px; left: 0px;
max-height: 400px; max-height: 400px;
width: 100%; width: 100%;
cursor: pointer;
overflow: scroll; overflow: scroll;
background-color: #ffffff; background-color: #ffffff;
@@ -99,26 +111,33 @@
/* ************************************** /* **************************************
MENU BUTTONS MENU CHECKBOX
*/ */
/* /*
*/ */
#ljdp_map_filters label.filter_menu_checkbox {
border-radius: 20px;
}
#ljdp_map_filters .filter_menu_buttons { #ljdp_map_filters input.filter_menu_checkbox:checked + label.filter_menu_checkbox {
flex-direction: row; color: #ffffff;
background-color: #ba197a;
} }
/* ************************************** /* **************************************
MENU RESET MENU BUTTON
*/ */
/* /*
*/ */
#ljdp_map_filters .filter_menu_button {
flex-shrink: 2;
white-space: nowrap;
}