Total Complexity | 5 |
Complexity/F | 1.67 |
Lines of Code | 36 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | jQuery(document).ready(function() { |
||
2 | if( typeof wpapi_gmaps !== 'undefined' ){ |
||
|
|||
3 | google.maps.event.addDomListener(window, 'load', initialize_map ); |
||
4 | } |
||
5 | }); |
||
6 | |||
7 | // Initialize map |
||
8 | function initialize_map() { |
||
9 | wpapi_gmaps.forEach(function(single_gmap, index){ |
||
10 | var mapCanvas = document.getElementById('wpapi-gmap-' + index); |
||
11 | var myLatLng = new google.maps.LatLng( single_gmap.lat , single_gmap.lng ); |
||
12 | var map_style = JSON.parse(single_gmap.style); |
||
13 | var map_zoom = single_gmap.scrollwheel ? false : true; |
||
14 | |||
15 | var mapOptions = { |
||
16 | center: myLatLng, |
||
17 | zoom: Number(single_gmap.zoom), |
||
18 | scrollwheel: map_zoom, |
||
19 | mapTypeId: google.maps.MapTypeId.ROADMAP, |
||
20 | styles: map_style |
||
21 | } |
||
22 | |||
23 | var marker = new google.maps.Marker({ |
||
24 | position: myLatLng |
||
25 | }); |
||
26 | |||
27 | var infoContent = single_gmap.info; |
||
28 | var infowindow = new google.maps.InfoWindow({ |
||
29 | content: infoContent |
||
30 | }); |
||
31 | |||
32 | var map = new google.maps.Map(mapCanvas, mapOptions); |
||
33 | marker.setMap(map); |
||
34 | infowindow.open(map, marker); |
||
35 | }); |
||
36 | } |
||
37 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.