1 var default_lat = 44.968684; 2 var default_lng = -93.215561; 3 var default_radius = 100; 4 var zoom_level = '3'; 5 var scrollwheel = '1'; 6 var draggable = '1'; 7 var map_width = '100%'; 8 var map_height = '350px'; 9 var special_text = ''; 10 var units = 'mi'; 11 var limit = '0'; 12 var plugin_url = 'https://wandarefinish.us/wp-content/plugins/simplemap'; 13 var visit_website_text = 'Visit Website'; 14 var get_directions_text = 'Get Directions'; 15 var location_tab_text = 'Location'; 16 var description_tab_text = 'Description'; 17 var phone_text = 'Phone'; 18 var fax_text = 'Fax'; 19 var email_text = 'Email'; 20 21 var taxonomy_text = {}; 22 taxonomy_text.sm_category = 'Categories'; 23 taxonomy_text.sm_tag = 'Tags'; 24 var noresults_text = 'No results found.'; 25 var default_domain = '.com'; 26 var address_format = 'town, province postalcode'; 27 var siteurl = 'https://wandarefinish.us'; 28 var map; 29 var geocoder; 30 var autoload = 'some'; 31 var auto_locate = ''; 32 var markersArray = []; 33 var infowindowsArray = []; 34 35 function clearInfoWindows() { 36 if (infowindowsArray) { 37 for (var i=0;i 38 <infowindowsArray.length;i++) { 39 infowindowsArray[i].close(); 40 } 41 } 42 } 43 44 function clearOverlays() { 45 if (markersArray) { 46 for (var i=0;i 47 <markersArray.length;i++) { 48 markersArray[i].setMap(null); 49 } 50 } 51 } 52 53 //function load_simplemap( lat, lng, aspid, ascid, asma ) { 54 function load_simplemap( lat, lng, aspid, ascid, asma, shortcode_zoom_level, map_type, shortcode_autoload, shortcode_scrollwheel, shortcode_draggable ) { 55 56 zoom_level = shortcode_zoom_level; 57 autoload = shortcode_autoload; 58 scrollwheel = shortcode_scrollwheel; 59 draggable = shortcode_draggable; 60 61 if ( lat == 0 ) { 62 lat = '44.968684'; 63 } 64 65 if ( lng == 0 ) { 66 lng = '-93.215561'; 67 } 68 69 var latlng = new google.maps.LatLng( lat, lng ); 70 var myOptions = { 71 zoom: parseInt(zoom_level), 72 center: latlng, 73 scrollwheel: scrollwheel, 74 draggable: draggable, 75 mapTypeId: google.maps.MapTypeId[map_type] 76 }; 77 map = new google.maps.Map( document.getElementById( "simplemap" ), myOptions ); 78 79 // Adsense for Google Maps 80 } 81 82 function codeAddress() { 83 // if this is modified, modify mirror function in general-options-js php function 84 var d_address = document.getElementById("default_address").value; 85 86 geocoder = new google.maps.Geocoder(); 87 geocoder.geocode( { 'address': d_address }, function( results, status ) { 88 if ( status == google.maps.GeocoderStatus.OK ) { 89 var latlng = results[0].geometry.location; 90 document.getElementById("default_lat").value = latlng.lat(); 91 document.getElementById("default_lng").value = latlng.lng(); 92 } else { 93 alert("Geocode was not successful for the following reason: " + status); 94 } 95 }); 96 } 97 98 function codeNewAddress() { 99 if (document.getElementById("store_lat").value != '' && document.getElementById("store_lng").value != '') { 100 document.new_location_form.submit(); 101 } 102 else { 103 var address = ''; 104 var street = document.getElementById("store_address").value; 105 var city = document.getElementById("store_city").value; 106 var state = document.getElementById("store_state").value; 107 var country = document.getElementById("store_country").value; 108 109 if (street) { address += street + ', '; } 110 if (city) { address += city + ', '; } 111 if (state) { address += state + ', '; } 112 address += country; 113 114 geocoder = new google.maps.Geocoder(); 115 geocoder.geocode( { 'address': address }, function( results, status ) { 116 if ( status == google.maps.GeocoderStatus.OK ) { 117 var latlng = results[0].geometry.location; 118 document.getElementById("store_lat").value = latlng.lat(); 119 document.getElementById("store_lng").value = latlng.lng(); 120 document.new_location_form.submit(); 121 } else { 122 alert("Geocode was not successful for the following reason: " + status); 123 } 124 }); 125 } 126 } 127 128 function codeChangedAddress() { 129 var address = ''; 130 var street = document.getElementById("store_address").value; 131 var city = document.getElementById("store_city").value; 132 var state = document.getElementById("store_state").value; 133 var country = document.getElementById("store_country").value; 134 135 if (street) { address += street + ', '; } 136 if (city) { address += city + ', '; } 137 if (state) { address += state + ', '; } 138 address += country; 139 140 geocoder = new google.maps.Geocoder(); 141 geocoder.geocode( { 'address': address }, function( results, status ) { 142 if ( status == google.maps.GeocoderStatus.OK ) { 143 var latlng = results[0].geometry.location; 144 document.getElementById("store_lat").value = latlng.lat(); 145 document.getElementById("store_lng").value = latlng.lng(); 146 } else { 147 alert("Geocode was not successful for the following reason: " + status); 148 } 149 }); 150 } 151 152 function searchLocations( is_search ) { 153 clearInfoWindows(); 154 // Init searchData 155 var searchData = {}; 156 searchData.taxes = {}; 157 158 // Set defaults for search form fields 159 searchData.name = ''; 160 searchData.address = ''; 161 searchData.city = ''; 162 searchData.state = ''; 163 searchData.zip = ''; 164 searchData.country = ''; 165 166 if ( null != document.getElementById('location_search_name_field') ) { 167 searchData.name = document.getElementById('location_search_name_field').value; 168 } 169 170 if ( null != document.getElementById('location_search_address_field') ) { 171 searchData.address = document.getElementById('location_search_address_field').value; 172 } 173 174 if ( null != document.getElementById('location_search_city_field') ) { 175 searchData.city = document.getElementById('location_search_city_field').value; 176 } 177 178 if ( null != document.getElementById('location_search_country_field') ) { 179 searchData.country = document.getElementById('location_search_country_field').value;; 180 } 181 182 if ( null != document.getElementById('location_search_state_field') ) { 183 searchData.state = document.getElementById('location_search_state_field').value; 184 } 185 186 if ( null != document.getElementById('location_search_zip_field') ) { 187 searchData.zip = document.getElementById('location_search_zip_field').value; 188 } 189 190 if ( null != document.getElementById('location_search_distance_field') ) { 191 searchData.radius = document.getElementById('location_search_distance_field').value; 192 } 193 194 searchData.lat = document.getElementById('location_search_default_lat').value; 195 searchData.lng = document.getElementById('location_search_default_lng').value; 196 searchData.limit = document.getElementById('location_search_limit').value; 197 searchData.searching = document.getElementById('location_is_search_results').value; 198 199 // Do SimpleMap Taxonomies 200 201 // Do taxnonomy for checkboxes 202 searchData.taxes.sm_category = ''; 203 var checks_found = false;
204 jQuery( 'input[rel=location_search_sm_category_field]' ).each( function() { 205 checks_found = true; 206 if ( jQuery( this ).attr( 'checked' ) && jQuery( this ).attr( 'value' ) != null ) { 207 searchData.taxes.sm_category += jQuery( this ).attr( 'value' ) + ','; 208 } 209 }); 210 211 // Do taxnonomy for select box if checks weren't found 212 if ( false == checks_found ) { 213 jQuery( 'option[rel=location_search_sm_category_select_val]' ).each( function() { 214 if ( jQuery( this ).attr( 'selected' ) && jQuery( this ).attr( 'value' ) != null ) { 215 searchData.taxes.sm_category += jQuery( this ).attr( 'value' ) + ','; 216 } 217 }); 218 } 219 220 221 // Do taxnonomy for checkboxes 222 searchData.taxes.sm_tag = ''; 223 var checks_found = false; 224 jQuery( 'input[rel=location_search_sm_tag_field]' ).each( function() { 225 checks_found = true; 226 if ( jQuery( this ).attr( 'checked' ) && jQuery( this ).attr( 'value' ) != null ) { 227 searchData.taxes.sm_tag += jQuery( this ).attr( 'value' ) + ','; 228 } 229 }); 230 231 // Do taxnonomy for select box if checks weren't found 232 if ( false == checks_found ) { 233 jQuery( 'option[rel=location_search_sm_tag_select_val]' ).each( function() { 234 if ( jQuery( this ).attr( 'selected' ) && jQuery( this ).attr( 'value' ) != null ) { 235 searchData.taxes.sm_tag += jQuery( this ).attr( 'value' ) + ','; 236 } 237 }); 238 } 239 240 241 var query = ''; 242 var start = 0; 243 244 if ( searchData.address && searchData.address != '' ) { 245 query += searchData.address + ', '; 246 } 247 248 if ( searchData.city && searchData.city != '' ) { 249 query += searchData.city + ', '; 250 } 251 252 if ( searchData.state && searchData.state != '' ) { 253 query += searchData.state + ', '; 254 } 255 256 if ( searchData.zip && searchData.zip != '' ) { 257 query += searchData.zip + ', '; 258 } 259 260 if ( searchData.country && searchData.country != '' ) { 261 query += searchData.country + ', '; 262 } 263 264 // Query 265 if ( query != null ) { 266 query = query.slice(0, -2); 267 } 268 269 if ( searchData.limit == '' || searchData.limit == null ) { 270 searchData.limit = 0; 271 } 272 273 if ( searchData.radius == '' || searchData.radius == null ) { 274 searchData.radius = 0; 275 } 276 277 // Taxonomies 278 279 if ( searchData.taxes.sm_category != null ) { 280 var _sm_category = searchData.taxes.sm_category.slice(0, -1); 281 } else { 282 var _sm_category = ''; 283 } 284 285 // Append available taxes logic if no taxes are selected but limited taxes were passed through shortcode as available 286 if ( '' != document.getElementById('avail_sm_category').value && '' == _sm_category ) { 287 _sm_category = 'OR,' + document.getElementById('avail_sm_category').value; 288 } 289 290 searchData.taxes.sm_category = _sm_category; 291 292 293 if ( searchData.taxes.sm_tag != null ) { 294 var _sm_tag = searchData.taxes.sm_tag.slice(0, -1); 295 } else { 296 var _sm_tag = ''; 297 } 298 299 // Append available taxes logic if no taxes are selected but limited taxes were passed through shortcode as available 300 if ( '' != document.getElementById('avail_sm_tag').value && '' == _sm_tag ) { 301 _sm_tag = 'OR,' + document.getElementById('avail_sm_tag').value; 302 } 303 304 searchData.taxes.sm_tag = _sm_tag; 305 306 307 // Load default location if query is empty 308 if ( query == '' || query == null ) { 309 310 if ( searchData.lat != 0 && searchData.lng != 0 ) 311 query = searchData.lat + ', ' + searchData.lng; 312 else 313 query = '44.968684, -93.215561'; 314 315 } 316 317 // Searching 318 if ( 1 == searchData.searching || 1 == is_search ) { 319 is_search = 1; 320 searchData.source = 'search'; 321 } else { 322 is_search = 0; 323 searchData.source = 'initial_load'; 324 } 325 326 geocoder.geocode( { 'address': query }, function( results, status ) { 327 if ( status == google.maps.GeocoderStatus.OK ) { 328 searchData.center = results[0].geometry.location; 329 if ( 'none' != autoload || is_search ) { 330 if ( 'all' == autoload && is_search != 1 ) { 331 searchData.radius = 0; 332 searchData.limit = 0; 333 } 334 335 if (! searchData.center) { 336 searchData.center = new GLatLng( 44.9799654, -93.2638361 ); 337 } 338 searchData.query_type = 'all'; 339 searchData.mapLock = 'unlock'; 340 searchData.homeAddress = query; 341 342 searchLocationsNear(searchData); 343 } 344 } 345 }); 346 } 347 348 function searchLocationsNear(searchData) { 349 // Radius 350 if ( searchData.radius != null && searchData.radius != '' ) { 351 searchData.radius = parseInt( searchData.radius ); 352 353 if ( units == 'km' ) { 354 searchData.radius = parseInt( searchData.radius ) / 1.609344; 355 } 356 } else if ( autoload == 'all' ) { 357 searchData.radius = 0; 358 } else { 359 if ( units == 'mi' ) { 360 searchData.radius = parseInt( default_radius ); 361 } else if ( units == 'km' ) { 362 searchData.radius = parseInt( default_radius ) / 1.609344; 363 } 364 } 365
366 // Build search URL 367 368 var searchUrl = siteurl + '/?sm-xml-search=1&lat=' + searchData.center.lat() + '&lng=' + searchData.center.lng() + '&radius=' + searchData.radius + '&namequery=' + searchData.homeAddress + '&query_type=' + searchData.query_type + '&limit=' + searchData.limit + '&sm_category=' + searchData.taxes.sm_category + '&sm_tag=' + searchData.taxes.sm_tag + '&locname=' + searchData.name + '&address=' + searchData.address + '&city=' + searchData.city + '&state=' + searchData.state + '&zip=' + searchData.zip + '&pid=26'; 369 370 // Display Updating Message and hide search results 371 if ( jQuery( "#simplemap" ).is(":visible") ) { 372 jQuery( "#simplemap" ).hide(); 373 jQuery( "#simplemap-updating" ).show(); 374 } 375 jQuery( "#results" ).html( '' ); 376 377 jQuery.get( searchUrl, {}, function(data) { 378 // Hide Updating Message 379 if ( jQuery( "#simplemap-updating" ).is(":visible") ) { 380 jQuery( "#simplemap-updating" ).hide(); 381 jQuery( "#simplemap" ).show(); 382 } 383 384 clearOverlays(); 385 386 var results = document.getElementById('results'); 387 results.innerHTML = ''; 388 389 var markers = jQuery( eval( data ) ); 390 if (markers.length == 0) { 391 results.innerHTML = '<h3>' + noresults_text + '</h3>'; 392 map.setCenter( searchData.center ); 393 return; 394 } 395 396 var bounds = new google.maps.LatLngBounds(); 397 markers.each( function () { 398 var locationData = this; 399 locationData.distance = parseFloat(locationData.distance); 400 locationData.point = new google.maps.LatLng(parseFloat(locationData.lat), parseFloat(locationData.lng)); 401 locationData.homeAddress = searchData.homeAddress; 402 403 var marker = createMarker(locationData); 404 var sidebarEntry = createSidebarEntry(marker, locationData, searchData); 405 results.appendChild(sidebarEntry); 406 bounds.extend(locationData.point); 407 }); 408 409 // Make centeral marker on search 410 if ( 'search' == searchData.source && true) { 411 var searchMarkerOptions = {}; 412 searchMarkerOptions.map = map; 413 searchMarkerOptions.position = searchData.center; 414 415 searchMarkerOptions.icon = new google.maps.MarkerImage( 416 'https://wandarefinish.us/wp-content/plugins/simplemap/inc/images/blue-dot.png', 417 new google.maps.Size(20, 32), 418 new google.maps.Point(0,0), 419 new google.maps.Point(0,32) 420 ); 421 422 var searchMarkerTitle = ''; 423 if ( '' != searchData.address ) { 424 searchMarkerTitle += searchData.address + ' '; 425 } 426 if ( '' != searchData.city ) { 427 searchMarkerTitle += searchData.city + ' '; 428 } 429 if ( '' != searchData.state ) { 430 searchMarkerTitle += searchData.state + ' '; 431 } 432 if ( '' != searchData.zip ) { 433 searchMarkerTitle += searchData.zip + ' '; 434 } 435 436 var searchMarker = new google.maps.Marker( searchMarkerOptions ); 437 searchMarker.title = searchMarkerTitle; 438 markersArray.push(searchMarker); 439 bounds.extend(searchMarkerOptions.position); 440 } 441 442 // If the search button was clicked, limit to a 15px zoom 443 if ( 'search' == searchData.source ) { 444 map.fitBounds( bounds ); 445 if ( map.getZoom() > 15 ) { 446 map.setZoom( 15 ); 447 } 448 } else { 449 // If initial load of map, zoom to default settings 450 map.setZoom(parseInt(zoom_level)); 451 } 452 453 // Paranoia - fix container sizing bug -- pdb
454 google.maps.event.addListener(map, "idle", function(){ 455 google.maps.event.trigger(map, 'resize'); 456 }); 457 }); 458 } 459 460 function stringFilter(s) { 461 filteredValues = "emnpxt%"; // Characters stripped out 462 var i; 463 var returnString = ""; 464 for (i = 0; i < s.length; i++) { // Search through string and append to unfiltered values to returnString. 465 var c = s.charAt(i); 466 if (filteredValues.indexOf(c) == -1) returnString += c; 467 } 468 return returnString; 469 } 470 471 function createMarker( locationData ) { 472 473 // Init tax heights 474 locationData.taxonomyheights = []; 475 476 // Allow plugin users to define Maker Options (including custom images) 477 var markerOptions = {}; 478 if ( 'function' == typeof window.simplemapCustomMarkers ) { 479 markerOptions = simplemapCustomMarkers( locationData ); 480 } 481 482 // Allow developers to turn of description in bubble. (Return true to hide) 483 484 markerOptions.map = map; 485 markerOptions.position = locationData.point; 486 var marker = new google.maps.Marker( markerOptions ); 487 marker.title = locationData.name; 488 markersArray.push(marker); 489 490 var mapwidth; 491 var mapheight; 492 var maxbubblewidth; 493 var maxbubbleheight; 494 495 mapwidth = document.getElementById("simplemap"); 496 if ( typeof mapwidth != 'undefined' ) { 497 mapwidth = mapwidth.offsetWidth; 498 } else { 499 if ( typeof map_width != 'undefined' ) { 500 mapwidth = Number(stringFilter(map_width)); 501 } else { 502 mapwidth = 400; 503 } 504 } 505 506 mapheight = document.getElementById("simplemap"); 507 if ( typeof mapheight != 'undefined' ) { 508 mapheight = mapheight.offsetHeight; 509 } else { 510 if ( typeof map_height != 'undefined' ) { 511 mapheight = Number(stringFilter(map_height)); 512 } else { 513 mapheight = 200; 514 } 515 } 516 maxbubblewidth = Math.round(mapwidth / 1.5); 517 maxbubbleheight = Math.round(mapheight / 2.2); 518 519 var fontsize = 12; 520 var lineheight = 12; 521 522 if (locationData.taxes.sm_category && locationData.taxes.sm_category != '' ) { 523 var titleheight = 3 + Math.floor((locationData.name.length + locationData.taxes.sm_category.length) * fontsize / (maxbubblewidth * 1.5)); 524 } else { 525 var titleheight = 3 + Math.floor((locationData.name.length) * fontsize / (maxbubblewidth * 1.5)); 526 } 527 528 var addressheight = 2; 529 if (locationData.address2 != '') { 530 addressheight += 1; 531 } 532 if (locationData.phone != '' || locationData.fax != '') { 533 addressheight += 1; 534 if (locationData.phone != '') { 535 addressheight += 1; 536 } 537 if (locationData.fax != '') { 538 addressheight += 1; 539 } 540 } 541 542 for (jstax in locationData.taxes) { 543 if ( locationData.taxes[jstax] !== '' ) { 544 locationData.taxonomyheights[jstax] = 3 + Math.floor((locationData.taxes[jstax][length]) * fontsize / (maxbubblewidth * 1.5)); 545 } 546 } 547 var linksheight = 2; 548 549 var totalheight = titleheight + addressheight; 550 for (jstax in locationData.taxes) { 551 if ( 'sm_category' != jstax ) { 552 totalheight += locationData.taxonomyheights[jstax]; 553 } 554 } 555 totalheight = (totalheight + 1) * fontsize; 556 557 if (totalheight > maxbubbleheight) { 558 totalheight = maxbubbleheight; 559 } 560 561 if ( isNaN( totalheight ) || totalheight > maxbubbleheight ) { 562 totalheight = maxbubbleheight; 563 } 564 565 var html = '<div class="markertext" style="background-color:#fff;padding:10px;max-width: ' + maxbubblewidth + 'px; height: ' + totalheight + 'px; overflow-y: auto; overflow-x: hidden;">'; 566 html += '<h3 style="margin-top: 0; padding-top: 0; border-top: none;">'; 567 568 if ( '' != locationData.permalink ) { 569 html += '<a href="' + locationData.permalink + '">'; 570 } 571 html += locationData.name; 572 573 if ( '' != locationData.permalink ) { 574 html += '</a>'; 575 } 576 577 if (locationData.taxes.sm_category && locationData.taxes.sm_category != null && locationData.taxes.sm_category != '' ) { 578 html += '<br /><span class="bubble_category">' + locationData.taxes.sm_category + '</span>'; 579 } 580 581 html += '</h3>'; 582 583 html += '<p class="buble_address">' + locationData.address; 584 if (locationData.address2 != '') { 585 html += '<br />' + locationData.address2; 586 } 587 588 // Address Data 589 if (address_format == 'town, province postalcode') { 590 html += '<br />' + locationData.city + ', ' + locationData.state + ' ' + locationData.zip + '</p>'; 591 } else if (address_format == 'town province postalcode') { 592 html += '<br />' + locationData.city + ' ' + locationData.state + ' ' + locationData.zip + '</p>'; 593 } else if (address_format == 'town-province postalcode') { 594 html += '<br />' + locationData.city + '-' + locationData.state + ' ' + locationData.zip + '</p>'; 595 } else if (address_format == 'postalcode town-province') { 596 html += '<br />' + locationData.zip + ' ' + locationData.city + '-' + locationData.state + '</p>'; 597 } else if (address_format == 'postalcode town, province') { 598 html += '<br />' + locationData.zip + ' ' + locationData.city + ', ' + locationData.state + '</p>'; 599 } else if (address_format == 'postalcode town') { 600 html += '<br />' + locationData.zip + ' ' + locationData.city + '</p>'; 601 } else if (address_format == 'town postalcode') { 602 html += '<br />' + locationData.city + ' ' + locationData.zip + '</p>'; 603 } 604 605 // Phone and Fax Data 606 if (locationData.phone != null && locationData.phone != '') { 607 html += '<p class="bubble_contact"><span class="bubble_phone">' + phone_text + ': ' + locationData.phone + '</span>'; 608 if (locationData.email != null && locationData.email != '') { 609 html += '<br />' + email_text + ': <a class="bubble_email" href="mailto:' + locationData.email + '">' + locationData.email + '</a>'; 610 } 611 if (locationData.fax != null && locationData.fax != '') { 612 html += '<br /><span class="bubble_fax">' + fax_text + ': ' + locationData.fax + '</span>'; 613 } 614 html += '</p>'; 615 } else if (locationData.fax != null && locationData.fax != '') { 616 html += '<p>' + fax_text + ': ' + locationData.fax + '</p>'; 617 } 618 619 html += '<p class="bubble_tags">'; 620 621 for (jstax in locationData.taxes) { 622 if ( 'sm_category' == jstax ) { 623 continue; 624 } 625 if ( locationData.taxes[jstax] != null && locationData.taxes[jstax] != '' ) { 626 html += taxonomy_text[jstax] + ': ' + locationData.taxes[jstax] + '<br />'; 627 } 628 } 629 html += '</p>'; 630 631 var dir_address = locationData.point.toUrlValue(10); 632 var dir_address2 = ''; 633 if (locationData.address) { dir_address2 += locationData.address; }
634 if (locationData.city) { if ( '' != dir_address2 ) { dir_address2 += ' '; } dir_address2 += locationData.city; }; 635 if (locationData.state) { if ( '' != dir_address2 ) { dir_address2 += ' '; } dir_address2 += locationData.state; }; 636 if (locationData.zip) { if ( '' != dir_address2 ) { dir_address2 += ' '; } dir_address2 += locationData.zip; }; 637 if (locationData.country) { if ( '' != dir_address2 ) { dir_address2 += ' '; } dir_address2 += locationData.country; }; 638 639 if ( '' != dir_address2 ) { dir_address = locationData.point.toUrlValue(10) + '(' + escape( dir_address2 ) + ')'; }; 640 641 html += ' <p class="bubble_links"><a class="bubble_directions" href="http://google' + default_domain + '/maps?saddr=' + locationData.homeAddress + '&daddr=' + dir_address + '" target="_blank">' + get_directions_text + '</a>'; 642 if (locationData.url != '') { 643 html += ' <span class="bubble_website"> | <a href="' + locationData.url + '" title="' + locationData.name + '" target="_blank">' + visit_website_text + '</a></span>'; 644 } 645 html += ' </p>'; 646 647 if (locationData.description != '' && locationData.description != null) { 648 var numlines = Math.ceil(locationData.description.length / 40); 649 var newlines = locationData.description.split('<br />').length - 1; 650 var totalheight2 = 0; 651 652 if ( locationData.description.indexOf('<img') == -1) { 653 totalheight2 = (numlines + newlines + 1) * fontsize; 654 } 655 else { 656 var numberindex = locationData.description.indexOf('height=') + 8; 657 var numberend = locationData.description.indexOf('"', numberindex); 658 var imageheight = Number(locationData.description.substring(numberindex, numberend)); 659 660 totalheight2 = ((numlines + newlines - 2) * fontsize) + imageheight; 661 } 662 663 if (totalheight2 > maxbubbleheight) { 664 totalheight2 = maxbubbleheight; 665 } 666 667 //marker.openInfoWindowTabsHtml([new GInfoWindowTab(location_tab_text, html), new GInfoWindowTab(description_tab_text, html2)], {maxWidth: maxbubblewidth}); 668 // tabs aren't possible with the Google Maps api v3 669 html += '<hr /><div class="bubble_content">' + locationData.description + '</div>'; 670 } 671 672 html += ' </div>'; 673/** 674 * @name InfoBox 675 * @version 1.1.13 [March 19, 2014] 676 * @author Gary Little (inspired by proof-of-concept code from Pamela Fox of Google) 677 * @copyright Copyright 2010 Gary Little [gary at luxcentral.com] 678 */ 679eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('7 8(a){a=a||{};r.s.1R.2k(2,3d);2.Q=a.1v||"";2.1H=a.1B||J;2.S=a.1G||0;2.H=a.1z||1h r.s.1Y(0,0);2.B=a.U||1h r.s.2E(0,0);2.15=a.13||t;2.1p=a.1t||"2h";2.1m=a.F||{};2.1E=a.1C||"3g";2.P=a.1j||"3b://38.r.33/2Y/2T/2N/1r.2K";3(a.1j===""){2.P=""}2.1f=a.1x||1h r.s.1Y(1,1);3(q a.A==="p"){3(q a.18==="p"){a.A=L}v{a.A=!a.18}}2.w=!a.A;2.17=a.1n||J;2.1I=a.2g||"2e";2.16=a.1l||J;2.4=t;2.z=t;2.14=t;2.V=t;2.E=t;2.R=t}8.9=1h r.s.1R();8.9.25=7(){5 i;5 f;5 a;5 d=2;5 c=7(e){e.20=L;3(e.1i){e.1i()}};5 b=7(e){e.30=J;3(e.1Z){e.1Z()}3(!d.16){c(e)}};3(!2.4){2.4=1e.2S("2Q");2.1d();3(q 2.Q.1u==="p"){2.4.O=2.G()+2.Q}v{2.4.O=2.G();2.4.1a(2.Q)}2.2J()[2.1I].1a(2.4);2.1w();3(2.4.6.D){2.R=L}v{3(2.S!==0&&2.4.Z>2.S){2.4.6.D=2.S;2.4.6.2D="2A";2.R=L}v{a=2.1P();2.4.6.D=(2.4.Z-a.W-a.11)+"12";2.R=J}}2.1F(2.1H);3(!2.16){2.E=[];f=["2t","1O","2q","2p","1M","2o","2n","2m","2l"];1o(i=0;i<f.1L;i++){2.E.1K(r.s.u.19(2.4,f[i],c))}2.E.1K(r.s.u.19(2.4,"1O",7(e){2.6.1J="2j"}))}2.V=r.s.u.19(2.4,"2i",b);r.s.u.T(2,"2f")}};8.9.G=7(){5 a="";3(2.P!==""){a="<2d";a+=" 2c=\'"+2.P+"\'";a+=" 2b=11";a+=" 6=\'";a+=" U: 2a;";a+=" 1J: 29;";a+=" 28: "+2.1E+";";a+="\'>"}K a};8.9.1w=7(){5 a;3(2.P!==""){a=2.4.3n;2.z=r.s.u.19(a,"1M",2.27())}v{2.z=t}};8.9.27=7(){5 a=2;K 7(e){e.20=L;3(e.1i){e.1i()}r.s.u.T(a,"3m");a.1r()}};8.9.1F=7(d){5 m;5 n;5 e=0,I=0;3(!d){m=2.1D();3(m 3l r.s.3k){3(!m.26().3h(2.B)){m.3f(2.B)}n=m.26();
6795 a=m.3e();5 h=a.Z;5 f=a.24;5 k=2.H.D;5 l=2.H.1k;5 g=2.4.Z;5 b=2.4.24;5 i=2.1f.D;5 j=2.1f.1k;5 o=2.23().3c(2.B);3(o.x<(-k+i)){e=o.x+k-i}v 3((o.x+g+k+i)>h){e=o.x+g+k+i-h}3(2.17){3(o.y<(-l+j+b)){I=o.y+l-j-b}v 3((o.y+l+j)>f){I=o.y+l+j-f}}v{3(o.y<(-l+j)){I=o.y+l-j}v 3((o.y+b+l+j)>f){I=o.y+b+l+j-f}}3(!(e===0&&I===0)){5 c=m.3a();m.39(e,I)}}}};8.9.1d=7(){5 i,F;3(2.4){2.4.37=2.1p;2.4.6.36="";F=2.1m;1o(i 35 F){3(F.34(i)){2.4.6[i]=F[i]}}2.4.6.32="31(0)";3(q 2.4.6.X!=="p"&&2.4.6.X!==""){2.4.6.2Z="\\"2X:2W.2V.2U(2R="+(2.4.6.X*1X)+")\\"";2.4.6.2P="2O(X="+(2.4.6.X*1X)+")"}2.4.6.U="2M";2.4.6.M=\'1c\';3(2.15!==t){2.4.6.13=2.15}}};8.9.1P=7(){5 c;5 a={1b:0,1g:0,W:0,11:0};5 b=2.4;3(1e.1s&&1e.1s.1W){c=b.2L.1s.1W(b,"");3(c){a.1b=C(c.1V,10)||0;a.1g=C(c.1U,10)||0;a.W=C(c.1T,10)||0;a.11=C(c.1S,10)||0}}v 3(1e.2I.N){3(b.N){a.1b=C(b.N.1V,10)||0;a.1g=C(b.N.1U,10)||0;a.W=C(b.N.1T,10)||0;a.11=C(b.N.1S,10)||0}}K a};8.9.2H=7(){3(2.4){2.4.2G.2F(2.4);2.4=t}};8.9.1y=7(){2.25();5 a=2.23().2C(2.B);2.4.6.W=(a.x+2.H.D)+"12";3(2.17){2.4.6.1g=-(a.y+2.H.1k)+"12"}v{2.4.6.1b=(a.y+2.H.1k)+"12"}3(2.w){2.4.6.M="1c"}v{2.4.6.M="A"}};8.9.2B=7(a){3(q a.1t!=="p"){2.1p=a.1t;2.1d()}3(q a.F!=="p"){2.1m=a.F;2.1d()}3(q a.1v!=="p"){2.1Q(a.1v)}3(q a.1B!=="p"){2.1H=a.1B}3(q a.1G!=="p"){2.S=a.1G}3(q a.1z!=="p"){2.H=a.1z}3(q a.1n!=="p"){2.17=a.1n}3(q a.U!=="p"){2.1q(a.U)}3(q a.13!=="p"){2.22(a.13)}3(q a.1C!=="p"){2.1E=a.1C}3(q a.1j!=="p"){2.P=a.1j}3(q a.1x!=="p"){2.1f=a.1x}3(q a.18!=="p"){2.w=a.18}3(q a.A!=="p"){2.w=!a.A}3(q a.1l!=="p"){2.16=a.1l}3(2.4){2.1y()}};8.9.1Q=7(a){2.Q=a;3(2.4){3(2.z){r.s.u.Y(2.z);2.z=t}3(!2.R){2.4.6.D=""}3(q a.1u==="p"){2.4.O=2.G()+a}v{2.4.O=2.G();2.4.1a(a)}3(!2.R){2.4.6.D=2.4.Z+"12";3(q a.1u==="p"){2.4.O=2.G()+a}v{2.4.O=2.G();2.4.1a(a)}}2.1w()}r.s.u.T(2,"2z")};8.9.1q=7(a){2.B=a;3(2.4){2.1y()}r.s.u.T(2,"21")};8.9.22=7(a){2.15=a;3(2.4){2.4.6.13=a}r.s.u.T(2,"2y")};8.9.2x=7(a){2.w=!a;3(2.4){2.4.6.M=(2.w?"1c":"A")}};8.9.2w=7(){K 2.Q};8.9.1A=7(){K 2.B};8.9.2v=7(){K 2.15};8.9.2u=7(){5 a;3((q 2.1D()==="p")||(2.1D()===t)){a=J}v{a=!2.w}K a};8.9.3i=7(){2.w=J;3(2.4){2.4.6.M="A"}};8.9.3j=7(){2.w=L;3(2.4){2.4.6.M="1c"}};8.9.2s=7(c,b){5 a=2;3(b){2.B=b.1A();2.14=r.s.u.2r(b,"21",7(){a.1q(2.1A())})}2.1N(c);3(2.4){2.1F()}};8.9.1r=7(){5 i;3(2.z){r.s.u.Y(2.z);2.z=t}3(2.E){1o(i=0;i<2.E.1L;i++){r.s.u.Y(2.E[i])}2.E=t}3(2.14){r.s.u.Y(2.14);2.14=t}3(2.V){r.s.u.Y(2.V);2.V=t}2.1N(t)};',62,210,'||this|if|div_|var|style|function|InfoBox|prototype||||||||||||||||undefined|typeof|google|maps|null|event|else|isHidden_|||closeListener_|visible|position_|parseInt|width|eventListeners_|boxStyle|getCloseBoxImg_|pixelOffset_|yOffset|false|return|true|visibility|currentStyle|innerHTML|closeBoxURL_|content_|fixedWidthSet_|maxWidth_|trigger|position|contextListener_|left|opacity|removeListener|offsetWidth||right|px|zIndex|moveListener_|zIndex_|enableEventPropagation_|alignBottom_|isHidden|addDomListener|appendChild|top|hidden|setBoxStyle_|document|infoBoxClearance_|bottom|new|stopPropagation|closeBoxURL|height|enableEventPropagation|boxStyle_|alignBottom|for|boxClass_|setPosition|close|defaultView|boxClass|nodeType|content|addClickHandler_|infoBoxClearance|draw|pixelOffset|getPosition|disableAutoPan|closeBoxMargin|getMap|closeBoxMargin_|panBox_|maxWidth|disableAutoPan_|pane_|cursor|push|length|click|setMap|mouseover|getBoxWidths_|setContent|OverlayView|borderRightWidth|borderLeftWidth|borderBottomWidth|borderTopWidth|getComputedStyle|100|Size|preventDefault|cancelBubble|position_changed|setZIndex|getProjection|offsetHeight|createInfoBoxDiv_|getBounds|getCloseClickHandler_|margin|pointer|relative|align|src|img|floatPane|domready|pane|infoBox|contextmenu|default|apply|touchmove|touchend|touchstart|dblclick|mouseup|mouseout|addListener|open|mousedown|getVisible|getZIndex|getContent|setVisible|zindex_changed|content_changed|auto|setOptions|fromLatLngToDivPixel|overflow|LatLng|removeChild|parentNode|onRemove|documentElement|getPanes|gif|ownerDocument|absolute|mapfiles|alpha|filter|div|Opacity|createElement|en_us|Alpha|Microsoft|DXImageTransform|progid|intl|MsFilter|returnValue|translateZ|WebkitTransform|com|hasOwnProperty|in|cssText|className|www|panBy|getCenter|http|fromLatLngToContainerPixel|arguments|getDiv|setCenter|2px|contains|show|hide|Map|instanceof|closeclick|firstChild'.split('|'),0,{})); 680 681 google.maps.event.addListener(marker, 'click', function() { 682 clearInfoWindows(); 683 var infowidth = 0; 684 if ( maxbubblewidth <= 100 ) { 685 infowidth = document.getElementById("simplemap"); 686 if ( typeof infowidth != 'undefined' ) { 687 infowidth = infowidth.offsetWidth; 688 } else { 689 infowidth = 400; 690 } 691 infowidth = infowidth * (maxbubblewidth / 100.0); 692 } 693 if ( infowidth < maxbubblewidth ) infowidth = maxbubblewidth; 694 infowidth = parseInt(infowidth) + 'px'; 695/* 696 var infowindow = new google.maps.InfoWindow({ 697 maxWidth: infowidth, 698 content: html 699 }); 700*/ 701 702 var infowindow = new InfoBox({ 703 maxWidth: infowidth 704 ,content: html 705 ,disableAutoPan: false 706 ,pixelOffset: new google.maps.Size(-80,-80) 707 ,alignBottom: true 708 ,zIndex: null 709 ,boxStyle: { 710 opacity: 1.0 711 ,fontSize:'11pt' 712 } 713 ,closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif" 714 ,infoBoxClearance: new google.maps.Size(1, 1) 715 ,isHidden: false 716 ,pane: "floatPane" 717 ,enableEventPropagation: true 718 719 }); 720 infowindow.open(map, marker); 721 infowindowsArray.push(infowindow); 722 window.location = '#map_top'; 723 }); 724 725 return marker; 726 } 727 728 function createSidebarEntry(marker, locationData, searchData) { 729 var div = document.createElement('div'); 730 731 // Beginning of result 732 var html = '<div id="location_' + locationData.postid + '" class="result">'; 733 734 // Flagged special 735 if (locationData.special == 1 && special_text != '') { 736 html += '<div class="special">' + special_text + '</div>'; 737 } 738 739 // Name & distance 740 html += '<div class="result_name">'; 741 html += '<h3 style="margin-top: 0; padding-top: 0; border-top: none;">'; 742 if (locationData.permalink != null && locationData.permalink != '') { 743 html += '<a href="' + locationData.permalink + '">'; 744 } 745 html += locationData.name; 746 if (locationData.permalink != null && locationData.permalink != '') { 747 html += '</a>'; 748 } 749 750 if (locationData.distance.toFixed(1) != 'NaN') { 751 if (units == 'mi') { 752 html+= ' <small class="result_distance">
752' + locationData.distance.toFixed(1) + ' miles</small>'; 753 } 754 else if (units == 'km') { 755 html+= ' <small class="result_distance">' + (locationData.distance * 1.609344).toFixed(1) + ' km</small>'; 756 } 757 } 758 html += '</h3></div>'; 759 760 // Address 761 html += '<div class="result_address"><address>' + locationData.address; 762 if (locationData.address2 != '') { 763 html += '<br />' + locationData.address2; 764 } 765 766 if (address_format == 'town, province postalcode') { 767 html += '<br />' + locationData.city + ', ' + locationData.state + ' ' + locationData.zip + '</address></div>'; 768 } 769 else if (address_format == 'town province postalcode') { 770 html += '<br />' + locationData.city + ' ' + locationData.state + ' ' + locationData.zip + '</address></div>'; 771 } 772 else if (address_format == 'town-province postalcode') { 773 html += '<br />' + locationData.city + '-' + locationData.state + ' ' + locationData.zip + '</address></div>'; 774 } 775 else if (address_format == 'postalcode town-province') { 776 html += '<br />' + locationData.zip + ' ' + locationData.city + '-' + locationData.state + '</address></div>'; 777 } 778 else if (address_format == 'postalcode town, province') { 779 html += '<br />' + locationData.zip + ' ' + locationData.city + ', ' + locationData.state + '</address></div>'; 780 } 781 else if (address_format == 'postalcode town') { 782 html += '<br />' + locationData.zip + ' ' + locationData.city + '</address></div>'; 783 } 784 else if (address_format == 'town postalcode') { 785 html += '<br />' + locationData.city + ' ' + locationData.zip + '</address></div>'; 786 } 787 788 // Phone, email, and fax numbers 789 html += '<div class="result_phone">'; 790 if (locationData.phone != null && locationData.phone != '') { 791 html += '<span class="result_phone">' + phone_text + ': <a href="tel:' + locationData.phone + '">' + locationData.phone + '</a></span>'; 792 } 793 if (locationData.email != null && locationData.email != '') { 794 html += '<span class="result_email">' + email_text + ': <a href="mailto:' + locationData.email + '">' + locationData.email + '</a></span>'; 795 } 796 if (locationData.fax != null && locationData.fax != '') { 797 html += '<span class="result_fax">' + fax_text + ': ' + locationData.fax + '</span>'; 798 } 799 html += '</div>'; 800 801 // Links section 802 html += '<div class="result_links">'; 803 804 // Visit Website link 805 html += '<div class="result_website">'; 806 if (locationData.url != null && locationData.url != 'http://' && locationData.url != '') { 807 html += '<a href="' + locationData.url + '" title="' + locationData.name + '" target="_blank">' + visit_website_text + '</a>'; 808 } 809 html += '</div>'; 810 811 // Get Directions link 812 if (locationData.distance.toFixed(1) != 'NaN') { 813 var dir_address = locationData.point.toUrlValue(10); 814 var dir_address2 = ''; 815 if (locationData.address) { dir_address2 += locationData.address; } 816 if (locationData.city) { if ( '' != dir_address2 ) { dir_address2 += ' '; } dir_address2 += locationData.city }; 817 if (locationData.state) { if ( '' != dir_address2 ) { dir_address2 += ' '; } dir_address2 += locationData.state }; 818 if (locationData.zip) { if ( '' != dir_address2 ) { dir_address2 += ' '; } dir_address2 += locationData.zip }; 819 if (locationData.country) { if ( '' != dir_address2 ) { dir_address2 += ' '; } dir_address2 += locationData.country }; 820 if ( '' != dir_address2 ) { dir_address += '(' + escape( dir_address2 ) + ')' }; 821 822 html += '<a class="result_directions" href="http://google' + default_domain + '/maps?saddr=' + searchData.homeAddress + '&daddr=' + dir_address + '" target="_blank">' + get_directions_text + '</a>'; 823 } 824 html += '</div>'; 825 html += '<div style="clear: both;"></div>'; 826 827 828 // Taxonomy lists 829 for (jstax in locationData.taxes) { 830 if ( locationData.taxes[jstax] != null && locationData.taxes[jstax] != '' ) { 831 html += '<div class="' + jstax + '_list"><small><strong>' + taxonomy_text[jstax] + ':</strong> ' + locationData.taxes[jstax] + '</small></div>'; 832 } 833 } 834 835 // End of result 836 html += '</div>'; 837 838 div.innerHTML = html; 839 div.style.cursor = 'pointer'; 840 div.style.margin = 0; 841 google.maps.event.addDomListener(div, 'click', function() { 842 google.maps.event.trigger(marker, 'click'); 843 }); 844 return div; 845 } 846
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.