-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Put the javascript files into the Media class.
In this way is avoid the multiple inclusion of the Google API javascript file.
- Loading branch information
Showing
4 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// will contain the boundary of the map. | ||
var g_lat_long_bound = new google.maps.LatLngBounds(); | ||
|
||
function easy_map_add_listener(id, marker) { | ||
// update the coordinate on marker dragging | ||
google.maps.event.addListener(marker, 'dragend', function(evt) { | ||
var ll = marker.getPosition(); | ||
// FIXME: fix id names | ||
document.getElementById(id + 'latitude').value = ll.lat(); | ||
document.getElementById(id + 'longitude').value = ll.lng(); | ||
}); | ||
} | ||
|
||
function easy_maps_add_marker(map, marker) { | ||
var latlng = new google.maps.LatLng(marker.latitude, marker.longitude); | ||
var marker = new google.maps.Marker({ | ||
position: latlng, | ||
map: map, | ||
draggable: true, | ||
title: marker.address | ||
}); | ||
|
||
// add marker's coordinate to the boundary | ||
g_lat_long_bound.extend(latlng); | ||
|
||
return marker; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters