File tree Expand file tree Collapse file tree 4 files changed +15
-9
lines changed Expand file tree Collapse file tree 4 files changed +15
-9
lines changed Original file line number Diff line number Diff line change 1+ # v1.0.2
2+ ## 27/05/2016
3+
4+ 1 . [ ] ( #improved )
5+ * implemented Google Maps asynchronous loading
6+
17# v0.1.0
28## 05/09/2016
39
Original file line number Diff line number Diff line change 11name : Google Maps
2- version : 1.0.0
2+ version : 1.0.2
33description : Google Maps plugin for Grav
4- icon : code
4+ icon : map-marker
55author :
66 name : Salvatore Guarino
77 email : sg@deved.it
Original file line number Diff line number Diff line change 1- jQuery ( document ) . ready ( function ( ) {
1+ function initMap ( ) {
22 var $mapDivs = $ ( '.google-map' ) ;
33 $mapDivs . each ( function ( index ) {
4- var lat = $ ( this ) . data ( 'lat' ) ;
5- var lng = $ ( this ) . data ( 'lng' ) ;
4+ var lat = parseFloat ( $ ( this ) . data ( 'lat' ) ) ;
5+ var lng = parseFloat ( $ ( this ) . data ( 'lng' ) ) ;
66 var zoom = $ ( this ) . data ( 'zoom' ) ;
77 var window = $ ( this ) . data ( 'infowindow' ) ;
88 var map = new google . maps . Map ( this , {
@@ -29,4 +29,4 @@ jQuery(document).ready(function () {
2929 infowindow . open ( map , marker ) ;
3030 }
3131 } ) ;
32- } ) ;
32+ }
Original file line number Diff line number Diff line change @@ -11,11 +11,11 @@ public function init()
1111 {
1212 $ apikey = $ this ->grav ['config ' ]->get ('plugins.google-maps.google_api_key ' );
1313 $ apikeystring = ($ apikey ) ? "?key= $ apikey " : "" ;
14+
1415 $ this ->shortcode ->getHandlers ()->add ('google-maps ' , function (ShortcodeInterface $ sc ) use ($ apikeystring ) {
15-
1616 //add assets
17- $ this ->shortcode ->addAssets ('js ' , 'https ://maps.googleapis.com/maps/api/ js ' . $ apikeystring );
18- $ this ->shortcode ->addAssets ('js ' , 'plugin ://google- maps/js/google- maps.js ' );
17+ $ this ->shortcode ->addAssets ('asyncJs ' , 'plugin ://google- maps/js/google-maps. js ' );
18+ $ this ->shortcode ->addAssets ('asyncJs ' , 'https ://maps.googleapis.com/ maps/api/js ' . $ apikeystring . ' &callback=initMap ' );
1919 $ hash = $ this ->shortcode ->getId ($ sc );
2020 $ infowindow = $ sc ->getContent ();
2121
You can’t perform that action at this time.
0 commit comments