PageSourceSearch

https://merrypeople.com/cdn/shop/t/72/assets/geo-locate.js?v=103529793326499016711781745020

js merrypeople.com collected 2026-09-24 19:53:47 UTC 3,685 bytes, 2 lines download raw bytes

1(async()=>{const WORKER="https://mp-geo-detect.harvey-1c7.workers.dev",TIMEZONE="Australia/Melbourne",geoLocate=window.themeVariables?.settings?.geoLocate??{},MINUTES_PER_DAY=1440,TIME_RE=/^\d{1,2}:\d{2}$/,DAY_INDEX={mon:0,tue:1,wed:2,thu:3,fri:4,sat:5,sun:6},dayToIndex=day=>{if(typeof day=="string")return DAY_INDEX[day.trim().toLowerCase().slice(0,3)]},isValidTime=time=>{if(typeof time!="string"||!TIME_RE.test(time))return!1;const[hour,minute]=time.split(":").map(Number);return hour<=23&&minute<=59},timeToMinutes=time=>{const[hour,minute]=time.split(":").map(Number);return hour*60+minute},toMinuteOfWeek=(dayIndex,time)=>dayIndex*MINUTES_PER_DAY+timeToMinutes(time),currentMinuteOfWeek=(timezone,context)=>{let parts;try{parts=Object.fromEntries(new Intl.DateTimeFormat("en-AU",{timeZone:timezone,weekday:"short",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(new Date).map(({type,value})=>[type,value]))}catch(error){return console.error(`[geo-locate] failed to resolve time in "${timezone}" (${context}); hiding geo message.`,error),null}const dayIndex=dayToIndex(parts.weekday),hour=Number(parts.hour),minute=Number(parts.minute);return dayIndex===void 0||Number.isNaN(hour)||Number.isNaN(minute)?(console.error(`[geo-locate] could not derive current time in "${timezone}" (${context}); hiding geo message.`),null):dayIndex*MINUTES_PER_DAY+hour*60+minute},isWithinWindow=(now,start,end)=>start>end?now>=start||now<end:now>=start&&now<end,scheduleSettingsError=schedule=>dayToIndex(schedule.startDay)===void 0?`invalid startDay: ${JSON.stringify(schedule.startDay)}`:dayToIndex(schedule.endDay)===void 0?`invalid endDay: ${JSON.stringify(schedule.endDay)}`:isValidTime(schedule.startTime)?isValidTime(schedule.endTime)?null:`invalid endTime: ${JSON.stringify(schedule.endTime)}`:`invalid startTime: ${JSON.stringify(schedule.startTime)}`,withinSchedule=()=>{if(!geoLocate.enabled)return!0;const settingsError=scheduleSettingsError(geoLocate);if(settingsError)return console.error(`[geo-locate] geo schedule enabled but ${settingsError}.`),!1;const now=currentMinuteOfWeek(TIMEZONE,"schedule");if(now===null)return!1;const start=toMinuteOfWeek(dayToIndex(geoLocate.startDay),geoLocate.startTime),end=toMinuteOfWeek(dayToIndex(geoLocate.endDay),geoLocate.endTime);return isWithinWindow(now,start,end)},pastCutoff=()=>{const cutoffTime=geoLocate.cutoffTime;if(!cutoffTime||cutoffTime.trim()==="")return!1;if(!isValidTime(cutoffTime))return console.error(`[geo-locate] invalid cutoffTime: ${JSON.stringify(cutoffTime)}`),!0;const now=currentMinuteOfWeek(TIMEZONE,"cutoff");return now===null?!0:now%MINUTES_PER_DAY>timeToMinutes(cutoffTime)},getExchangeId=()=>{const cookie=document.cookie.match(/__kla_id=([^;]+)/)?.[1];if(!cookie)return null;try{return JSON.parse(atob(decodeURIComponent(cookie))).$exchange_id||null}catch{return null}},revealIfWithinRange=async(el,kx2)=>{const params=new URLSearchParams({kx:kx2,country:"AU",address:el.dataset.geoAddress,distances:el.dataset.geoDistance,region:el.dataset.geoRegion});try{const res=await fetch(`${WORKER}/?${params}`);if(!res.ok)throw new Error(`Worker responded with HTTP ${res.status}`);const{within}=await res.json();within&&(el.hidden=!1)}catch(error){console.warn("[geo-locate] geo detection request failed; message left hidden.",error)}};if(!withinSchedule()||pastCutoff())return;const kx=getExchangeId();if(!kx)return;const elements=[...document.querySelectorAll("[data-geo-address][data-geo-distance][data-geo-region]")];elements.length&&await Promise.all(elements.map(el=>revealIfWithinRange(el,kx)))})();
2//# sourceMappingURL=/cdn/shop/t/72/assets/geo-locate.js.map?v=103529793326499016711781745020

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.