workaround because chrome doesn't support onclick in select options
This commit is contained in:
13
README.md
13
README.md
@@ -27,12 +27,13 @@
|
|||||||
- [ ] change appearance of filter according to other filters
|
- [ ] change appearance of filter according to other filters
|
||||||
- [/] deal with window size
|
- [/] deal with window size
|
||||||
|
|
||||||
- la carte ne s'affiche pas sur les pages
|
- [/] la carte ne s'affiche pas sur les pages
|
||||||
- infowindow enlever scroll border
|
- [ ] zoom sur cluster problem
|
||||||
- zoom sur cluster problem
|
- [ ] filtes sur chrome
|
||||||
- enlever ordre alphabetique categories
|
- [ ] infowindow new design et enlever scroll border
|
||||||
- reduire espace checkboxs
|
- [ ] enlever ordre alphabetique categories
|
||||||
- reduire hauteur du select menu
|
- [ ] reduire espace checkboxs
|
||||||
|
- [ ] reduire hauteur du select menu
|
||||||
|
|
||||||
#### verifications:
|
#### verifications:
|
||||||
- api only for this site on fabien's google account
|
- api only for this site on fabien's google account
|
||||||
|
|||||||
@@ -103,24 +103,21 @@ function mp_ljdp_map() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$events = mp_get_published_events();
|
$events = mp_get_published_events();
|
||||||
mp_console_log("php events:");
|
//mp_console_log("php events:");
|
||||||
mp_console_log($events);
|
//mp_console_log($events);
|
||||||
|
|
||||||
$locations = mp_sort_events($events);
|
$locations = mp_sort_events($events);
|
||||||
mp_console_log("php locations:");
|
//mp_console_log("php locations:");
|
||||||
mp_console_log($locations);
|
//mp_console_log($locations);
|
||||||
|
|
||||||
$filters = mp_get_filters($events);
|
$filters = mp_get_filters($events);
|
||||||
mp_console_log("php filters:");
|
//mp_console_log("php filters:");
|
||||||
mp_console_log($filters);
|
//mp_console_log($filters);
|
||||||
|
|
||||||
$to_add = array(
|
|
||||||
"locations" => $locations,
|
|
||||||
"filters" => $filters,
|
|
||||||
);
|
|
||||||
|
|
||||||
// if post event instead of map page, change ccoordinate and zoom
|
// if post event instead of map page, change ccoordinate and zoom
|
||||||
global $mp_zoom;
|
global $mp_zoom;
|
||||||
|
global $mp_zoom_set;
|
||||||
|
global $mp_coordinates_default;
|
||||||
if (is_event_post()) {
|
if (is_event_post()) {
|
||||||
$mp_zoom = $mp_zoom_set[1];
|
$mp_zoom = $mp_zoom_set[1];
|
||||||
|
|
||||||
@@ -130,6 +127,11 @@ function mp_ljdp_map() {
|
|||||||
$mp_coordinates_default = $coordinates;
|
$mp_coordinates_default = $coordinates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$to_add = array(
|
||||||
|
"locations" => $locations,
|
||||||
|
"filters" => $filters,
|
||||||
|
);
|
||||||
|
|
||||||
mp_add_to_scripts($to_add);
|
mp_add_to_scripts($to_add);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,25 +2,24 @@
|
|||||||
|
|
||||||
function mp_filter_drop_down($key, &$filter) {
|
function mp_filter_drop_down($key, &$filter) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
onfocusin="filter_show_only_selection(this, '.json_encode($value->indexes).', '."'".$key."'".')"
|
||||||
|
onclick="filter_show_only_selection(this, '.json_encode($value->indexes).', '."'".$key."'".')"
|
||||||
|
onfocus="filter_show_only_selection(this, '.json_encode($value->indexes).', '."'".$key."'".')"
|
||||||
|
onclick="filter_show_only_selection(this, '.json_encode(array()).', '."'".$key."'".')"
|
||||||
|
onchange="filter_show_only_selection(this, '.json_encode($value->indexes).', '."'".$key."'".')"
|
||||||
|
*/
|
||||||
$content = '
|
$content = '
|
||||||
<select
|
<select
|
||||||
form="ljdp_form"
|
form="ljdp_form"
|
||||||
class="filter_menu filter_menu_drop"
|
class="filter_menu filter_menu_drop"
|
||||||
|
onchange="filter_show_only_selection(this, '.json_encode(array()).', '."'".$key."'".')"
|
||||||
>
|
>
|
||||||
<option
|
<option selected>'.$key.'</option>
|
||||||
selected
|
|
||||||
onclick="filter_show_only_selection(this, '.json_encode(array()).', '."'".$key."'".')"
|
|
||||||
>
|
|
||||||
'.$key.'
|
|
||||||
</option>
|
|
||||||
';
|
';
|
||||||
foreach ($filter as $value) {
|
foreach ($filter as $value) {
|
||||||
$content .= '
|
$content .= '
|
||||||
<option
|
<option title="'.json_encode($value->indexes).'">'.$value->_name.'</option>
|
||||||
onclick="filter_show_only_selection(this, '.json_encode($value->indexes).', '."'".$key."'".')"
|
|
||||||
>
|
|
||||||
'.$value->_name.'
|
|
||||||
</option>
|
|
||||||
';
|
';
|
||||||
}
|
}
|
||||||
$content .= '
|
$content .= '
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ function mp_get_coordinates($id) {
|
|||||||
// extract coordinates from json
|
// extract coordinates from json
|
||||||
// https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types
|
// https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types
|
||||||
$content = json_decode($jsoncontent);
|
$content = json_decode($jsoncontent);
|
||||||
mp_console_log($content);
|
|
||||||
$location->coordinates = $content->results[0]->geometry->location;
|
$location->coordinates = $content->results[0]->geometry->location;
|
||||||
$location->address = $content->results[0]->formatted_address;
|
$location->address = $content->results[0]->formatted_address;
|
||||||
foreach ($content->results[0]->address_components as $component) {
|
foreach ($content->results[0]->address_components as $component) {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ function mp_coord_already_exist(&$coordinates, &$locations) {
|
|||||||
|
|
||||||
function mp_sort_n_insert(&$event, &$locations) {
|
function mp_sort_n_insert(&$event, &$locations) {
|
||||||
$coordinates = $event->location->coordinates;
|
$coordinates = $event->location->coordinates;
|
||||||
mp_console_log("1");
|
|
||||||
if ($coordinates == null)
|
if ($coordinates == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -77,12 +77,9 @@ function filter_selection_indexes(menu, indexes, reverse, add) {
|
|||||||
function is_element_unchecked(element) {
|
function is_element_unchecked(element) {
|
||||||
if (typeof(element) === "undefined")
|
if (typeof(element) === "undefined")
|
||||||
return false;
|
return false;
|
||||||
if (typeof(element.attributes) === "undefined")
|
if (typeof(element.type) === "undefined")
|
||||||
return false;
|
return false;
|
||||||
if (typeof(element.attributes.type) === "undefined")
|
if (element.type === "checkbox") {
|
||||||
return false;
|
|
||||||
value = element.attributes.type.value;
|
|
||||||
if (value === "checkbox") {
|
|
||||||
return ! element.checked;
|
return ! element.checked;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -96,6 +93,17 @@ function is_element_unchecked(element) {
|
|||||||
|
|
||||||
function filter_show_only_selection(element, indexes, menu, add = false, zoom_in = true) {
|
function filter_show_only_selection(element, indexes, menu, add = false, zoom_in = true) {
|
||||||
|
|
||||||
|
// temp solution because we can't actually put onclick event inside select options
|
||||||
|
// on chrome, so I have to recover the indexes another way
|
||||||
|
if (element.type == "select-one") {
|
||||||
|
if (element.value == menu)
|
||||||
|
indexes = [];
|
||||||
|
else {
|
||||||
|
indexes = element.children[element.selectedIndex].title;
|
||||||
|
indexes = JSON.parse(indexes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let reverse = is_element_unchecked(element);
|
let reverse = is_element_unchecked(element);
|
||||||
|
|
||||||
let index_array = filter_selection_indexes(menu, indexes, reverse, add);
|
let index_array = filter_selection_indexes(menu, indexes, reverse, add);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
@media only screen and (max-width: 700px) {
|
@media only screen and (max-width: 700px) {
|
||||||
#ljdp_map {
|
#ljdp_map {
|
||||||
height: 500px;
|
height: 400px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
}
|
}
|
||||||
#ljdp_map_filters .filter_menu {
|
#ljdp_map_filters .filter_menu {
|
||||||
display: flex !important;
|
display: flex !important;
|
||||||
flex-direction: column;
|
|
||||||
width: auto;
|
width: auto;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
@@ -131,6 +130,8 @@
|
|||||||
@media only screen and (max-width: 700px) {
|
@media only screen and (max-width: 700px) {
|
||||||
#ljdp_map_filters {
|
#ljdp_map_filters {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
margin: 10px;
|
||||||
|
width: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user