PageSourceSearch

https://www.melita.com/wp-content/plugins/melita-custom-landing-pa…/find-a-shop-template.min.js?ver=1

js melita.com collected 2026-09-24 09:30:35 UTC 10,972 bytes, 1 lines download raw bytes

1!function(t){let e,o,s,n,a=WPURLS.siteurl,i=WPURLS.pluginDirUrl,l=35.8914314,d=14.4585224,p=11,r=11,c=16,u=["mt"],h="mt",m=!1,g=!1,f=[],y=[];window.dataLayer=window.dataLayer||[];let w,v,_="Open",b="Closed",x=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],T="Today",S="Opening hours (current week)",k=500,C=function(){let t=0;return function(e,o){clearTimeout(t),t=setTimeout(e,o)}}();function P(t,o){e={lat:t,lng:o};let n={minZoom:r,maxZoom:c,center:new google.maps.LatLng(t,o),mapTypeId:google.maps.MapTypeId.ROADMAP,fullscreenControl:!1};map=new google.maps.Map(document.getElementById("map"),n),map.setCenter(e),map.setZoom(p),$(map,p,map.getZoom()),s=new google.maps.InfoWindow({pixelOffset:new google.maps.Size(0,-35)});let a=document.getElementById("pac-input"),i={componentRestrictions:{country:u}};searchBox=new google.maps.places.Autocomplete(a,i),google.maps.event.addListener(map,"idle",(function(){M(s)})),google.maps.event.addListener(map,"zoom_changed",(function(){map.getZoom()<r&&map.setZoom(r)})),google.maps.event.addListener(map,"click",(function(){s&&s.close()})),searchBox.addListener("place_changed",(function(){let e=searchBox.getPlace();0!=e.length&&(e.geometry?(e.geometry.viewport?map.fitBounds(e.geometry.viewport):map.setCenter(e.geometry.location),t=e.geometry.location.lat(),o=e.geometry.location.lng(),window.dataLayer.push({event:"mapsSearchBoxTrigger",mapsSearchValue:e.formatted_address})):console.log("Returned place contains no geometry"))}))}function M(e){t(".shops-list .no-results").removeClass("active"),t(".shops-list .loading").addClass("active");let s=map.getBounds();searchBox.setBounds(s);let p=s.getNorthEast().lat(),r=s.getNorthEast().lng(),c=s.getSouthWest
1().lat(),u=s.getSouthWest().lng(),h=a+"/wp-json/shops/v1/get-shops?lng="+d+"&lat="+l+"&nelat="+p+"&nelng="+r+"&swlat="+c+"&swlng="+u;C((function(){t.ajax({type:"GET",dataType:"json",contentType:"application/json",url:h,context:this,success:function(s){t(".shops-found").html(""),t(".shops-list .loading").removeClass("active");let a={outlets:[],resellers:[],topup:[],topupSim:[]};if(void 0!==s.shop_details){var l=t(".shops-found");t.each(s.shop_details,(function(t,e){let o={lat:e.shop_latitude,lng:e.shop_longitude,id:e.shop_id,type:e.shop_type.toLowerCase().split(" ").join("-"),distance:e.distance,html:'<div class="details"> \t\t\t\t\t\t\t\t\t\t\t<h3 class="title">'+e.shop_name+'</h3> \t\t\t\t\t\t\t\t\t\t\t<span class="address">'+e.shop_address+'</span> \t\t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t\t<div class="distance"> \t\t\t\t\t\t\t\t\t\t\t<span>'+Math.round(100*e.distance)/100+" Km</span> \t\t\t\t\t\t\t\t\t\t</div>"};"melita-point"==o.type?a.outlets.push(o):"melita-reseller"==o.type?a.resellers.push(o):"topup"==o.type?a.topup.push(o):"topup-and-sim"==o.type&&a.topupSim.push(o)}))}else t(".shops-list .no-results").addClass("active");function d(s,a){let d={minimumClusterSize:2,styles:[{height:65,width:65,url:i+`img/find-a-shop/melita-shop-cluster-icon-${a}.png`,textColor:"#FFFFFF",textSize:10}]};s=s.map((function(o,s){let d=new google.maps.Marker({position:o,animation:g?"":google.maps.Animation.DROP,icon:{url:i+`img/find-a-shop/melita-shop-pin-icon-${a}.svg`,scaledSize:new google.maps.Size(21,30)},id:o.id});return d.addListener("click",(function(){event.stopPropagation();let t=d.getPosition().lat(),o=d.getPosition().lng();(!function(t){let o=e.getMap();return null!=o}()||!n||n.lat!=t&&n.lng!=o)&&I(d)})),t("<li/>",{html:o.html,addClass:"shop-item "+o.type,css:{order:(100*o.distance).toFixed()},click:function(){t(".shops-list-wrap.open").removeClass("open"),"hidden"==t("body").css("overflow")&&t("body").css("overflow","auto"),google.maps.event.trigger(d,"click")}}).appendTo(l),g=!0,d})),o=new MarkerClusterer(map,s,d),t(".opening-hours .hours-list-wrap").find(".hours-list").hide(),t(".opening-hours .hours-list-wrap .hours-today").unbind("click").click((function(e){t(this).parent().find(".hours-list").stop().slideToggle(),t(this).parent().toggleClass("active")})),f=o.getMarkers(),t.each(s,(function(t,e){0==f.some((function(t){return t.id==e.id}))&&o.addMarker(e,!0)})),t.each(f,(function(t,e){0==s.some((function(t){return t.id==e.id}))&&y.push(e)})),t.each(y,(function(t,e){o.removeMarker(e)})),o.repaint()}if(d(a.outlets,"blue"),d(a.resellers,"pink"),d(a.topupSim,"green"),d(a.topup,"black"),!m){let e=t(".legend-item");t.each(a,(function(o,s){if(s.length){let s=Array.from(e).find((t=>t.classList.contains(o)));t(s).css("display","flex")}})),t("legend").addClass("show"),m=!0}},error:function(){console.log("API could not be reached")}})}),k)}function I(e){e.isAdded=!1,e.map=!1;let o=a+"/wp-json/shops/v1/get-shop-details?id="+e.id;t.ajax({type:"GET",dataType:"json",async:!1,contentType:"application/json",url:o,context:this,success:function(o){if(void 0!==o.shop_details){s.close();let a,i,p,r,u=Object.keys(o.shop_details[0].shop_opening_hours).map((function(t){return o.shop_details[0].shop_opening_hours[t]})),m="",g="https://www.google.com/maps/dir/"+(l+","+d)+"/"+(e.getPosition().lat()+","+e.getPosition().lng())+"/hl="+h,f=o.shop_details[0].shop_type;w=new Date,v=w.getDay(),0==v&&(v=7);let y=w.getHours()+w.getMinutes()/100,k=moment().format("M-D"),C=[];null!==o.shop_details[0].special_hours&&o.shop_details[0].special_hours.special_days&&(t.each(o.shop_details[0].special_hours.special_days,(function(t,e){let o=e.week?L(e.day,e.week)[0]:L(e.day)[parseFloat(e.day_number)-1],s=e.day_schedule;C.push({date:moment(o,"ddd, MMM DD YYYY HH:mm:ss ZZ").format("M-D"),hours:s})})),p=k in o.shop_details[0].special_hours.public_holiday,r=o.shop_details[0].special_hours.public_holiday[k],t.each(C,(function(t,e){if(e.date==k)return a=e.hours,!1})));let P=moment().startOf("isoWeek"),M=moment().endOf("isoWeek"),I=[],$=P;for(;$<=M;)I.push($.format("M-D")),$=$.clone().add(1,"d");t.each(u,(function(e,s){if(null!==s){let n=I[e]in o.shop_details[0].special_hours.public_holiday,l=o.shop_details[0].special_hours.public_holiday[I[e]];index=e+1,t.each(C,(function(t,o){if(o.date==I[e])return s=o.hours,!1})),m+='<li class="hours-item'+(index==v?" active":"")+(n?" holiday":"")+("Closed"==s?" closed":"")+'" data-day="'+index+'">\t\t\t\t\t\t\t\t<span>'+x[e]+":</span> "+("Closed"!=s||n?n?l:s:b)+(n?" - (Public Holiday)":"")+"</li>",index==v&&(a="Closed"==s?b:n?l:s);let d=[],p=[],r=[];if(a&&a!=b){let e=a.split(/, (?=[^,]+:)/).map((function(t){return t.split(" - ")}));t.each(e,(function(t,e){p=e[0].split(/\s*\:\s*/g),r=e[1].split(/\s*\:\s*/g),d.push({start:parseInt(p[0],10)+parseInt(p[1],10)/100,stop:parseInt(r[0],10)+parseInt(r[1],10)/100})}))}else i=b;t.each(d,(function(t,e){if(y>=e.start&&y<e.stop)return i=_,!1;i=b}))}}));let D='<div class="shop-notes">\t\t\t\t\t\t\t\t\t\t\t\t<i class="note-icon fa-duotone fa-circle-info"></i>\t\t\t\t\t\t\t\t\t\t\t\t<span class="note-text">'+o.shop_details[0].shop_notes+"</span>\t\t\t\t\t\t\t\t\t\t\t</div>",O="Topup"!=f&&"Topup and SIM"!=f,A=`<div class="infowindow"> \n\t\t\t\t\t\t<header class="infowindow-header ${O?"":"end-xs"}"> \n\t\t\t\t\t\t\t\t${O?`<span class="status ${i==_?"open":"closed"}">${i}</span>`:""} \n\t\t\t\t\t\t\t\t<a class="directions fa-solid fa-diamond-turn-right" href="${g}" target="_blank"></a> \n\t\t\t\t\t\t</header> \n\t\t\t\t\t\t<div class="infowindow-content"> \n\t\t\t\t\t\t\t<div class="shop-img" style="background-image:url(${o.shop_details[0].shop_img});"></div>\n\t\t\t\t\t\t\t<div class="details"> \n\t\t\t\t\t\t\t\t<h3 class="title">${o.shop_details[0].shop_name}</h3> \n\t\t\t\t\t\t\t\t<span class="address">${o.shop_details[0].shop_address}</span> \n\t\t\t\t\t\t\t\t<span class="contact-numbers">${o.shop_details[0].shop_contact_numbers}</span>\n\t\t\t\t\t\t\t</div> \n\t\t\t\t\t\t\t${O?`<div class="opening-hours"> \n\t\t\t\t\t\t\t\t<h3 class="title">${S}</h3>\n\t\t\t\t\t\t\t\t${o.shop_details[0].shop_notes?D:""}
1\n\t\t\t\t\t\t\t\t<div class="hours-list-wrap ${i!=_||p?"closed":"open"}"> \n\t\t\t\t\t\t\t\t\t<div class="hours-today ${p?"holiday":""}">\n\t\t\t\t\t\t\t\t\t\t<span>${T+": "+(p?r+" - (Public Holiday)":a)}</span>\n\t\t\t\t\t\t\t\t\t</div> \n\t\t\t\t\t\t\t\t\t<ul class="hours-list" style="display: none;"> \n\t\t\t\t\t\t\t\t\t\t${m}\n\t\t\t\t\t\t\t\t\t</ul> \n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>`:""}\n\t\t\t\t\t\t</div> \n\t\t\t\t\t</div>`;window.dataLayer.push({event:"mapsPinTrigger",mapsShopNameSelected:o.shop_details[0].shop_name}),map.setZoom(c),map.setCenter(e.getPosition());let B=document.getElementById("map").clientHeight,E=140;map.panBy(0,-(B/2-E)),s.setContent(A),s.setPosition(e.getPosition()),n={lat:e.getPosition().lat(),lng:e.getPosition().lng()},s.open(map)}},error:function(){console.log("API could not be reached")}})}function L(t,e){let o={Monday:1,Tuesday:2,Wednesday:3,Thursday:4,Friday:5,Saturday:6,Sunday:7},s=e?moment().isoWeek(e).isoWeekday(o[t]):moment().startOf("month").day(o[t]),n=[];if(!e&&s.date()>7){s.add(7,"d");let t=s.month();for(;t===s.month();)n.push(s.toString()),s.add(7,"d")}else n.push(s.toString());return n}function $(t,e,o){if(!(o>=e))return z=google.maps.event.addListener(t,"zoom_changed",(function(s){google.maps.event.removeListener(z),$(t,e,o+1)})),setTimeout((function(){t.setZoom(o)}),80),!0}t(document).ready((function(e){!function(){if(navigator.geolocation){var t=setTimeout((function(){s()}),1e3*1+500);navigator.geolocation.getCurrentPosition(e,o,{maximumAge:18e5,timeout:6e4})}else alert(!1?"":"Error: Your browser doesn't support geolocation.");function e(e){clearTimeout(t),P(e.coords.latitude,e.coords.longitude),l=e.coords.latitude,d=e.coords.longitude,function(t,e){let o={url:i+"img/find-a-shop/icon-my-location.svg",scaledSize:new google.maps.Size(30,30)},s={lat:t,lng:e};new google.maps.Marker({position:s,animation:google.maps.Animation.DROP,map:map,icon:o})}(e.coords.latitude,e.coords.longitude)}function o(n){switch(clearTimeout(t),n.code){case n.TIMEOUT:s(),navigator.geolocation.getCurrentPosition(e,o);break;case n.POSITION_UNAVAILABLE:case n.PERMISSION_DENIED:s()}}function s(){P(l,d)}}(),t(".search-box .search-input").on("input",(function(){t(".search-box .search-input").val().length>0?(t(".search-box .search-icon").hide(),t(".search-box .close-icon").show()):(t(".search-box .search-icon").show(),t(".search-box .close-icon").hide())})),t(".search-box").on("click",".close-icon",(function(e){e.stopPropagation(),e.preventDefault(),t(".search-box .search-input").val(""),t(".search-box .search-icon").show(),t(".search-box .close-icon").hide()})),t(".shops-list-wrap").on("click",".shops-list-handler",(function(e){e.stopPropagation(),t("html,body").animate({scrollTop:0},500),t(this).parent().toggleClass("open"),"hidden"==t("body").css("overflow")?t("body").css("overflow","auto"):t("body").css("overflow","hidden")})),t(".shop-finder:not(.show)").addClass("show"),t(window).scroll((function(){t(window).scrollTop()>60?t(".shop-finder").removeClass("show"):t(".shop-finder").addClass("show")}))}))}(jQuery);

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.