// jQuery & GMap based stuff for getting the Author Location from a profile page jQuery( document ).ready( get_gmaps_location_ready ); function get_gmaps_location_ready() { al_show_map(); } function al_show_map() { new_location = false; // Add in the div to hold the map jQuery( '#al_your_location h3' ).after( '
' ); // Add an explanation jQuery( '#al_map' ).before( 'Your current location (if any is set) is shown below as a grey marker. Please drag and zoom around to find your new location on the map below, and click to set it.
' ); // Hide the latitude and longitude jQuery( '#al_your_location .al_lat_long' ).hide(); // Add in the actual GMap map = new GMap2( document.getElementById( 'al_map' ), {draggableCursor: 'crosshair'} ); map.setMapType(G_HYBRID_MAP); // Hybrid map, better for bits of the world without roads map.addControl( new GLargeMapControl() ); // Full pan/zoom controls map.addControl( new GMapTypeControl() ); // Switch between road/satellite and hybrid var author_location = al_get_author_location(); // Current location icon // Like the default (same shadow, etc), but with a custom icon image var currentLocationIcon = new GIcon( G_DEFAULT_ICON, al_plugin_path + '/images/marker-grey.png' ); // Centre the map on the author (if they've entered values) if ( author_location ) { map.setCenter( author_location, 9 ); var current_location = new GMarker( author_location, {icon: currentLocationIcon, draggable: false} ); map.addOverlay( current_location ); current_location.openInfoWindowHtml( "You are (currently) here." ); // Otherwise London } else { map.setCenter( new GLatLng( 51.5, 0 ), 9 ); } GEvent.addListener( map, 'click', al_set_new_location); // If the user previously clicked, and the map has been thrown back for validation, // then we need to show that click on the map. var entered_lon = jQuery( '#al_longitude' ).val(); var entered_lat = jQuery( '#al_latitude' ).val(); if ( author_location && entered_lat != author_location.lat() && entered_lon != author_location.lng() ) { new_location = new GMarker( new GLatLng( entered_lat, entered_lon ), {draggable: false} ); map.addOverlay( new_location ); new_location.openInfoWindowHtml( "