1(function($) { 2 3 "use strict"; 4 5/* -------------------------------------------- 6Google Map 7-------------------------------------------- */ 8window.onload = MapLoadScript; 9function GmapInit() { 10 var Gmap = $('.map-canvas'); 11 Gmap.each(function() { 12 var $this = $(this), 13 lat = '', 14 lng = '', 15 zoom = 12, 16 scrollwheel = false, 17 zoomcontrol = true, 18 draggable = true, 19 mapType = google.maps.MapTypeId.ROADMAP, 20 title = '', 21 contentString = '', 22 theme_icon_path = $this.data('icon-path'), 23 dataLat = $this.data('lat'), 24 dataLng = $this.data('lng'), 25 dataZoom = $this.data('zoom'), 26 dataType = $this.data('type'), 27 dataScrollwheel = $this.data('scrollwheel'), 28 dataZoomcontrol = $this.data('zoomcontrol'), 29 dataHue = $this.data('hue'), 30 dataTitle = $this.data('title'), 31 dataContent = $this.data('content'); 32 33 if( dataZoom !== undefined && dataZoom !== false ) { 34 zoom = parseFloat(dataZoom); 35 } 36 if( dataLat !== undefined && dataLat !== false ) { 37 lat = parseFloat(dataLat); 38 } 39 if( dataLng !== undefined && dataLng !== false ) { 40 lng = parseFloat(dataLng); 41 } 42 if( dataScrollwheel !== undefined && dataScrollwheel !== null ) { 43 scrollwheel = dataScrollwheel; 44 } 45 if( dataZoomcontrol !== undefined && dataZoomcontrol !== null ) { 46 zoomcontrol = dataZoomcontrol; 47 } 48 if( dataType !== undefined && dataType !== false ) { 49 if( dataType == 'satellite' ) { 50 mapType = google.maps.MapTypeId.SATELLITE; 51 } else if( dataType == 'hybrid' ) { 52 mapType = google.maps.MapTypeId.HYBRID; 53 } else if( dataType == 'terrain' ) { 54 mapType = google.maps.MapTypeId.TERRAIN; 55 } 56 } 57 if( dataTitle !== undefined && dataTitle !== false ) { 58 title = dataTitle; 59 } 60 if( navigator.userAgent.match(/iPad|iPhone|Android/i) ) { 61 draggable = false; 62 } 63 64 var mapOptions = { 65 zoom : zoom, 66 scrollwheel : scrollwheel, 67 zoomControl : zoomcontrol, 68 draggable : draggable, 69 center : new google.maps.LatLng(lat, lng), 70 mapTypeId : mapType 71 }; 72 var map = new google.maps.Map($this[0], mapOptions); 73 74 var image = theme_icon_path; 75 76 if( dataContent !== undefined && dataContent !== false ) { 77 contentString = '<div class="map-data">' + '<h6>' + title + '</h6>' + '<div class="map-content">' + dataContent + '</div>' + '</div>'; 78 } 79 var infowindow = new google.maps.InfoWindow({ 80 content: contentString 81 }); 82 83 var marker = new google.maps.Marker({ 84 position : new google.maps.LatLng(lat, lng), 85 map : map, 86 icon : image, 87 title : title 88 }); 89 if( dataContent !== undefined && dataContent !== false ) { 90 google.maps.event.addListener(marker, 'click', function() { 91 infowindow.open(map,marker); 92 }); 93 } 94 95 if( dataHue !== undefined && dataHue !== false ) { 96 var styles = [ 97 { 98 "featureType": "all", 99 "elementType": "labels.text.fill", 100 "stylers": [ 101 { 102 "saturation": 36 103 }, 104 { 105 "color": "#000000" 106 }, 107 { 108 "lightness": 40 109 } 110 ] 111 }, 112 { 113 "featureType": "all", 114 "elementType": "labels.text.stroke", 115 "stylers": [ 116 { 117 "visibility": "on" 118 }, 119 { 120 "color": "#000000" 121 }, 122 { 123 "lightness": 16 124 } 125 ] 126 }, 127 { 128 "featureType": "all", 129 "elementType": "labels.icon", 130 "stylers": [ 131 { 132 "visibility": "off" 133 } 134 ] 135 }, 136 { 137 "featureType": "administrative", 138 "elementType": "geometry.fill", 139 "stylers": [ 140 { 141 "color": "#000000" 142 }, 143 { 144 "lightness": 20 145 } 146 ] 147 }, 148 { 149 "featureType": "administrative", 150 "elementType": "geometry.stroke", 151 "stylers": [ 152 { 153 "color": "#000000" 154 }, 155 { 156 "lightness": 17 157 }, 158 { 159 "weight": 1.2 160 } 161 ] 162 }, 163 { 164 "featureType": "landscape", 165 "elementType": "geometry", 166 "stylers": [ 167 { 168 "color": "#000000" 169 }, 170 { 171 "lightness": 20 172 } 173 ] 174 }, 175 { 176 "featureType": "poi", 177 "elementType": "geometry", 178 "stylers": [ 179 { 180 "color": "#000000" 181 }, 182 { 183 "lightness": 21 184 } 185 ] 186 }, 187 { 188 "featureType": "road.highway", 189 "elementType": "geometry.fill", 190 "stylers": [ 191 { 192 "color": "#000000" 193 }, 194 { 195 "lightness": 17 196 } 197 ] 198 }, 199 { 200 "featureType": "road.highway", 201 "elementType": "geometry.stroke", 202 "stylers": [ 203 { 204 "color": "#000000" 205 }, 206 { 207 "lightness": 29 208 }, 209 { 210 "weight": 0.2 211 } 212 ] 213 }, 214 { 215 "featureType": "road.arterial", 216 "elementType": "geometry", 217 "stylers": [ 218 { 219 "color": "#000000" 220 }, 221 { 222 "lightness": 18 223 } 224 ] 225 }, 226 { 227 "featureType": "road.local", 228 "elementType": "geometry", 229 "stylers": [ 230 { 231 "color": "#000000" 232 }, 233 { 234 "lightness": 16 235 } 236 ] 237 }, 238 { 239 "featureType": "transit", 240 "elementType": "geometry", 241 "stylers": [ 242 { 243 "color": "#000000" 244 }, 245 { 246 "lightness": 19 247 } 248 ] 249 }, 250 { 251 "featureType": "water", 252 "elementType": "geometry", 253 "stylers": [ 254 { 255 "color": "#000000" 256 }, 257 { 258 "lightness": 17 259 } 260 ] 261 } 262]; 263 map.setOptions({styles: styles}); 264 } 265 }); 266} 267 268function MapLoadScript() { 269 var script = document.createElement('script'); 270 script.type = 'text/javascript'; 271 GmapInit(); 272 document.body.appendChild(script); 273} 274 275})(window.jQuery);
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.