1var customLabel = { 2 office: { 3 label: '', 4 icon: '/assets/images/template/map-pin.png' 5 } 6}; 7 8function initMap() { 9 var map = new google.maps.Map(document.getElementById('map'), { 10 center: new google.maps.LatLng(43.5, -74), 11 zoom: 5 12 }); 13 var infoWindow = new google.maps.InfoWindow({ 14 //pixelOffset: new google.maps.Size(5,230) 15 }); 16 17 // Change this depending on the name of your PHP or XML file 18 downloadUrl('https://www.tifab.com/locations-map.php', function(data) { 19 var xml = data.responseXML; 20 var markers = xml.documentElement.getElementsByTagName('marker'); 21 Array.prototype.forEach.call(markers, function(markerElem) { 22 var id = markerElem.getAttribute('id'); 23 var name = markerElem.getAttribute('name'); 24 var phone1 = markerElem.getAttribute('phone1'); 25 var phone2 = markerElem.getAttribute('phone2'); 26 var fax = markerElem.getAttribute('fax'); 27 var address = markerElem.getAttribute('address'); 28 var city = markerElem.getAttribute('city'); 29 var state = markerElem.getAttribute('state'); 30 var zip = markerElem.getAttribute('zip'); 31 var country = markerElem.getAttribute('country'); 32 var type = markerElem.getAttribute('type'); 33 var point = new google.maps.LatLng( 34 parseFloat(markerElem.getAttribute('lat')), 35 parseFloat(markerElem.getAttribute('lng')) 36 ); 37 38 var infowincontent = document.createElement('div'); 39 infowincontent.className = "info"; 40 41 var strong = document.createElement('strong'); 42 strong.className = "name"; 43 strong.innerHTML = name; 44 infowincontent.appendChild(strong); 45 46 var text1 = document.createElement('span'); 47 text1.className = "address"; 48 text1.innerHTML = address; 49 $(text1).each(function() { 50 if ($(this).is(':empty')){ 51 $(this).hide(); 52 } 53 }); 54 infowincontent.appendChild(text1); 55 56 var text2 = document.createElement('span'); 57 text2.className = "city"; 58 text2.innerHTML = city; 59 $(text2).each(function() { 60 if ($(this).is(':empty')){ 61 $(this).hide(); 62 } 63 }); 64 infowincontent.appendChild(text2); 65 66 var text3 = document.createElement('span'); 67 text3.className = "state"; 68 text3.innerHTML = state + ' ' + zip; 69 $(text3).each(function() { 70 if ($(this).is(':empty')){ 71 $(this).hide(); 72 } 73 }); 74 infowincontent.appendChild(text3); 75 76/* 77 var text7 = document.createElement('span'); 78 text7.className = "country"; 79 text7.innerHTML = country; 80 $(text7).each(function() { 81 if ($(this).is(':empty')){ 82 $(this).hide(); 83 } 84 }); 85 infowincontent.appendChild(text7); 86*/ 87 88 var text4 = document.createElement('span'); 89 text4.className = "phone1"; 90 text4.textContent = phone1; 91 $(text4).each(function() { 92 if ($(this).is(':empty')){ 93 $(this).hide(); 94 } 95 }); 96 infowincontent.appendChild(text4); 97 98 var text5 = document.createElement('span'); 99 text5.className = "phone2"; 100 text5.textContent = phone2; 101 $(text5).each(function() { 102 if ($(this).is(':empty')){ 103 $(this).hide(); 104 } 105 }); 106 infowincontent.appendChild(text5); 107 108 var text6 = document.createElement('span'); 109 text6.className = "fax"; 110 text6.textContent = fax; 111 $(text6).each(function() { 112 if ($(this).is(':empty')){ 113 $(this).hide(); 114 } 115 }); 116 infowincontent.appendChild(text6); 117 118 var icon = customLabel[type] || {}; 119 var marker = new google.maps.Marker({ 120 map: map, 121 position: point, 122 icon: icon.icon, 123 label: icon.label 124 }); 125 marker.addListener('click', function() { 126 infoWindow.setContent(infowincontent); 127 infoWindow.open(map, marker); 128 }); 129 }); 130 }); 131} 132 133 134function downloadUrl(url, callback) { 135 var request = window.ActiveXObject ? 136 new ActiveXObject('Microsoft.XMLHTTP') : 137 new XMLHttpRequest(); 138 139 request.onreadystatechange = function() { 140 if (request.readyState == 4) { 141 request.onreadystatechange = doNothing; 142 callback(request, request.status); 143 } 144 }; 145 146 request.open('GET', url, true); 147 request.send(null); 148} 149 150function doNothing() {}
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.