1function getCookie(cname) { 2 var name = cname + '='; 3 var decodedCookie = decodeURIComponent(document.cookie); 4 var ca = decodedCookie.split(';'); 5 for(var i = 0; i <ca.length; i++) { 6 var c = ca[i]; 7 while (c.charAt(0) == ' ') { 8 c = c.substring(1); 9 } 10 if (c.indexOf(name) == 0) { 11 return c.substring(name.length, c.length); 12 } 13 } 14 return ''; 15 } 16 17 var geotestFired = false; 18 $(window).scroll(function(){ 19 if($('#locations').length){ 20 if (isInView($('#locations')) && !geotestFired) { 21 //fire whatever you what 22 geotestFired = true; 23 geotest(); 24 } 25 } 26}); 27 28$(document).ready(function () { 29 $('.map .view-all').on('click', function() { 30 var zip = getCookie('dl-zip') ? getCookie('dl-zip') : '94035'; 31 var lat = getCookie('dl-lat') ? getCookie('dl-lat') : '37.4129'; 32 var long = getCookie('dl-long') ? getCookie('dl-long') : '-122.05'; 33 34 var href = '/doctor-locator/results/Any-Profession/Any-Specialty/' + zip + '/?' + 'Lat=' + lat + '&Long=' + long; 35 36 $(this).attr('href', href); 37 }); 38 39 if ($("#dl-detail-main").length ) { 40 console.log("Embedded locator present, so loading geotest"); 41 geotest(); 42 } 43 44 var toggleLabels = ['#dl-embedded-location','#location']
45 toggleLabels.forEach(function(label){ 46 toggleLabel($(label)); 47 }) 48 49 50}); 51 52 53function isInView(elem){ 54 return $(elem).offset().top - $(window).scrollTop() < $(elem).height() ; 55} 56 57 58 59function scrollTest() { 60 console.log("Triggering scrollTest"); 61} 62 63function geotest(){ 64 console.log("Triggering geotest()"); 65 var zipcode=getCookie("dl-zip"); 66 var city=getCookie("dl-city"); 67 var state=getCookie("dl-state"); 68 var locationVal = getCookie("dl-location"); 69 var latitude=getCookie("dl-lat"); 70 var longitude=getCookie("dl-long"); 71 //var isCookieExists= false; 72 var displayPartner= $("#displayPartner").val(); 73 if(displayPartner && displayPartner == "true"){ 74 new DoctorLocatorEmbedded().attachListener('form#dl-form-element-embedded', 'embedded'); 75 new DoctorLocatorEmbedded().attachListener('form#dl-form-element-embedded-partner', 'embedded'); 76 new DoctorLocatorEmbedded().attachListener('form#dl-embedded-form', 'embedded'); 77 78 }else if(latitude!='' && longitude!=''){ 79 80 console.log("Reading value from cookie"); 81 82 $('input[class="dl-input-zip"]').attr("value", zipcode); 83 $('input[class="dl-input-location tt-input active"]').attr("value", zipcode); 84 $('input[class="dl-input-location tt-input"]').attr("value", zipcode); 85 $('input[id="location"]').attr("value", zipcode); 86 $('#find-location-menu').data("zip",zipcode); 87 $('input[id="dl-embedded-location"]').attr("value", zipcode); 88 89 //console.log("2"); 90 $('input[class="dl-input-lat"]').attr("value", latitude); 91 $('input[class="dl-input-long"]').attr("value", longitude); 92 $('input[class="geo-zipcode"]').attr("value", zipcode); 93 $('input[class="geo-lat"]').attr("value", latitude); 94 $('input[class="geo-long"]').attr("value", longitude); 95 //console.log("cookie Append"); 96 new DoctorLocatorEmbedded().attachListener('form#dl-form-element-embedded', 'embedded'); 97 new DoctorLocatorEmbedded().attachListener('form#dl-form-element-embedded-partner', 'embedded'); 98 new DoctorLocatorEmbedded().attachListener('form#dl-embedded-form', 'embedded'); 99 100 101 }else if(latitude==='' && longitude===''){ 102 console.log("Posting to geolocation - Testing"); 103 getGeoLocation(); 104 }else { 105 if(zipcode==''){ 106 zipcode='94035'; 107 } 108 if(latitude==''){ 109 latitude='37.751'; 110 } 111 if(longitude==''){ 112 longitude='-97.822'; 113 } 114 $('#find-location-menu').attr("data-zip",zipcode); 115 $('input[class="dl-input-zip"]').attr("value", zipcode); 116 $('input[class="dl-input-location tt-input active"]').attr("value", zipcode); 117 $('input[class="dl-input-location tt-input"]').attr("value", locationVal); 118 $('input[id="location"]').attr("value", locationVal); 119 $('input[id="dl-embedded-location"]').attr("value", zipcode); 120 $('#find-location-menu').data("zip",zipcode); 121 $('input[class="dl-input-lat"]').attr("value", latitude); 122 $('input[class="dl-input-long"]').attr("value", longitude); 123 $('input[class="geo-zipcode"]').attr("value", zipcode); 124 $('input[class="geo-lat"]').attr("value", latitude); 125 $('input[class="geo-long"]').attr("value", longitude); 126 new DoctorLocatorEmbedded().attachListener('form#dl-form-element-embedded', 'embedded'); 127 new DoctorLocatorEmbedded().attachListener('form#dl-embedded-form', 'embedded'); 128 new DoctorLocatorEmbedded().attachListener('form#dl-form-element-embedded-partner', 'embedded'); 129 } 130 131 132 133} 134function toggleLabel(target){ 135 //console.log(target); 136 var thisLabel = $("label[for='"+target.attr("id")+"']"); 137 fadeInLabel(thisLabel, target); 138 } 139function fadeInLabel($label, $input){ 140 $label.addClass('active'); 141 $input.addClass('active'); 142 } 143function getGeoLocation(){ 144 $.ajax({ 145 type: "POST", 146 //url: "https://maps.googleapis.com/maps/api/js?client=gme-retailfinanceinternational&channel=cclocator&", 147 url: "https://www.googleapis.com/geolocation/v1/geolocate?key=AIzaSyD9UJ3qVbnGh1_gcYtO8mmoiwedq7SzHcU&channel=cclocator®ion=US", 148 data: JSON.stringify({ "considerIp": "true" }), 149 contentType: "application/json", 150 crossDomain: true, 151 success: function (data) { 152 /* console.log(data); 153 console.log("Success"); */ 154 latitude=data.location.lat; 155 longitude=data.location.lng;
156 setCookie("dl-lat",latitude,365); 157 setCookie("dl-long",longitude,365); 158 setCookie("dl-geo-lat",latitude,365); 159 setCookie("dl-geo-long",longitude,365); 160 function findZip(){ 161 $.ajax({ 162 type: "GET", 163 url: "/sites/Satellite?d=&pagename=GeoZipcodeService&longitude="+longitude+"&latitude="+latitude+"", 164 contentType: "application/json", 165 crossDomain: true, 166 success: function (data) { 167 if($.trim(data)===""){ 168 169 let defaultZipcode='67570'; 170 let defaultLongitude='-97.822'; 171 let defaultLatitude='37.751'; 172 173 setCookie("dl-lat",defaultLatitude,365); 174 setCookie("dl-long",defaultLongitude,365); 175 setCookie("dl-zip",defaultZipcode,365); 176 177 setCookie("dl-geo-lat",defaultLatitude,365); 178 setCookie("dl-geo-long",defaultLongitude,365); 179 setCookie("dl-geo-zip",defaultZipcode,365); 180 181 $('#find-location-menu').attr("data-zip",defaultZipcode); 182 $('input[class="dl-input-zip"]').attr("value", defaultZipcode); 183 $('input[class="dl-input-location tt-input active"]').attr("value", defaultZipcode); 184 $('input[id="dl-embedded-location"]').attr("value", defaultZipcode); 185 $('#find-location-menu').data("zip",defaultZipcode); 186 $('input[class="dl-input-lat"]').attr("value", defaultLatitude); 187 $('input[class="dl-input-long"]').attr("value", defaultLongitude); 188 $('input[class="geo-zipcode"]').attr("value", defaultZipcode); 189 $('input[class="geo-lat"]').attr("value", defaultLatitude); 190 $('input[class="geo-long"]').attr("value", defaultLongitude); 191 new DoctorLocatorEmbedded().attachListener('form#dl-form-element-embedded', 'embedded'); 192 new DoctorLocatorEmbedded().attachListener('form#dl-embedded-form', 'embedded'); 193 new DoctorLocatorEmbedded().attachListener('form#dl-form-element-embedded-partner', 'embedded'); 194 }else { 195 var zipCodeJson = JSON.parse(data); 196 //Using [0] we have to get only one result for a given lat and long so hardcoding 197 let serviceZip = zipCodeJson.results[0].zip; 198 let serviceLat = zipCodeJson.results[0].latitude; 199 let serviceLong = zipCodeJson.results[0].longitude; 200 201 setCookie("dl-geo-zip",serviceZip,365); 202 setCookie("dl-zip",serviceZip,365); 203 $('input[class="dl-input-zip"]').attr("value", serviceZip); 204 $('input[class="dl-input-location tt-input active"]').attr("value", serviceZip); 205 $('input[class="dl-input-location tt-input"]').attr("value", serviceZip); 206 $('input[id="location"]').attr("value", serviceZip); 207 $('#find-location-menu').data("zip",serviceZip); 208 $('input[id="dl-embedded-location"]').attr("value", serviceZip); 209 210 $('input[class="dl-input-lat"]').attr("value", serviceLat); 211 $('input[class="dl-input-long"]').attr("value", serviceLong); 212 $('input[class="geo-zipcode"]').attr("value", serviceZip); 213 $('input[class="geo-lat"]').attr("value", serviceLat); 214 $('input[class="geo-long"]').attr("value", serviceLong); 215 216 new DoctorLocatorEmbedded().attachListener('form#dl-form-element-embedded', 'embedded'); 217 new DoctorLocatorEmbedded().attachListener('form#dl-form-element-embedded-partner', 'embedded'); 218 new DoctorLocatorEmbedded().attachListener('form#dl-embedded-form', 'embedded'); 219 220 } 221 222 }, 223 failure: function (errMsg) { 224 console.log("Error occured checking with in local geo code service"); 225 var latlng = new google.maps.LatLng(data.location.lat, data.location.lng); 226 geocoder = new google.maps.Geocoder(); 227 228 geocoder.geocode({'latLng': latlng}, function(results, status) { 229 if (status == google.maps.GeocoderStatus.OK) { 230 if (results[0]) { 231 for (j = 0; j < results[0].address_components.length; j++) { 232 console.log("debug 1 "+results[0].address_components[j].types[0]); 233 if (results[0].address_components[j].types[0] == 'postal_code'){ 234 zipcode=""; 235 zipcode=results[0].address_components[j].short_name; 236
237 setCookie("dl-geo-zip",zipcode,365); 238 setCookie("dl-zip",zipcode,365); 239 $('input[class="dl-input-zip"]').attr("value", zipcode); 240 $('input[class="dl-input-location tt-input active"]').attr("value", zipcode); 241 $('input[class="dl-input-location tt-input"]').attr("value", zipcode); 242 $('input[id="location"]').attr("value", zipcode); 243 $('#find-location-menu').data("zip",zipcode); 244 $('input[id="dl-embedded-location"]').attr("value", zipcode); 245 246 $('input[class="dl-input-lat"]').attr("value", latitude); 247 $('input[class="dl-input-long"]').attr("value", longitude); 248 $('input[class="geo-zipcode"]').attr("value", zipcode); 249 $('input[class="geo-lat"]').attr("value", latitude); 250 $('input[class="geo-long"]').attr("value", longitude); 251 252 new DoctorLocatorEmbedded().attachListener('form#dl-form-element-embedded', 'embedded'); 253 new DoctorLocatorEmbedded().attachListener('form#dl-form-element-embedded-partner', 'embedded'); 254 new DoctorLocatorEmbedded().attachListener('form#dl-embedded-form', 'embedded'); 255 } 256 257 } 258 } 259 } 260 }); 261 } 262 }); 263 } 264 findZip(); 265 function initMap() { 266 var mapElement = document.getElementById('map'); 267 if(mapElement){ 268 var myLatLng = {lat: data.location.lat, lng: data.location.lng}; 269 map = new google.maps.Map(mapElement, { 270 center: myLatLng, 271 zoom: 6 272 }); 273 var marker = new google.maps.Marker({ 274 position: myLatLng, 275 map: map, 276 title: 'Hello World!' 277 }); 278 } 279 } 280 initMap(); 281 }, 282 failure: function (errMsg) { 283 console.log("Error"); 284 console.log(errMsg); 285 } 286 287 }); 288} 289 290 291 //Top Nav 292$('#dl-locate-button-mirror').click(function () { 293 let googleGeoZip = getCookie("dl-geo-zip"); 294 let geoLatitude=getCookie("dl-geo-lat"); 295 let geoLongitude=getCookie("dl-geo-long"); 296 var $locationInput = $("#header-location-mirror"); 297 if(googleGeoZip === ""){ 298 getGeoLocation(); 299 $locationInput.val(document.getElementById('geo-zipcode').value).trigger('input'); 300 $('.dl-input-location').val(document.getElementById('geo-zipcode').value); 301 $('.dl-input-zip').val(document.getElementById('geo-zipcode').value); 302 $('.dl-input-lat').val(document.getElementById('geo-lat').value); 303 $('.dl-input-long').val(document.getElementById('geo-long').value); 304 } 305 306 $locationInput.val(googleGeoZip).trigger('input'); 307 $('.dl-input-location').val(googleGeoZip); 308 $('.dl-input-zip').val(googleGeoZip); 309 $('.dl-input-lat').val(geoLatitude); 310 $('.dl-input-long').val(geoLongitude); 311 312 }); 313 314 //Home Page 315$('#dl-locate-button-home, #dl-locate-button-findalocation').on('click', function(){ 316 makeValid(); 317 let googleGeoZip = getCookie("dl-geo-zip"); 318 let geoLatitude=getCookie("dl-geo-lat"); 319 let geoLongitude=getCookie("dl-geo-long"); 320 $('#location-invalid').hide(); 321 $('.city').removeClass('invalid').addClass('active'); 322 var $locationInput = $("#location"); 323 if(googleGeoZip === ""){ 324 getGeoLocation(); 325 $locationInput.val(document.getElementById('geo-zipcode').value).trigger('input'); 326 $('.dl-input-location').val(document.getElementById('geo-zipcode').value); 327 $('.dl-input-zip').val(document.getElementById('geo-zipcode').value); 328 $('.dl-input-lat').val(document.getElementById('geo-lat').value); 329 $('.dl-input-long').val(document.getElementById('geo-long').value); 330 } 331 332 $locationInput.val(googleGeoZip).trigger('input'); 333 $('.dl-input-location').val(googleGeoZip); 334 $('.dl-input-zip').val(googleGeoZip); 335 $('.dl-input-lat').val(geoLatitude); 336 $('.dl-input-long').val(geoLongitude); 337 338 339 }); 340 341 //Doctor Locator Page 342 $('#get-current-location').on('click', function() { 343 344 let googleGeoZip = getCookie("dl-geo-zip"); 345 let geoLatitude=getCookie("dl-geo-lat"); 346 let geoLongitude=getCookie("dl-geo-long"); 347 var $locationInput = $("#location-display"); 348 if(googleGeoZip === ""){ 349 getGeoLocation(); 350 $locationInput.val(document.getElementById('geo-zipcode').value).trigger('input'); 351 $('.dl-input-location').val(document.getElementById('geo-zipcode').value); 352 $('.dl-input-zip').val(document.getElementById('geo-zipcode').value); 353 $('.dl-input-lat').val(document.getElementById('geo-lat').value); 354 $('.dl-input-long').val(document.getElementById('geo-long').value); 355 } 356 $locationInput.val(googleGeoZip).trigger('input'); 357 $('.dl-input-location').val(googleGeoZip); 358 $('.dl-input-zip').val(googleGeoZip); 359 $('.dl-input-lat').val(geoLatitude); 360 $('.dl-input-long').val(geoLongitude); 361}); 362 363 364function isJSON (something) { 365 if (typeof something != 'string') 366 something = JSON.stringify(something); 367 try { 368 JSON.parse(something); 369 return true; 370 } catch (e) { 371 return false; 372 } 373}
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.