Since: 3.0.9.2
File: includes/wp-geo.php, includes/maps.php
Param: $content JavaScript to output.
Param: $gmap JavaScript reference to a GMap2 object.

The wpgeo_map_js_preoverlays filter can be used to write extra javaScript for a map. You could add extra event listeners of map controls and overlays.

The example below demonstrates adding a new click event to a map.

Make sure you add your JavaScript to any existing content.

Example

function my_wpgeo_map_js_preoverlays( $content, $gmap ) {
	$js .='
		GEvent.addListener(' . $gmap . ', "click", function(overlay, latlng) {
			alert("Map clicked");
		});';
	// Make sure you add the JavaScript to the existing content
	return $content . $js;
}
add_filter( 'wpgeo_map_js_preoverlays', 'my_wpgeo_map_js_preoverlays', 10, 2 );