Marc
Forum Replies Created
-
Forum: Plugins
In reply to: [Where I Was, Where I Will Be] Problem on adding local and shortcodeSorry for spamming, but my message didn’t show. I thought it was caused by the code block. But suddenly they are there…
Forum: Plugins
In reply to: [Where I Was, Where I Will Be] Problem on adding local and shortcodeHi,
I’ve changed assets/js/maps.js to the following:
https://gist.github.com/MGHollander/6a1bdf9046043f284037Regards,
MarcForum: Plugins
In reply to: [Where I Was, Where I Will Be] Problem on adding local and shortcodeHi Mauro,
I’ve changed assets/js/maps.js the code below.
//Show Map by Address function show_map(id, div, lat, lng) { var geocoder; var map; geocoder = new google.maps.Geocoder(); get_info = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(lat, lng); var mapOptions = { zoom: 12, center: latlng } map = new google.maps.Map(document.getElementById(div), mapOptions); jQuery('#' + div).addClass('wiw_map_local'); code_address(map, id, geocoder, get_info); } //Get info from Address function code_address(map, id, geocoder, get_info) { var address = document.getElementById('get_info' + id).value; var error_msg = wiw_vars.wiw_google_maps_error; geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location, draggable: true, }); google.maps.event.addListener(marker, 'dragend', function(event) { var latlng = new google.maps.LatLng(event.latLng.lat(), event.latLng.lng()); get_info.geocode({'latLng': latlng}, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { show_marker_info(id, results); } else { alert(error_msg + ': ' + status); } }); }); show_marker_info(id, results); } else { alert(error_msg + ': ' + status); } }); } function show_flag(div, flag, style) { jQuery('#'+div).html('<img src="'+wiw_vars.wiw_dir_images+'/flags/' + flag + '.png" class="' + style + '" onerror="imgError(this);">'); } // Show info on Form function show_marker_info(id, results) { var found_city = 0; var found_country = 0; for (var i = 0; i < results[0].address_components.length; i++) { for (var n = 0;n < results[0].address_components[i].types.length; n++) { if ((results[0].address_components[i].types[n] == "locality") && (found_city == 0)){ var city = results[0].address_components[i]; found_city = 1; } if ((results[0].address_components[i].types[n] == "country") && (found_country == 0)) { var country = results[0].address_components[i]; found_country = 1; } if ((found_city == 1) && (found_country == 1)) { break; } } } jQuery('#latitude' + id).val(results[0].geometry.location.lat()); jQuery('#longitude' + id).val(results[0].geometry.location.lng()); if (city !== undefined) jQuery('#city' + id).val(city.long_name); else jQuery('#city' + id).val(''); if (country !== undefined) { jQuery('#country' + id).val(country.long_name); jQuery('#flag' + id).val(country.short_name.toLowerCase()); show_flag('show_flag' + id, country.short_name.toLowerCase(), 'flag_preview'); } else { jQuery('#country' + id).val(''); jQuery('#flag' + id).val(''); } } //Auto Complete function auto_complete(input_id, lat, lng) { var complete; var bounds = new google.maps.LatLngBounds(new google.maps.LatLng(lat, lng),new google.maps.LatLng(lat, lng)); complete = new google.maps.places.Autocomplete((document.getElementById(input_id)),{ types: ['geocode'] }); complete.setBounds(bounds); }
Forum: Plugins
In reply to: [Where I Was, Where I Will Be] Problem on adding local and shortcodeHi Mauro,
I’ve changed assets/js/maps.js the code below.
//Show Map by Address function show_map(id, div, lat, lng) { var geocoder; var map; geocoder = new google.maps.Geocoder(); get_info = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(lat, lng); var mapOptions = { zoom: 12, center: latlng } map = new google.maps.Map(document.getElementById(div), mapOptions); jQuery('#' + div).addClass('wiw_map_local'); code_address(map, id, geocoder, get_info); } //Get info from Address function code_address(map, id, geocoder, get_info) { var address = document.getElementById('get_info' + id).value; var error_msg = wiw_vars.wiw_google_maps_error; geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location, draggable: true, }); google.maps.event.addListener(marker, 'dragend', function(event) { var latlng = new google.maps.LatLng(event.latLng.lat(), event.latLng.lng()); get_info.geocode({'latLng': latlng}, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { show_marker_info(id, results); } else { alert(error_msg + ': ' + status); } }); }); show_marker_info(id, results); } else { alert(error_msg + ': ' + status); } }); } function show_flag(div, flag, style) { jQuery('#'+div).html('<img src="'+wiw_vars.wiw_dir_images+'/flags/' + flag + '.png" class="' + style + '" onerror="imgError(this);">'); } // Show info on Form function show_marker_info(id, results) { var found_city = 0; var found_country = 0; for (var i = 0; i < results[0].address_components.length; i++) { for (var n = 0;n < results[0].address_components[i].types.length; n++) { if ((results[0].address_components[i].types[n] == "locality") && (found_city == 0)){ var city = results[0].address_components[i]; found_city = 1; } if ((results[0].address_components[i].types[n] == "country") && (found_country == 0)) { var country = results[0].address_components[i]; found_country = 1; } if ((found_city == 1) && (found_country == 1)) { break; } } } jQuery('#latitude' + id).val(results[0].geometry.location.lat()); jQuery('#longitude' + id).val(results[0].geometry.location.lng()); if (city !== undefined) jQuery('#city' + id).val(city.long_name); else jQuery('#city' + id).val(''); if (country !== undefined) { jQuery('#country' + id).val(country.long_name); jQuery('#flag' + id).val(country.short_name.toLowerCase()); show_flag('show_flag' + id, country.short_name.toLowerCase(), 'flag_preview'); } else { jQuery('#country' + id).val(''); jQuery('#flag' + id).val(''); } } //Auto Complete function auto_complete(input_id, lat, lng) { var complete; var bounds = new google.maps.LatLngBounds(new google.maps.LatLng(lat, lng),new google.maps.LatLng(lat, lng)); complete = new google.maps.places.Autocomplete((document.getElementById(input_id)),{ types: ['geocode'] }); complete.setBounds(bounds); }
Forum: Plugins
In reply to: [Where I Was, Where I Will Be] Problem on adding local and shortcodeHi Mauro,
I am using a slightly modified version of twentyfiftheen.
See https://marcenelsopreis.nl/
I fixed the ZERO_RESULTS error myself in the meantime. Because your plugin is the best in it’s kind if you ask me.
Forum: Plugins
In reply to: [CM Maps Routes Manager] Error on adding routeI found the problem in the Countdown Widget plugin.
Forum: Plugins
In reply to: [CM Maps Routes Manager] Error on adding routeSorry.
It comes from somewhere else, but it didn’t bother me because error_reporting was off.
It gives an error because the add route page cannot have output before loading.
I’ll try to find a solution.