1function kayaking_googlemap_init(dom_obj, coords) { 2 "use strict"; 3 if (typeof KAYAKING_STORAGE['googlemap_init_obj'] == 'undefined') kayaking_googlemap_init_styles(); 4 KAYAKING_STORAGE['googlemap_init_obj'].geocoder = ''; 5 try { 6 var id = dom_obj.id; 7 KAYAKING_STORAGE['googlemap_init_obj'][id] = { 8 dom: dom_obj, 9 markers: coords.markers, 10 geocoder_request: false, 11 opt: { 12 zoom: coords.zoom, 13 center: null, 14 scrollwheel: false, 15 scaleControl: false, 16 disableDefaultUI: false, 17 panControl: true, 18 zoomControl: true, //zoom 19 mapTypeControl: false, 20 streetViewControl: false, 21 overviewMapControl: false, 22 styles: KAYAKING_STORAGE['googlemap_styles'][coords.style ? coords.style : 'default'], 23 mapTypeId: google.maps.MapTypeId.ROADMAP 24 } 25 }; 26 27 kayaking_googlemap_create(id); 28 29 } catch (e) {}; 30} 31 32function kayaking_googlemap_create(id) { 33 "use strict"; 34 35 // Create map 36 KAYAKING_STORAGE['googlemap_init_obj'][id].map = new google.maps.Map(KAYAKING_STORAGE['googlemap_init_obj'][id].dom, KAYAKING_STORAGE['googlemap_init_obj'][id].opt); 37 38 // Add markers 39 for (var i in KAYAKING_STORAGE['googlemap_init_obj'][id].markers) 40 KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].inited = false; 41 kayaking_googlemap_add_markers(id); 42 43 // Add resize listener 44 jQuery(window).resize(function() { 45 if (KAYAKING_STORAGE['googlemap_init_obj'][id].map) 46 KAYAKING_STORAGE['googlemap_init_obj'][id].map.setCenter(KAYAKING_STORAGE['googlemap_init_obj'][id].opt.center); 47 }); 48} 49 50function kayaking_googlemap_add_markers(id) { 51 "use strict"; 52 for (var i in KAYAKING_STORAGE['googlemap_init_obj'][id].markers) { 53 54 if (KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].inited) continue; 55 56 if (KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].latlng == '') { 57 58 if (KAYAKING_STORAGE['googlemap_init_obj'][id].geocoder_request!==false) continue; 59 60 if (KAYAKING_STORAGE['googlemap_init_obj'].geocoder == '') KAYAKING_STORAGE['googlemap_init_obj'].geocoder = new google.maps.Geocoder(); 61 KAYAKING_STORAGE['googlemap_init_obj'][id].geocoder_request = i; 62 KAYAKING_STORAGE['googlemap_init_obj'].geocoder.geocode({address: KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].address}, function(results, status) { 63 "use strict"; 64 if (status == google.maps.GeocoderStatus.OK) { 65 var idx = KAYAKING_STORAGE['googlemap_init_obj'][id].geocoder_request; 66 if (results[0].geometry.location.lat && results[0].geometry.location.lng) { 67 KAYAKING_STORAGE['googlemap_init_obj'][id].markers[idx].latlng = '' + results[0].geometry.location.lat() + ',' + results[0].geometry.location.lng(); 68 } else { 69 KAYAKING_STORAGE['googlemap_init_obj'][id].markers[idx].latlng = results[0].geometry.location.toString().replace(/\(\)/g, ''); 70 } 71 KAYAKING_STORAGE['googlemap_init_obj'][id].geocoder_request = false; 72 setTimeout(function() { 73 kayaking_googlemap_add_markers(id); 74 }, 200); 75 } else 76 dcl(KAYAKING_STORAGE['strings']['geocode_error'] + ' ' + status); 77 }); 78 79 } else { 80 81 // Prepare marker object 82 var latlngStr = KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].latlng.split(','); 83 var markerInit = { 84 map: KAYAKING_STORAGE['googlemap_init_obj'][id].map, 85 position: new google.maps.LatLng(latlngStr[0], latlngStr[1]), 86 clickable: KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].description!='' 87 }; 88 if (KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].point) markerInit.icon = KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].point; 89 if (KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].title) markerInit.title = KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].title; 90 KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].marker = new google.maps.Marker(markerInit); 91 92 // Set Map center 93 if (KAYAKING_STORAGE['googlemap_init_obj'][id].opt.center == null) { 94 KAYAKING_STORAGE['googlemap_init_obj'][id].opt.center = markerInit.position; 95 KAYAKING_STORAGE['googlemap_init_obj'][id].map.setCenter(KAYAKING_STORAGE['googlemap_init_obj'][id].opt.center); 96 } 97 98 // Add description window 99 if (KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].description!='') { 100 KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].infowindow = new google.maps.InfoWindow({ 101 content: KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].description 102 }); 103 google.maps.event.addListener(KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].marker, "click", function(e) { 104 var latlng = e.latLng.toString().replace("(", '').replace(")", "").replace(" ", ""); 105 for (var i in KAYAKING_STORAGE['googlemap_init_obj'][id].markers) { 106 if (latlng == KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].latlng) { 107 KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].infowindow.open( 108 KAYAKING_STORAGE['googlemap_init_obj'][id].map, 109 KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].marker 110 ); 111 break; 112 } 113 } 114 }); 115 } 116 117 KAYAKING_STORAGE['googlemap_init_obj'][id].markers[i].inited = true; 118 } 119 } 120} 121 122function kayaking_googlemap_refresh(id) { 123 "use strict"; 124 for (id in KAYAKING_STORAGE['googlemap_init_obj']) { 125 kayaking_googlemap_create(id); 126 } 127} 128 129function kayaking_googlemap_init_styles() { 130 "use strict"; 131 // Init Google map 132 KAYAKING_STORAGE['googlemap_init_obj'] = {}; 133 KAYAKING_STORAGE['googlemap_styles'] = { 134 'default': [] 135 }; 136 if (window.kayaking_theme_googlemap_styles!==undefined) 137 KAYAKING_STORAGE['googlemap_styles'] = kayaking_theme_googlemap_styles(KAYAKING_STORAGE['googlemap_styles']);
138}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.