1/** 2 * Front-end JavaScript for Business Profile maps 3 * 4 * @copyright Copyright (c) 2016, Theme of the Crop 5 * @license GPL-2.0+ 6 * @since 0.0.1 7 */ 8var bpfwp_map=bpfwp_map||{};function bpInitializeMap(){'use strict';bpfwp_map.maps=bpfwp_map.maps||{};bpfwp_map.info_windows=bpfwp_map.info_windows||{};jQuery('.bp-map').each(function(){var id=jQuery(this).attr('id');var data=jQuery(this).data();if(data.bpfwpInitialized){return} 9if(bpfwp_map.lazy_ready&&!data.bpfwpVisible){return} 10jQuery(this).data('bpfwpInitialized',!0);data.address=String(data.address||'');data.addressURI=encodeURIComponent(data.address.replace(/(<([^>]+)>)/ig,', '));if('undefined'!==typeof google&&google.maps&&Number.isFinite(Number(data.lat))&&Number.isFinite(Number(data.lon))){data.addressURI=encodeURIComponent(data.address.replace(/(<([^>]+)>)/ig,', '));var options=Object.assign({},bpfwp_map.map_options||{});options.center=new google.maps.LatLng(data.lat,data.lon);if(typeof options.zoom==='undefined'){options.zoom=15} 11bpfwp_map.maps[id]=new google.maps.Map(document.getElementById(id),options);var content=document.createElement('div');content.className='bp-map-info-window';[String(data.name||''),data.address,String(data.phone||'')].forEach(function(text){var paragraph=document.createElement('p');paragraph.textContent=text;content.appendChild(paragraph)});var link=document.createElement('a');link.target='_blank';link.rel='noopener noreferrer';link.href='https://maps.google.com/maps?saddr=current+location&daddr='+data.addressURI;link.textContent=bpfwp_map.strings.getDirections;content.appendChild(link);bpfwp_map.info_windows[id]=new google.maps.InfoWindow({position:options.center,content:content});bpfwp_map.info_windows[id].open(bpfwp_map.maps[id]);jQuery(this).trigger('bpfwp.map_initialized',[id,bpfwp_map.maps[id],bpfwp_map.info_windows[id]])}else if(''!==data.address){var bpMapIframe=document.createElement('iframe');bpMapIframe.frameBorder=0;bpMapIframe.title=String(data.name||data.address);bpMapIframe.loading='lazy';bpMapIframe.style.width='100%';bpMapIframe.style.height='100%';if(''!==data.name){data.address=data.name+','+data.address} 12bpMapIframe.src='//maps.google.com/maps?output=embed&q='+encodeURIComponent(data.address);bpMapIframe.src='//maps.google.com/maps?output=embed&q='+data.addressURI;jQuery(this).html(bpMapIframe);jQuery(this).trigger('bpfwp.map_initialized_in_iframe',[jQuery(this)])}})} 13function bp_initialize_map(){bpInitializeMap()} 14jQuery(document).ready(function(){'use strict';if(!bpfwp_map.autoload_google_maps){return} 15if(!document.querySelector('.bp-map')){return} 16function loadMaps(){if('undefined'===typeof google||'undefined'===typeof google.maps){if(bpfwp_map.loading){return} 17bpfwp_map.loading=!0;var bpMapScript=document.createElement('script');bpMapScript.type='text/javascript';bpMapScript.onerror=function(){bpfwp_map.loading=!1;jQuery('.bp-map').each(function(){if(!jQuery(this).data('bpfwpInitialized')){jQuery(this).text(bpfwp_map.strings.loadError).attr('role','status')}})};bpMapScript.src='//maps.googleapis.com/maps/api/js?v=3.exp&callback=bp_initialize_map&loading=async';if('undefined'!==typeof bpfwp_map.google_maps_api_key){bpMapScript.src+='&key='+encodeURIComponent(bpfwp_map.google_maps_api_key)} 18document.body.appendChild(bpMapScript)}else{bp_initialize_map()}} 19if('IntersectionObserver' in window){bpfwp_map.lazy_ready=!0;var observer=new IntersectionObserver(function(entries){entries.forEach(function(entry){if(!entry.isIntersecting){return} 20jQuery(entry.target).data('bpfwpVisible',!0);observer.unobserve(entry.target);loadMaps()})},{rootMargin:'200px'});document.querySelectorAll('.bp-map').forEach(function(map){observer.observe(map)})}else{loadMaps()}})
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.