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
|
||||
- [/] deal with window size
|
||||
|
||||
- la carte ne s'affiche pas sur les pages
|
||||
- infowindow enlever scroll border
|
||||
- zoom sur cluster problem
|
||||
- enlever ordre alphabetique categories
|
||||
- reduire espace checkboxs
|
||||
- reduire hauteur du select menu
|
||||
- [/] la carte ne s'affiche pas sur les pages
|
||||
- [ ] zoom sur cluster problem
|
||||
- [ ] filtes sur chrome
|
||||
- [ ] infowindow new design et enlever scroll border
|
||||
- [ ] enlever ordre alphabetique categories
|
||||
- [ ] reduire espace checkboxs
|
||||
- [ ] reduire hauteur du select menu
|
||||
|
||||
#### verifications:
|
||||
- api only for this site on fabien's google account
|
||||
|
||||
@@ -103,24 +103,21 @@ function mp_ljdp_map() {
|
||||
*/
|
||||
|
||||
$events = mp_get_published_events();
|
||||
mp_console_log("php events:");
|
||||
mp_console_log($events);
|
||||
//mp_console_log("php events:");
|
||||
//mp_console_log($events);
|
||||
|
||||
$locations = mp_sort_events($events);
|
||||
mp_console_log("php locations:");
|
||||
mp_console_log($locations);
|
||||
//mp_console_log("php locations:");
|
||||
//mp_console_log($locations);
|
||||
|
||||
$filters = mp_get_filters($events);
|
||||
mp_console_log("php filters:");
|
||||
mp_console_log($filters);
|
||||
|
||||
$to_add = array(
|
||||
"locations" => $locations,
|
||||
"filters" => $filters,
|
||||
);
|
||||
//mp_console_log("php filters:");
|
||||
//mp_console_log($filters);
|
||||
|
||||
// if post event instead of map page, change ccoordinate and zoom
|
||||
global $mp_zoom;
|
||||
global $mp_zoom_set;
|
||||
global $mp_coordinates_default;
|
||||
if (is_event_post()) {
|
||||
$mp_zoom = $mp_zoom_set[1];
|
||||
|
||||
@@ -130,6 +127,11 @@ function mp_ljdp_map() {
|
||||
$mp_coordinates_default = $coordinates;
|
||||
}
|
||||
|
||||
$to_add = array(
|
||||
"locations" => $locations,
|
||||
"filters" => $filters,
|
||||
);
|
||||
|
||||
mp_add_to_scripts($to_add);
|
||||
|
||||
|
||||
|
||||
@@ -2,25 +2,24 @@
|
||||
|
||||
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 = '
|
||||
<select
|
||||
form="ljdp_form"
|
||||
class="filter_menu filter_menu_drop"
|
||||
onchange="filter_show_only_selection(this, '.json_encode(array()).', '."'".$key."'".')"
|
||||
>
|
||||
<option
|
||||
selected
|
||||
onclick="filter_show_only_selection(this, '.json_encode(array()).', '."'".$key."'".')"
|
||||
>
|
||||
'.$key.'
|
||||
</option>
|
||||
<option selected>'.$key.'</option>
|
||||
';
|
||||
foreach ($filter as $value) {
|
||||
$content .= '
|
||||
<option
|
||||
onclick="filter_show_only_selection(this, '.json_encode($value->indexes).', '."'".$key."'".')"
|
||||
>
|
||||
'.$value->_name.'
|
||||
</option>
|
||||
<option title="'.json_encode($value->indexes).'">'.$value->_name.'</option>
|
||||
';
|
||||
}
|
||||
$content .= '
|
||||
|
||||
@@ -33,7 +33,6 @@ function mp_get_coordinates($id) {
|
||||
// extract coordinates from json
|
||||
// https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types
|
||||
$content = json_decode($jsoncontent);
|
||||
mp_console_log($content);
|
||||
$location->coordinates = $content->results[0]->geometry->location;
|
||||
$location->address = $content->results[0]->formatted_address;
|
||||
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) {
|
||||
$coordinates = $event->location->coordinates;
|
||||
mp_console_log("1");
|
||||
if ($coordinates == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -77,12 +77,9 @@ function filter_selection_indexes(menu, indexes, reverse, add) {
|
||||
function is_element_unchecked(element) {
|
||||
if (typeof(element) === "undefined")
|
||||
return false;
|
||||
if (typeof(element.attributes) === "undefined")
|
||||
if (typeof(element.type) === "undefined")
|
||||
return false;
|
||||
if (typeof(element.attributes.type) === "undefined")
|
||||
return false;
|
||||
value = element.attributes.type.value;
|
||||
if (value === "checkbox") {
|
||||
if (element.type === "checkbox") {
|
||||
return ! element.checked;
|
||||
}
|
||||
return false;
|
||||
@@ -96,6 +93,17 @@ function is_element_unchecked(element) {
|
||||
|
||||
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 index_array = filter_selection_indexes(menu, indexes, reverse, add);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
@media only screen and (max-width: 700px) {
|
||||
#ljdp_map {
|
||||
height: 500px;
|
||||
height: 400px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
}
|
||||
#ljdp_map_filters .filter_menu {
|
||||
display: flex !important;
|
||||
flex-direction: column;
|
||||
width: auto;
|
||||
cursor: pointer;
|
||||
border-radius: 3px;
|
||||
@@ -131,6 +130,8 @@
|
||||
@media only screen and (max-width: 700px) {
|
||||
#ljdp_map_filters {
|
||||
flex-wrap: wrap;
|
||||
margin: 10px;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user