1/* 2 document.oldWrite = document.write; 3 document.write = function(text) 4 { 5 var parser = new DOMParser(); 6 var element = parser.parseFromString(text, "text/xml"); 7 var child = element.firstChild; 8 var element = document.createElement("script"); 9 element.src = child.getAttribute('src'); 10 element.type= "text/javascript"; 11 document.getElementsByTagName("head")[0].appendChild(element); 12 document.write = document.oldWrite; 13 }; 14 var s = document.createElement('script'); 15 s.type = "text/javascript"; 16 s.src = 'https://maps.googleapis.com/maps/api/js?sensor=false'; 17 $('head').append(s); 18 */ 19 20$.fn.googleMap = function(options) { 21 options = $.extend({}, $.fn.googleMap.defaults, options); 22 23 var bounds = new google.maps.LatLngBounds(); 24 var styles = [ 25 { featureType: "all", elementType: "all", stylers: [ { saturation: -100 } ] } 26 ]; 27 28 if(options.grayscale) { 29 this.map = new google.maps.Map($(this)[0], { 30 zoom: options.zoom, 31 center: options.center, 32 scrollwheel: options.scrollwheel, 33 draggable: options.draggable, 34 mapTypeControlOptions: { 35 mapTypeIds: ['grayscale'] 36 } 37 }); 38 39 var mapType = new google.maps.StyledMapType(styles, {name: "Mapa"}); 40 this.map.mapTypes.set('grayscale', mapType); 41 this.map.setMapTypeId('grayscale'); 42 } else if(options.style != 0) { 43 this.map = new google.maps.Map($(this)[0], { 44 zoom: options.zoom, 45 center: options.center, 46 scrollwheel: options.scrollwheel, 47 draggable: options.draggable, 48 mapTypeControlOptions: { 49 mapTypeIds: ['styledMap'] 50 } 51 }); 52 53 var mapType = new google.maps.StyledMapType(options.style, {name: "Mapa"}); 54 this.map.mapTypes.set('styledMap', mapType); 55 this.map.setMapTypeId('styledMap'); 56 } else { 57 this.map = new google.maps.Map($(this)[0], { 58 zoom: options.zoom, 59 center: options.center, 60 draggable: options.draggable, 61 scrollwheel: options.scrollwheel 62 }); 63 $(this).addClass('googleMap'); 64 } 65 66 67 68 for(var i = 0; i < options.markers.length; i++) { 69 var marker = ''; 70 if(typeof options.markers[i].label == 'undefined') { 71 marker = new google.maps.Marker({ 72 position: options.markers[i].position, 73 map: this.map 74 }); 75 if(typeof options.markers[i].icon != 'undefined') 76 marker.setIcon(options.markers[i].icon); 77 else if(options.markerIcon != '') 78 marker.setIcon(options.markerIcon); 79 if(typeof options.markers[i].center != 'undefined' && options.markers[i].center) 80 this.map.setCenter(options.markers[i].position); 81 bounds.extend(marker.position); 82 } else { 83 var content = options.markers[i].label.content; 84 85 marker = new MarkerWithLabel({ 86 position: options.markers[i].position, 87 map: this.map, 88 labelContent: content, 89 labelAnchor: new google.maps.Point(-20, 35), 90 labelClass: options.markers[i].label.class 91 }); 92 if(typeof options.markers[i].icon != 'undefined') 93 marker.setIcon(options.markers[i].icon); 94 else if(options.markerIcon != '') 95 marker.setIcon(options.markerIcon); 96 if(typeof options.markers[i].center != 'undefined' && options.markers[i].center) 97 this.map.setCenter(options.markers[i].position); 98 bounds.extend(marker.position); 99 } 100 if(typeof options.markers[i].mapDescription != 'undefined') 101 $(this).append('\ 102 <div class="mapDescription"> \ 103 ' + options.markers[i].mapDescription.content + '\ 104 <a href="https://www.google.pl/maps/place/' + options.markers[i].mapDescription.address + '/@' + options.markers[i].position.lat + ',' + options.markers[i].position.lng + ','+ options.zoom +'z/" target="_blank">zobacz na wiÄkszej mapie</a>\ 105 </div>'); 106 } 107 this.map.fitBounds(bounds); 108 109 var self = this; 110 var listener = google.maps.event.addListener(this.map, "idle", function () { 111 self.map.setZoom(options.zoom); 112 google.maps.event.removeListener(listener); 113 }); 114}; 115 116$.fn.googleMap.defaults = { 117 zoom: 1, 118 center: new google.maps.LatLng(0, 0), 119 markers: [], 120 markerIcon: '', 121 grayscale: false, 122 style: 0, 123 scrollwheel: true, 124 draggable:true 125};
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.