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

View File

@@ -8,7 +8,7 @@
* 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
// because it's like intersection of indexes and g_indexes if g_indexes was the list of all markers
if (g_indexes.length == 0) {
@@ -34,9 +34,24 @@ function filter_selection_indexes(indexes) {
* 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;
if (indexes_count === 0)

View File

@@ -16,6 +16,8 @@
position: relative;
width: 100%;
z-index: 1;
gap: 10px;
margin-bottom: 10px;
}
/*
@@ -28,16 +30,27 @@
width: 100%;
overflow: visible;
cursor: pointer;
}
#ljdp_map_filters .filter_menu_title {
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;
}
#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
@@ -57,7 +70,6 @@
left: 0px;
max-height: 400px;
width: 100%;
cursor: pointer;
overflow: scroll;
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 {
flex-direction: row;
#ljdp_map_filters input.filter_menu_checkbox:checked + label.filter_menu_checkbox {
color: #ffffff;
background-color: #ba197a;
}
/* **************************************
MENU RESET
MENU BUTTON
*/
/*
*/
#ljdp_map_filters .filter_menu_button {
flex-shrink: 2;
white-space: nowrap;
}