forked from RoboxOrg/kodamaps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix] Can use addr attribute when type is notuse.
- Loading branch information
Tomoka Baba
committed
Apr 22, 2015
1 parent
46c81fa
commit cd287fd
Showing
2 changed files
with
72 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,40 @@ | ||
initialize = -> | ||
jQuery(document).find('[id^=map_canvas]').each -> | ||
postInfo = window['kodamaps_posts_'+jQuery(@).attr('id').replace('map_canvas_','')] | ||
initLat = if postInfo.centerLat? then postInfo.centerLat else 31.773827 | ||
initLng = if postInfo.centerLng? then postInfo.centerLng else 130.7518837 | ||
initLat = if postInfo.centerLat? and postInfo.centerLat isnt '' then parseFloat postInfo.centerLat,10 else 0 | ||
initLng = if postInfo.centerLng? and postInfo.centerLng isnt '' then parseFloat postInfo.centerLng,10 else 0 | ||
initZoom = if postInfo.zoom? and postInfo.zoom isnt '' then parseInt postInfo.zoom,10 else 10 | ||
address = if postInfo.centerAddr? and postInfo.centerAddr isnt '' then postInfo.centerAddr else '' | ||
|
||
opt = | ||
zoom: initZoom | ||
center: new google.maps.LatLng initLat,initLng | ||
mapTypeid: google.maps.MapTypeId.ROADMAP | ||
if address isnt '' | ||
_this = @ | ||
geocoder = new google.maps.Geocoder() | ||
geocoder.geocode 'address': address, | ||
(results,status) -> | ||
if status is google.maps.GeocoderStatus.OK | ||
initLat = results[0].geometry.location.k | ||
initLng = results[0].geometry.location.D | ||
opt = | ||
zoom: initZoom | ||
center: new google.maps.LatLng initLat,initLng | ||
mapTypeid: google.maps.MapTypeId.ROADMAP | ||
map = new google.maps.Map _this,opt | ||
marker = new google.maps.Marker | ||
position: new google.maps.LatLng initLat,initLng | ||
map: map | ||
map.panTo new google.maps.LatLng initLat,initLng | ||
else | ||
opt = | ||
zoom: initZoom | ||
center: new google.maps.LatLng initLat,initLng | ||
mapTypeid: google.maps.MapTypeId.ROADMAP | ||
map = new google.maps.Map @,opt | ||
marker = new google.maps.Marker | ||
position: new google.maps.LatLng initLat,initLng | ||
map: map | ||
map.panTo new google.maps.LatLng initLat,initLng | ||
|
||
map = new google.maps.Map @,opt | ||
marker = new google.maps.Marker | ||
position: new google.maps.LatLng initLat,initLng | ||
map: map | ||
map.panTo new google.maps.LatLng initLat,initLng | ||
return | ||
return | ||
return #each | ||
return #initialize | ||
|
||
window.onload = initialize |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.