1function redirectPost(url, data) { 2 var form = document.createElement("form"); 3 document.body.appendChild(form); 4 form.method = "post"; 5 form.action = url; 6 for (var name in data) { 7 var input = document.createElement("input"); 8 input.type = "hidden"; 9 input.name = name; 10 input.value = data[name]; 11 form.appendChild(input); 12 } 13 form.submit(); 14} 15(function($) { 16 $(document).ready(function() { 17 // !! doit être récupéré dynamiquement 18 var urlSite = "http://yogurtfactory.fr"; 19 //load map 20 var bounds = new google.maps.LatLngBounds(); 21 var infowindow = new google.maps.InfoWindow(); 22 var map = new google.maps.Map(document.getElementById("shop-map"), { 23 center: { lat: 46.1390195, lng: 2.4354798 }, 24 zoom: 5, 25 styles: [ 26 { 27 elementType: "geometry", 28 stylers: [ 29 { 30 color: "#f5f5f5" 31 } 32 ] 33 }, 34 { 35 elementType: "labels.icon", 36 stylers: [ 37 { 38 visibility: "off" 39 } 40 ] 41 }, 42 { 43 elementType: "labels.text.fill", 44 stylers: [ 45 { 46 color: "#616161" 47 } 48 ] 49 }, 50 { 51 elementType: "labels.text.stroke", 52 stylers: [ 53 { 54 color: "#f5f5f5" 55 } 56 ] 57 }, 58 { 59 featureType: "administrative.land_parcel", 60 elementType: "labels.text.fill", 61 stylers: [ 62 { 63 color: "#bdbdbd" 64 } 65 ] 66 }, 67 { 68 featureType: "poi", 69 elementType: "geometry", 70 stylers: [ 71 { 72 color: "#eeeeee" 73 } 74 ] 75 }, 76 { 77 featureType: "poi", 78 elementType: "labels.text.fill", 79 stylers: [ 80 { 81 color: "#757575" 82 } 83 ] 84 }, 85 { 86 featureType: "poi.park", 87 elementType: "geometry", 88 stylers: [ 89 { 90 color: "#e5e5e5" 91 } 92 ] 93 }, 94 { 95 featureType: "poi.park", 96 elementType: "labels.text.fill", 97 stylers: [ 98 { 99 color: "#9e9e9e" 100 } 101 ] 102 }, 103 { 104 featureType: "road", 105 elementType: "geometry", 106 stylers: [ 107 { 108 color: "#ffffff" 109 } 110 ] 111 }, 112 { 113 featureType: "road.arterial", 114 elementType: "labels.text.fill", 115 stylers: [ 116 { 117 color: "#757575" 118 } 119 ] 120 }, 121 { 122 featureType: "road.highway", 123 elementType: "geometry", 124 stylers: [ 125 { 126 color: "#dadada" 127 } 128 ] 129 }, 130 { 131 featureType: "road.highway", 132 elementType: "labels.text.fill", 133 stylers: [ 134 { 135 color: "#616161" 136 } 137 ] 138 }, 139 { 140 featureType: "road.local", 141 elementType: "labels.text.fill", 142 stylers: [ 143 { 144 color: "#9e9e9e" 145 } 146 ] 147 }, 148 { 149 featureType: "transit.line", 150 elementType: "geometry", 151 stylers: [ 152 { 153 color: "#e5e5e5" 154 } 155 ] 156 }, 157 { 158 featureType: "transit.station", 159 elementType: "geometry", 160 stylers: [ 161 { 162 color: "#eeeeee" 163 } 164 ] 165 }, 166 { 167 featureType: "water", 168 elementType: "geometry", 169 stylers: [ 170 { 171 color: "#c9c9c9" 172 } 173 ] 174 }, 175 { 176 featureType: "water", 177 elementType: "labels.text.fill", 178 stylers: [ 179 { 180 color: "#9e9e9e" 181 } 182 ] 183 } 184 ] 185 });
186 // Get the markers 187 $.ajax({ 188 type: "GET", 189 url: urlSite + "/wp-json/wp/v2/shops?per_page=100", 190 success: function(data) { 191 data.forEach(function(markerData) { 192 var marker = new google.maps.Marker({ 193 map: map, 194 position: new google.maps.LatLng( 195 markerData.acf.map.lat, 196 markerData.acf.map.lng 197 ), 198 icon: 199 urlSite + 200 "/wp-content/themes/bridge-child/images/location-pin.png", 201 title: markerData.title.rendered, 202 shopID: data.id 203 }); 204 //extend the bounds to include each marker's position 205 bounds.extend(marker.position); 206 207 /* 208 * Add a click action on marker 209 * Redirect to the shop page, pass shop with http POST 210 */ 211 google.maps.event.addListener(marker, "click", function() { 212 var currentShop = { 213 shopID: markerData.id, 214 lat: markerData.acf.map.lat, 215 lng: markerData.acf.map.lng 216 }; 217 redirectPost(urlSite + "/nos-shops/", { 218 currentShop: JSON.stringify(currentShop) 219 }); 220 }); 221 }); 222 } 223 }); 224 }); 225})(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.