Current File : /home/pacjaorg/wpt.pacja.org/km/components/com_sppagebuilder/assets/js/gmap.js |
/**
* @package SP Page Builder
* @author JoomShaper http://www.joomshaper.com
* @copyright Copyright (c) 2010 - 2023 JoomShaper
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
*/
function initSPPageBuilderGMap(t){var e={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",decode:function(t){var a,r,o,n,d,i,s="",c=0;for(t=t.replace(/[^A-Za-z0-9+/=]/g,"");c<t.length;)a=this._keyStr.indexOf(t.charAt(c++))<<2|(n=this._keyStr.indexOf(t.charAt(c++)))>>4,r=(15&n)<<4|(d=this._keyStr.indexOf(t.charAt(c++)))>>2,o=(3&d)<<6|(i=this._keyStr.indexOf(t.charAt(c++))),s+=String.fromCharCode(a),64!=d&&(s+=String.fromCharCode(r)),64!=i&&(s+=String.fromCharCode(o));return s=e._utf8_decode(s)},_utf8_decode:function(t){for(var e="",a=0,r=c1=c2=0;a<t.length;)(r=t.charCodeAt(a))<128?(e+=String.fromCharCode(r),a++):r>191&&r<224?(c2=t.charCodeAt(a+1),e+=String.fromCharCode((31&r)<<6|63&c2),a+=2):(c2=t.charCodeAt(a+1),c3=t.charCodeAt(a+2),e+=String.fromCharCode((15&r)<<12|(63&c2)<<6|63&c3),a+=3);return e}};jQuery(".sppb-addon-gmap-canvas",t).each((function(a){var r=jQuery(this).attr("id"),o=Number(jQuery(this).attr("data-mapzoom")),n=jQuery(this).attr("data-infowindow"),d="true"===jQuery(this).attr("data-mousescroll"),i="true"===jQuery(this).attr("data-show-controll"),s=jQuery(this).attr("data-maptype"),c={lat:Number(jQuery(this).attr("data-lat")),lng:Number(jQuery(this).attr("data-lng"))},u=new google.maps.Map(t.getElementById(r),{center:new google.maps.LatLng(c),zoom:o,scrollwheel:d,disableDefaultUI:i,mapId:r});if(void 0!==jQuery(this).attr("data-location")){for(var l=jQuery(this).attr("data-lat"),h=jQuery(this).attr("data-lng"),g=e.decode(n),p=JSON.stringify([{address:g,latitude:l,longitude:h}]),f=e.decode(jQuery(this).attr("data-location")),m=JSON.parse(p),y=JSON.parse(f),C=m.concat(y),S=[],j=0;j<C.length;j++){var Q=C[j];S.push([Q.address]+";"+[Q.latitude]+";"+[Q.longitude])}for(var v=[],w=0;w<S.length;w++)v.push(S[w].split(";"));var A,k=v;n=new google.maps.InfoWindow;for(j=0;j<k.length;j++)A=new google.maps.marker.AdvancedMarkerElement({position:new google.maps.LatLng(k[j][1],k[j][2]),map:u}),google.maps.event.addListener(A,"click",function(t,e){return function(){k[e][0]&&(n.setContent(k[e][0]),n.open(u,t))}}(A,j))}u.setMapTypeId(google.maps.MapTypeId[s])}))}jQuery(window).on("load",(function(){initSPPageBuilderGMap(document)}));