luv-assets 1.2.14 → 1.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/js/js.min.js CHANGED
@@ -1 +1 @@
1
- function isStrictMode(){return function(){return!this}()}function isSurportedLoading(){return"loading"in HTMLImageElement.prototype}function isLikelyMobile(){const ua=navigator.userAgent;if(/Android|iPhone|BlackBerry|Opera Mini|IEMobile|Mobile|Tablet/i.test(ua)){return true}if(navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1){return true}if(screen.width<=768&&"ontouchstart"in window){return true}return false}function openWindow(url,target){var width=750;var height=600;var screenX=typeof window.screenX!=="undefined"?window.screenX:window.screenLeft;var screenY=typeof window.screenY!=="undefined"?window.screenY:window.screenTop;var outerWidth=typeof window.outerWidth!=="undefined"?window.outerWidth:document.body.clientWidth;var outerHeight=typeof window.outerHeight!=="undefined"?window.outerHeight:document.body.clientHeight-22;var left=parseInt(screenX+(outerWidth-width)/2,10);var top=parseInt(screenY+(outerHeight-height)/2.5,10);var features=["width="+width,"height="+height,"left="+left,"top="+top,"menubar=no","toolbar=no","location=no","personalbar=no","status=no","scrollbars=yes"].join(",");target=target||"_blank";var newwindow;try{newwindow=window.open(url,target,features);if(newwindow){try{if(window.focus){newwindow.focus()}}catch(focusError){console.warn("focusError:",focusError)}return false}else{alert(translations.popupBlocked);return true}}catch(openError){console.error("openError:",openError);window.location.href=url;return false}}function isLikelyAutomated(){const ua=navigator.userAgent;if(typeof isbot==="function"&&isbot(ua)){return true}else{if(/Googlebot|Bingbot|YandexBot|Baiduspider|DuckDuckBot|Slurp|Sogou|Applebot/i.test(ua)){return true}}if(navigator.webdriver===true||/HeadlessChrome|PhantomJS|Selenium|Puppeteer|Cypress|Playwright/i.test(ua)){return true}if(screen.width===0||screen.height===0){return true}let domContentLoadedTime=null;if(performance.getEntriesByType){const entries=performance.getEntriesByType("navigation");if(entries.length>0){domContentLoadedTime=entries[0].domContentLoadedEventEnd}}if(domContentLoadedTime===null&&performance.timing){domContentLoadedTime=performance.timing.domContentLoadedEventEnd-performance.timing.navigationStart}if(domContentLoadedTime!==null&&domContentLoadedTime>0&&domContentLoadedTime<10){return true}return false}window.TrackingPolicy={isDebug:function(){return window.location.search.indexOf("debug=1")>-1||typeof window.DEBUG_TRACKING!=="undefined"&&window.DEBUG_TRACKING}(),isAllowed:function(){if(getCookie("tracking_consent")==="0")return false;if(getCookie("tracking_consent")==="1")return true;return true}(),log:function(...args){if(this.isDebug){console.log("[Tracking]",...args)}},warn:function(...args){console.warn("[Tracking Warn]",...args)},error:function(...args){console.error("[Tracking Error]",...args)}};function setCookieTimestamp(name,value,expiresAt){const expires=new Date(expiresAt*1e3);document.cookie=`${name}=${value}; expires=${expires.toUTCString()}; path=/`}function setCookie(name,value,days){days=days||30;var expires="";var date=new Date;date.setTime(date.getTime()+days*24*60*60*1e3);expires="; expires="+date.toUTCString();document.cookie=name+"="+encodeURIComponent(value)+expires+"; path=/"}function getCookie(name){var v=document.cookie.match("(^|;) ?"+name+"=([^;]*)(;|$)");return v?decodeURIComponent(v[2]):null}const UrlUtils={create:(url,origin=window.location.origin)=>new URL(url,origin),getCurrentParams:()=>new URLSearchParams(window.location.search),mergeParams:(url,paramsObj)=>{const newUrl=typeof url==="string"?new URL(url,window.location.origin):url;Object.keys(paramsObj).forEach(key=>{if(paramsObj[key]!==undefined&&paramsObj[key]!==null){newUrl.searchParams.set(key,paramsObj[key])}});return newUrl.toString()},buildQuery:paramsObj=>{const params=new URLSearchParams;Object.keys(paramsObj).forEach(key=>{if(paramsObj[key]!==undefined&&paramsObj[key]!==null){params.set(key,paramsObj[key])}});return params.toString()},getEffectiveRootDomain:host=>{if(typeof host!=="string")return null;const parts=host.toLowerCase().split(".").filter(p=>p.length>0);if(parts.length<2)return host;const TWO_PART_SUFFIXES=new Set(["co.uk"]);if(parts.length>=3){const lastTwo=parts.slice(-2).join(".");if(TWO_PART_SUFFIXES.has(lastTwo)){return parts.slice(-3).join(".")}}return parts.slice(-2).join(".")},isValidUrl:url=>{if(typeof url!=="string"||!url.startsWith("https://")){return false}try{new URL(url);return true}catch{return false}},isSameDomain:(mainUrl,candidateUrl)=>{if(!UrlUtils.isValidUrl(mainUrl)||!UrlUtils.isValidUrl(candidateUrl)){return false}try{const mainHost=new URL(mainUrl).host;const candidateHost=new URL(candidateUrl).host;const mainRoot=UrlUtils.getEffectiveRootDomain(mainHost);const candidateRoot=UrlUtils.getEffectiveRootDomain(candidateHost);return mainRoot===candidateRoot}catch{return false}},getQueryParam:(name,url)=>{url=url||window.location.href;try{var params=new URL(url).searchParams;return params.get(name)||""}catch(e){var regex=new RegExp("[?&]"+escapeRegExp(name)+"=([^&]*)");var match=regex.exec(url);if(match){return decodeURIComponent((match[1]||"").replace(/\+/g," "))}return""}},getPathParam:(key,path=window.location.pathname)=>{const parts=path.split("/").filter(Boolean);for(let i=0;i<parts.length-1;i++){if(parts[i]===key){try{return decodeURIComponent(parts[i+1].replace(/\+/g," "))}catch(e){return parts[i+1]}}}return""},addQueryParam:(param,value,url)=>{try{var urlObj=new URL(url,window.location.origin);urlObj.searchParams.set(param,value);return urlObj.href}catch(e){var hashSplit=url.split("#");var baseUrl=hashSplit[0];var hash=hashSplit[1]||"";var regex=new RegExp("[?&]"+escapeRegExp(param)+"=([^&]*)");var hasParam=regex.test(baseUrl);var encodedValue=encodeURIComponent(value);if(hasParam){baseUrl=baseUrl.replace(regex,function(match,p1,offset,str){return match.charAt(0)+param+"="+encodedValue})}else{var separator=baseUrl.indexOf("?")===-1?"?":"&";baseUrl+=separator+param+"="+encodedValue}return hash?baseUrl+"#"+hash:baseUrl}},buildFriendlyUrl:(param,value,url)=>{try{const urlObj=new URL(url,window.location.origin);let pathname=urlObj.pathname;const safeParam=param.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");const friendlyRegex=new RegExp(`/${safeParam}/[^/?#]+/?`);pathname=pathname.replace(friendlyRegex,"");const trailingRegex=new RegExp(`/${safeParam}$`);pathname=pathname.replace(trailingRegex,"");pathname=pathname.replace(/\/+$/,"");pathname+=`/${param}/${encodeURIComponent(value)}/`;urlObj.pathname=pathname;return urlObj.href}catch(error){console.error("UrlUtils.buildFriendlyUrl failed:",error,{param:param,value:value,url:url});let cleanUrl=url.split("#")[0];const hash=url.includes("#")?url.slice(url.indexOf("#")):"";cleanUrl=cleanUrl.replace(new RegExp(`/${param}/[^/?#]+/?`),"");cleanUrl=cleanUrl.replace(new RegExp(`/${param}$`),"");cleanUrl=cleanUrl.replace(/\/+$/,"");return`${cleanUrl}/${param}/${value}/${hash}`}}};function getBrowserData(){return{deviceChannel:"browser",screenWidth:screen.width||0,screenHeight:screen.height||0,colorDepth:screen.colorDepth||0,language:(navigator.language||"en").split("-")[0],timezoneOffset:(new Date).getTimezoneOffset(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||"Unknown",javaScriptEnabled:true,userAgent:navigator.userAgent}}function getBrowserDataWithBowser(){var browserData=getBrowserData();if(typeof bowser!=="undefined"&&typeof bowser.getParser==="function"){try{var parser=bowser.getParser(navigator.userAgent);var result=parser.getResult();browserData.browserName=result.browser?.name||"Unknown";browserData.browserVersion=result.browser?.version||"";browserData.osName=result.os?.name||"Unknown";browserData.osVersion=result.os?.version||"";browserData.platform=result.platform?.type||"desktop";browserData.deviceVendor=result.platform?.vendor||"";browserData.engineName=result.engine?.name||"Unknown"}catch(e){TrackingPolicy.error("bowser parse error:",e)}}if(typeof browserData.browserName==="undefined"){var ua=navigator.userAgent;browserData.browserName="Unknown";browserData.browserVersion="";if(/iPad|iPhone|iPod/.test(ua)){browserData.osName="iOS";browserData.osVersion="";browserData.platform="mobile"}else if(/Android/.test(ua)){browserData.osName="Android";browserData.osVersion="";browserData.platform="mobile"}browserData.deviceVendor="";browserData.engineName="Unknown"}return browserData}window.AffiliateTracker={_config:null,_hasRun:false,_getBrowserData:function(){return getBrowserDataWithBowser()},_shouldTrack:function(aff,cookieAff){if(!aff)return false;var rule=this._config.affiliate_credit;if(rule==="first"&&cookieAff)return false;if(rule==="last"&&cookieAff&&cookieAff===aff)return false;return true},_sendToServer:function(aff){var payload={event:"affiliate",browser:this._getBrowserData(),data:{aff:aff,landing_url:document.URL,referrer_url:document.referrer}};TrackingPolicy.log("Sending affiliate click:",aff,payload);fetch(this._config.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(payload),keepalive:true}).then(function(res){if(!res.ok)throw new Error("HTTP "+res.status);return res.json()}).then(function(data){if(data.visit_id>0){setCookie("luv_aff",data.aff,this._config.cookie_duration);setCookie("luv_visit",data.visit_id,this._config.cookie_duration);TrackingPolicy.log("Affiliate tracked. Visit ID:",data.visit_id)}}.bind(this)).catch(function(err){TrackingPolicy.error("Affiliate tracking failed:",err)})},init:function(){if(this._hasRun)return;this._hasRun=true;if(!TrackingPolicy.isAllowed){TrackingPolicy.log("Affiliate tracking skipped: consent declined.");return}if(typeof window.affiliate_config==="undefined"){return}if(isLikelyAutomated()){TrackingPolicy.log("Automated traffic detected, skipping tracking.");return}this._config=window.affiliate_config;var aff=UrlUtils.getQueryParam(this._config.affiliate_keyword)||UrlUtils.getPathParam(this._config.affiliate_keyword);var cookieAff=getCookie("luv_aff");if(this._shouldTrack(aff,cookieAff)){this._sendToServer(aff)}else{TrackingPolicy.log("Affiliate skipped:",{aff:aff,cookieAff:cookieAff,rule:this._config.affiliate_credit})}}};window.PageTracker={_config:null,_hasRun:false,_getBrowserData:function(){return getBrowserDataWithBowser()},_shouldTrack:function(){if(typeof this._config.payload==="undefined"){return false}if(typeof this._config.payload.data==="undefined"){return false}if(Array.isArray(this._config.payload.data)&&this._config.payload.data.length===0){return false}return true},_sendToServer:function(){var payload=this._config.payload;payload.browser=this._getBrowserData();TrackingPolicy.log("Sending page view:",payload);fetch(this._config.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(payload),keepalive:true}).then(function(res){if(!res.ok)throw new Error("HTTP "+res.status);return res.json()}).then(function(data){TrackingPolicy.log("Page tracked.")}.bind(this)).catch(function(err){TrackingPolicy.error("Page tracking failed:",err)})},init:function(){if(this._hasRun)return;this._hasRun=true;if(typeof window.trace_config==="undefined"){return}if(isLikelyAutomated()){TrackingPolicy.log("Automated traffic detected, skipping tracking.");return}this._config=window.trace_config;if(this._shouldTrack()){this._sendToServer()}else{TrackingPolicy.log("Page tracking skipped:",{config:this._config})}}};window.UserTimezone={_storageKeyReported:"utz_reported",_storageKeyTimezone:"utz_value",_getStorage:function(key){try{return localStorage.getItem(key)}catch(e){return null}},_setStorage:function(key,value){try{localStorage.setItem(key,value)}catch(e){}},_shouldReport:function(currentTz){if(!currentTz)return false;var lastTz=this._getStorage(this._storageKeyTimezone);var hasReported=this._getStorage(this._storageKeyReported)==="1";return!hasReported||lastTz!==currentTz},_markAsReported:function(timezone){this._setStorage(this._storageKeyReported,"1");if(timezone){this._setStorage(this._storageKeyTimezone,timezone)}},getBrowserTimezone:function(){try{if(window.Intl&&Intl.DateTimeFormat){return Intl.DateTimeFormat().resolvedOptions().timeZone}}catch(e){TrackingPolicy.error("Timezone detection failed:",e)}return null},sendToServer:function(timezone){if(!timezone)return;TrackingPolicy.log("Reporting timezone:",timezone);var data={timezone:timezone};if(typeof csrfName!=="undefined"){data[csrfName]=csrfVal}$.ajax({url:userTimezoneUrl,method:"POST",data:data,timeout:5e3,success:function(res){if(res&&res.success){window.UserTimezone._markAsReported(timezone)}else{window.UserTimezone._markAsReported(timezone)}},error:function(){TrackingPolicy.error("Timezone report failed:",arguments);window.UserTimezone._markAsReported(timezone)}})},init:function(){if(!TrackingPolicy.isAllowed){TrackingPolicy.log("Timezone reporting skipped: consent declined.");return}var tz=this.getBrowserTimezone();if(tz&&this._shouldReport(tz)){this.sendToServer(tz)}else{TrackingPolicy.log("Timezone not reported.",{tz:tz,should:false})}}};function webLoadScript(url,callback){var script=document.createElement("script");script.type="text/javascript";if(typeof callback!="undefined"){if(script.readyState){script.onreadystatechange=function(){if(script.readyState=="loaded"||script.readyState=="complete"){script.onreadystatechange=null;callback()}}}else{script.onload=function(){callback()}}}script.src=url;document.body.appendChild(script)}function isValidEmail(email){const re=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return re.test(email)}function check_email(email){if(!email||email==""){return false}const myreg=/^([a-zA-Z0-9]+[_|\_|\.|-|\-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.|-|\-]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;if(!myreg.test(email)){return false}return true}function check_pass(str){const re=/^\w{6,30}$/;if(re.test(str)){return true}else{return false}}function showToast(msg,element){element=element||"#toast-js";const toastEl=$(element);if(toastEl){$(element).find(".toast-body").text(msg);const toast=bootstrap.Toast.getOrCreateInstance(toastEl[0]);toast.show()}}function showError($el,message,$input){$el.text(message).removeClass("d-none");$input.addClass("is-invalid")}function hideError($el,$input){$el.addClass("d-none");$input.removeClass("is-invalid")}function copyTextToClipboard(text){return new Promise(function(resolve){if(navigator.clipboard&&window.isSecureContext){navigator.clipboard.writeText(text).then(function(){resolve(true)}).catch(function(err){console.warn("Clipboard API failed, falling back to execCommand:",err);resolve(fallbackCopyText(text))})}else{resolve(fallbackCopyText(text))}})}function fallbackCopyText(text){var textarea=document.createElement("textarea");textarea.value=text;textarea.style.position="fixed";textarea.style.opacity="0";document.body.appendChild(textarea);textarea.select();try{var success=document.execCommand("copy");document.body.removeChild(textarea);return success}catch(err){document.body.removeChild(textarea);return false}}$(function(){if(typeof affiliate_config!=="undefined"){try{AffiliateTracker.init()}catch(e){}}if(typeof trace_config!=="undefined"){try{PageTracker.init()}catch(e){}}if(typeof userTimezoneUrl!=="undefined"){try{UserTimezone.init()}catch(e){}}if(typeof promoCouponConfig!=="undefined"&&promoCouponConfig.checkPromo&&!PromoBannerManager.isClosedToday(promoCouponConfig.promoZoneId)){$("[data-promo-zone]").each(function(){const $el=$(this);const zone=$el.data("promo-zone");let requestData={};requestData["zone"]=zone;const attr_group=$el.data("attr-group");if(attr_group){requestData["group"]=attr_group}const spu=$el.data("spu");if(spu){requestData["spu"]=spu}$.get(promoCouponConfig.promoCouponUrl,requestData).done(function(res){if(res.success&&res.html){PromoBannerManager.renderPromoBanner($el,res.html)}}).fail(function(){})})}if(typeof memberCheckUrl!=="undefined"){const ajax_params={};if(typeof product_id!=="undefined"){ajax_params["product_id"]=product_id}$.ajax({async:true,timeout:6e3,dataType:"json",type:"get",data:ajax_params,url:memberCheckUrl,success:function(data,textStatus){if(data.loginStatus){$("#header-welcome-js").removeClass("d-none");$("#header-email-js").text(data.customer_email);$("#header-login-js").addClass("d-none")}if(data.favorite){$("#product-favorite-js").addClass("text-danger")}if(data.favorite_product_count){$("#favorite-count-js").text(data.favorite_product_count)}if(data.affiliate){$("#affiliate-link-js").show()}if(data.cart_qty){$(".cart-item-count-js").text(data.cart_qty)}},error:function(XMLHttpRequest,textStatus,errorThrown){}})}$("#subscribe_btn").click(function(){var $btn=$(this);$btn.prop("disabled",true);email=$("#subscribe_email").val();if(!check_email(email)){alert("Enter your email address");$btn.prop("disabled",false);return false}$.ajax({dataType:"json",type:"post",data:{email:email},url:"/member/account/subscribe",success:function(data,textStatus){$btn.prop("disabled",false);if(data.success){alert(data.message);$("#subscribe_email").val("")}else{alert(data.message)}},error:function(error){alert("Oops! Something went wrong. Please try again in a few minutes.");$btn.prop("disabled",false)}})})});window.SearchHistory={config:{HISTORY_KEY:"search_history",MAX_LENGTH:20,SYNC_INTERVAL_MINUTES:15,KEYWORD_MAX_LENGTH:100,SAFE_KEYWORD_PATTERN:/^[\p{L}\p{N}\s.;:'"!?-]+$/u},isValidKeyword:function(keyword){if(typeof keyword!=="string")return false;const t=keyword.trim();return t.length>0&&t.length<=this.config.KEYWORD_MAX_LENGTH},isValidKeywordWithRegex:function(keyword,maxLength){if(typeof keyword!=="string")return false;maxLength=maxLength||this.config.KEYWORD_MAX_LENGTH;var trimmed=keyword.trim();if(!trimmed||trimmed.length>maxLength)return false;return this.config.SAFE_KEYWORD_PATTERN.test(trimmed)},getLocalHistory:function(){var raw=localStorage.getItem(this.config.HISTORY_KEY);if(!raw){return{update_time:null,last_sync_time:null,data:[]}}try{var history=JSON.parse(raw);if(Array.isArray(history)){history={update_time:null,last_sync_time:null,data:history};localStorage.setItem(this.config.HISTORY_KEY,JSON.stringify(history))}if(!history.data||!Array.isArray(history.data))history.data=[];return history}catch(e){return{update_time:null,last_sync_time:null,data:[]}}},saveToLocal:function(keyword){if(!this.isValidKeyword(keyword))return false;var h=this.getLocalHistory();var k=keyword.trim();h.data=h.data.filter(x=>x!==k);h.data.unshift(k);if(h.data.length>this.config.MAX_LENGTH){h.data=h.data.slice(0,this.config.MAX_LENGTH)}h.update_time=(new Date).toISOString();localStorage.setItem(this.config.HISTORY_KEY,JSON.stringify(h));return true},removeFromLocal:function(keyword){if(keyword==null){localStorage.removeItem(this.config.HISTORY_KEY);return}var h=this.getLocalHistory();var k=String(keyword).trim();h.data=h.data.filter(x=>x!==k);h.update_time=(new Date).toISOString();localStorage.setItem(this.config.HISTORY_KEY,JSON.stringify(h))},isSyncNeeded:function(localHistory){if(!localHistory||!localHistory.last_sync_time)return true;var diff=(new Date-new Date(localHistory.last_sync_time))/(1e3*60);return diff>this.config.SYNC_INTERVAL_MINUTES},mergeWithServer:function(serverKeywords){if(!Array.isArray(serverKeywords))return;var local=this.getLocalHistory();local.last_sync_time=(new Date).toISOString();var seen={};var merged=[];local.data.forEach(k=>{if(this.isValidKeyword(k)&&!seen[k]){seen[k]=true;merged.push(k)}});serverKeywords.forEach(k=>{if(this.isValidKeyword(k)&&!seen[k]){seen[k]=true;merged.push(k)}});local.data=merged.slice(0,this.config.MAX_LENGTH);local.update_time=(new Date).toISOString();localStorage.setItem(this.config.HISTORY_KEY,JSON.stringify(local))},pullFromServer:function(url){var local=this.getLocalHistory();if(!this.isSyncNeeded(local))return;$.ajax({url:url,type:"GET",dataType:"json",timeout:6e3,success:data=>{if(data&&Array.isArray(data.data)){this.mergeWithServer(data.data)}},error:()=>{}})},pushToServer:function(url,keyword){if(!this.isValidKeyword(keyword))return;$.ajax({url:url,type:"POST",data:{keyword:keyword.trim()},dataType:"json",timeout:6e3,error:()=>{}})},removeFromServer:function(url,keyword){var data=keyword!=null?{keyword:keyword}:{};$.ajax({url:url,type:"POST",data:data,dataType:"json",timeout:6e3,error:()=>{}})},save:function(keyword,serverUrl){if(this.saveToLocal(keyword)&&serverUrl){this.pushToServer(serverUrl,keyword)}},getKeywords:function(){return this.getLocalHistory().data},clear:function(serverUrl){this.removeFromLocal();if(serverUrl)this.removeFromServer(serverUrl)}};window.PromoBannerManager=function(){"use strict";const CONFIG={EXPIRE_KEY_SUFFIX:"_expires",CLOSED_KEY_SUFFIX:"_closed"};function setSafeStorage(key,value,expiresAtTimestamp=null){try{if(typeof Storage!=="undefined"){localStorage.setItem(key,value);if(expiresAtTimestamp){localStorage.setItem(key+CONFIG.EXPIRE_KEY_SUFFIX,expiresAtTimestamp)}}else if(typeof Storage!=="undefined"){sessionStorage.setItem(key,value)}}catch(e){}}function getSafeStorage(key){try{const storedValue=localStorage.getItem(key);if(storedValue!==null){const expireKey=key+CONFIG.EXPIRE_KEY_SUFFIX;const expireTime=localStorage.getItem(expireKey);if(expireTime){const now=Math.floor(Date.now()/1e3);if(now>=parseInt(expireTime,10)){localStorage.removeItem(key);localStorage.removeItem(expireKey);return null}}return storedValue}return sessionStorage.getItem(key)}catch(e){return null}}function getEndOfDayTimestamp(){const now=new Date;const endOfDay=new Date(now.getFullYear(),now.getMonth(),now.getDate()+1);return Math.floor(endOfDay.getTime()/1e3)}function isClosedToday(promoId){const key=promoId+CONFIG.CLOSED_KEY_SUFFIX;if(TrackingPolicy.isAllowed){return getCookie(key)==="true"}return getSafeStorage(key)==="true"}function setCookieTimestamp(name,value,expiresAt){const expires=new Date(expiresAt*1e3);document.cookie=`${name}=${value}; expires=${expires.toUTCString()}; path=/`}function setCloseForToday(promoId){const key=promoId+CONFIG.CLOSED_KEY_SUFFIX;const expiresAt=getEndOfDayTimestamp();console.log("expiresAt",expiresAt);if(TrackingPolicy.isAllowed){setCookieTimestamp(key,"true",expiresAt)}else{setSafeStorage(key,"true",expiresAt)}}function renderPromoBanner($container,promoData){$container.html(promoData);$container.find(".btn-close").on("click",function(){setCloseForToday(promoCouponConfig.promoZoneId);$container.remove()});$container.find(".btn-claim-js").on("click",function(){var $btn=$(this);if($btn.prop("disabled")){return false}$btn.prop("disabled",true).text(promoCouponConfig.translations.claimIng);var coupon_code=$btn.data("coupon-code").trim();var $data={coupon_code:coupon_code};if(typeof promoCouponConfig.csrfName!="undefined"){$data[promoCouponConfig.csrfName]=promoCouponConfig.csrfVal}$.ajax({timeout:6e3,dataType:"json",type:"post",data:$data,url:promoCouponConfig.couponClaimUrl,success:function(data,textStatus){showToast(data.message,"#promo-toast-js");console.log("ajax success",data);if(data.status=="success"){console.log("claim success");$btn.closest(".claim-status-js").html(`\n <span class="fw-bold text-success">${coupon_code}</span>\n <span class="badge bg-success">${promoCouponConfig.translations.claimed}</span>\n `)}$btn.prop("disabled",false).text(promoCouponConfig.translations.claim)},error:function(XMLHttpRequest,textStatus,errorThrown){alert(promoCouponConfig.translations.systemError);$btn.prop("disabled",false).text(promoCouponConfig.translations.claim)}})})}return{renderPromoBanner:renderPromoBanner,isClosedToday:isClosedToday,setCloseForToday:setCloseForToday,setSafeStorage:setSafeStorage,getSafeStorage:getSafeStorage,getEndOfDayTimestamp:getEndOfDayTimestamp}}();window.I18nHelper=function(){"use strict";function getLocale(){if(typeof window.APP_CONFIG!=="undefined"&&typeof window.APP_CONFIG.locale!=="undefined"){return window.APP_CONFIG.locale}const htmlLang=document.documentElement.lang;if(htmlLang){return htmlLang}return"en-US"}function getCurrency(){if(window.APP_CONFIG&&window.APP_CONFIG.currency){return window.APP_CONFIG.currency}const locale=getLocale();if(locale.startsWith("de"))return"EUR";if(locale.startsWith("fr"))return"EUR";if(locale.startsWith("en-GB"))return"GBP";if(locale.startsWith("en"))return"USD";return"USD"}const hasIntl=typeof Intl!=="undefined"&&Intl.NumberFormat&&Intl.DateTimeFormat;function formatCurrency(amount,currency=null,locale=null){currency=currency||getCurrency();locale=locale||getLocale();if(hasIntl){try{return new Intl.NumberFormat(locale,{style:"currency",currency:currency,minimumFractionDigits:2,maximumFractionDigits:2}).format(amount)}catch(e){console.warn("Currency format fallback:",e)}}const sign=currency==="GBP"?"£":currency==="EUR"?"€":currency==="USD"?"$":currency+" ";return sign+parseFloat(amount).toFixed(2)}function formatDate(date,locale=null,options={}){locale=locale||getLocale();const defaultOptions={year:"numeric",month:"short",day:"numeric"};options=Object.assign(defaultOptions,options);if(hasIntl){try{return new Intl.DateTimeFormat(locale,options).format(new Date(date))}catch(e){console.warn("Date format fallback:",e)}}const d=new Date(date);return d.getFullYear()+"-"+String(d.getMonth()+1).padStart(2,"0")+"-"+String(d.getDate()).padStart(2,"0")}function formatDateTime(date,locale=null,options={}){locale=locale||getLocale();const defaultOptions={year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};options=Object.assign(defaultOptions,options);if(hasIntl){try{return new Intl.DateTimeFormat(locale,options).format(new Date(date))}catch(e){console.warn("DateTime format fallback:",e)}}const d=new Date(date);return formatDate(d)+" "+String(d.getHours()).padStart(2,"0")+":"+String(d.getMinutes()).padStart(2,"0")}function formatNumber(number,locale=null,fractionDigits=0){locale=locale||getLocale();if(hasIntl){try{return new Intl.NumberFormat(locale,{minimumFractionDigits:fractionDigits,maximumFractionDigits:fractionDigits}).format(number)}catch(e){console.warn("Number format fallback:",e)}}return parseFloat(number).toLocaleString("en-US",{minimumFractionDigits:fractionDigits,maximumFractionDigits:fractionDigits})}return{formatCurrency:formatCurrency,formatDate:formatDate,formatDateTime:formatDateTime,formatNumber:formatNumber,getLocale:getLocale,getCurrency:getCurrency}}();function isValidSearchKeyword(keyword,maxLength=100){keyword=keyword.trim();if(keyword===""){return false}if(keyword.length>maxLength){return false}const safePattern=/^[\p{L}\p{N}\s.;:'"!?-]+$/u;if(!safePattern.test(keyword)){return false}const escapedKeyword=keyword.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");return true}const historyKey="search_history";function pullSearchHistory(Url){let localHistory=getCompatibleSearchHistoryFromLocalStorage();if(!isSyncNeeded(localHistory)){return}$.ajax({async:true,timeout:6e3,dataType:"json",type:"get",url:Url,success:function(data,textStatus){if(data.data.length>0){mergeLocalSearchHistory(data.data)}},error:function(XMLHttpRequest,textStatus,errorThrown){}})}function removeHistory(url,keyword){data={};if(keyword){data["keyword"]=keyword}$.ajax({async:true,timeout:6e3,dataType:"json",data:data,type:"post",url:url,success:function(data,textStatus){},error:function(XMLHttpRequest,textStatus,errorThrown){}})}function saveOneSearchHistory(keyword,Url){$.ajax({async:true,timeout:6e3,dataType:"json",type:"post",url:Url,data:{keyword:keyword},success:function(data,textStatus){},error:function(XMLHttpRequest,textStatus,errorThrown){}})}function saveSearchToLocalStorage(keyword){let searchHistory=getCompatibleSearchHistoryFromLocalStorage();const index=searchHistory.data.indexOf(keyword);if(index>-1){searchHistory.data.splice(index,1)}searchHistory.data.unshift(keyword);if(searchHistory.data.length>maxSearchHistoryLength){searchHistory.data=searchHistory.data.slice(0,maxSearchHistoryLength)}searchHistory.update_time=(new Date).toISOString();localStorage.setItem(historyKey,JSON.stringify(searchHistory))}function removeSearchFromLocalStorage(keyword){let searchHistory=JSON.parse(localStorage.getItem(historyKey));if(searchHistory&&Array.isArray(searchHistory.data)){if(keyword){searchHistory.data=searchHistory.data.filter(item=>item!==keyword)}else{localStorage.removeItem(historyKey);return}searchHistory.update_time=(new Date).toISOString();localStorage.setItem(historyKey,JSON.stringify(searchHistory));return}else{localStorage.removeItem(historyKey);return}}function getSearchHistoryFromLocalStorage(){let searchHistory=JSON.parse(localStorage.getItem(historyKey))||{update_time:null,last_sync_time:null,data:[]};return searchHistory}function getCompatibleSearchHistoryFromLocalStorage(){const rawHistory=localStorage.getItem(historyKey);if(!rawHistory){return{update_time:null,last_sync_time:null,data:[]}}let history;try{history=JSON.parse(rawHistory)}catch(e){console.error("Failed to parse history:",e);return{update_time:null,last_sync_time:null,data:[]}}if(Array.isArray(history)){history={update_time:null,last_sync_time:null,data:history};localStorage.setItem(historyKey,JSON.stringify(history))}return history}function isSyncNeeded(history){if(!history||!history.last_sync_time)return true;const lastSyncTime=new Date(history.last_sync_time);const currentTime=new Date;const diffInMinutes=(currentTime-lastSyncTime)/(1e3*60);return diffInMinutes>15}function mergeLocalSearchHistory(serverHistory){let localHistory=getCompatibleSearchHistoryFromLocalStorage();localHistory.last_sync_time=(new Date).toISOString();let mergedData=Array.from(new Set([...localHistory.data,...serverHistory]));localHistory.data=mergedData;localStorage.setItem(historyKey,JSON.stringify(localHistory))}function is_valid_url(url){var regex=new RegExp(/^(https?|s):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i);return regex.test(url)}function is_same_domain(base_url,custom_url){base_url=base_url.replace("http://","").replace("https://","").replace("www.","").replace("m.","").split(/[/?#]/)[0];custom_url=custom_url.replace("http://","").replace("https://","").replace("www.","").replace("m.","").split(/[/?#]/)[0];return base_url==custom_url||base_url.indexOf(custom_url)!=-1||custom_url.indexOf(base_url)!=-1}function process_friendly_url(param,value,url){var hash=url.split("#")[1];url=url.split("#")[0];var re=new RegExp("([/]"+param+"[/][^?]*)"),match=re.exec(url);var re2=new RegExp("([?].*)"),match2=re2.exec(url);if(match&&match[0])url=url.replace(match[0],"");if(match2&&match2[0])url=url.replace(match2[0],"");var re3=new RegExp("([/]"+param+"$)"),match3=re3.exec(url);if(match3&&match3[0])url=url.replace(match3[0],"");url=url.replace(/\/+$/,"");url=url+"/"+param+"/"+value+"/";if(match2&&match2[0])url=url+match2[0];if(hash)url+="#"+hash;return url}function add_query_arg(param,value,url){var re=new RegExp("[\\?&]"+param+"=([^&#]*)"),match=re.exec(url),delimiter,newString;var hash=url.split("#")[1];url=url.split("#")[0];if(match===null){var hasQuestionMark=/\?/.test(url);delimiter=hasQuestionMark?"&":"?";newString=url+delimiter+param+"="+value}else{delimiter=match[0].charAt(0);newString=url.replace(re,delimiter+param+"="+value)}if(hash){newString+="#"+hash}return newString}
1
+ function isStrictMode(){return function(){return!this}()}function isSurportedLoading(){return"loading"in HTMLImageElement.prototype}function isLikelyMobile(){const ua=navigator.userAgent;if(/Android|iPhone|BlackBerry|Opera Mini|IEMobile|Mobile|Tablet/i.test(ua)){return true}if(navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1){return true}if(screen.width<=768&&"ontouchstart"in window){return true}return false}function openWindow(url,target){var width=750;var height=600;var screenX=typeof window.screenX!=="undefined"?window.screenX:window.screenLeft;var screenY=typeof window.screenY!=="undefined"?window.screenY:window.screenTop;var outerWidth=typeof window.outerWidth!=="undefined"?window.outerWidth:document.body.clientWidth;var outerHeight=typeof window.outerHeight!=="undefined"?window.outerHeight:document.body.clientHeight-22;var left=parseInt(screenX+(outerWidth-width)/2,10);var top=parseInt(screenY+(outerHeight-height)/2.5,10);var features=["width="+width,"height="+height,"left="+left,"top="+top,"menubar=no","toolbar=no","location=no","personalbar=no","status=no","scrollbars=yes"].join(",");target=target||"_blank";var newwindow;try{newwindow=window.open(url,target,features);if(newwindow){try{if(window.focus){newwindow.focus()}}catch(focusError){console.warn("focusError:",focusError)}return false}else{alert(translations.popupBlocked);return true}}catch(openError){console.error("openError:",openError);window.location.href=url;return false}}function isLikelyAutomated(){const ua=navigator.userAgent;if(typeof isbot==="function"&&isbot(ua)){return true}else{if(/Googlebot|Bingbot|YandexBot|Baiduspider|DuckDuckBot|Slurp|Sogou|Applebot/i.test(ua)){return true}}if(navigator.webdriver===true||/HeadlessChrome|PhantomJS|Selenium|Puppeteer|Cypress|Playwright/i.test(ua)){return true}if(screen.width===0||screen.height===0){return true}let domContentLoadedTime=null;if(performance.getEntriesByType){const entries=performance.getEntriesByType("navigation");if(entries.length>0){domContentLoadedTime=entries[0].domContentLoadedEventEnd}}if(domContentLoadedTime===null&&performance.timing){domContentLoadedTime=performance.timing.domContentLoadedEventEnd-performance.timing.navigationStart}if(domContentLoadedTime!==null&&domContentLoadedTime>0&&domContentLoadedTime<10){return true}return false}window.TrackingPolicy={isDebug:function(){return window.location.search.indexOf("debug=1")>-1||typeof window.DEBUG_TRACKING!=="undefined"&&window.DEBUG_TRACKING}(),isAllowed:function(){if(getCookie("tracking_consent")==="0")return false;if(getCookie("tracking_consent")==="1")return true;return true}(),log:function(...args){if(this.isDebug){console.log("[Tracking]",...args)}},warn:function(...args){console.warn("[Tracking Warn]",...args)},error:function(...args){console.error("[Tracking Error]",...args)}};function setCookieTimestamp(name,value,expiresAt){const expires=new Date(expiresAt*1e3);document.cookie=`${name}=${value}; expires=${expires.toUTCString()}; path=/`}function setCookie(name,value,days){days=days||30;var expires="";var date=new Date;date.setTime(date.getTime()+days*24*60*60*1e3);expires="; expires="+date.toUTCString();document.cookie=name+"="+encodeURIComponent(value)+expires+"; path=/"}function getCookie(name){var v=document.cookie.match("(^|;) ?"+name+"=([^;]*)(;|$)");return v?decodeURIComponent(v[2]):null}const UrlUtils={create:(url,origin=window.location.origin)=>new URL(url,origin),getCurrentParams:()=>new URLSearchParams(window.location.search),mergeParams:(url,paramsObj)=>{const newUrl=typeof url==="string"?new URL(url,window.location.origin):url;Object.keys(paramsObj).forEach(key=>{if(paramsObj[key]!==undefined&&paramsObj[key]!==null){newUrl.searchParams.set(key,paramsObj[key])}});return newUrl.toString()},buildQuery:paramsObj=>{const params=new URLSearchParams;Object.keys(paramsObj).forEach(key=>{if(paramsObj[key]!==undefined&&paramsObj[key]!==null){params.set(key,paramsObj[key])}});return params.toString()},getEffectiveRootDomain:host=>{if(typeof host!=="string")return null;const parts=host.toLowerCase().split(".").filter(p=>p.length>0);if(parts.length<2)return host;const TWO_PART_SUFFIXES=new Set(["co.uk"]);if(parts.length>=3){const lastTwo=parts.slice(-2).join(".");if(TWO_PART_SUFFIXES.has(lastTwo)){return parts.slice(-3).join(".")}}return parts.slice(-2).join(".")},isValidUrl:url=>{if(typeof url!=="string"||!url.startsWith("https://")){return false}try{new URL(url);return true}catch{return false}},isSameDomain:(mainUrl,candidateUrl)=>{if(!UrlUtils.isValidUrl(mainUrl)||!UrlUtils.isValidUrl(candidateUrl)){return false}try{const mainHost=new URL(mainUrl).host;const candidateHost=new URL(candidateUrl).host;const mainRoot=UrlUtils.getEffectiveRootDomain(mainHost);const candidateRoot=UrlUtils.getEffectiveRootDomain(candidateHost);return mainRoot===candidateRoot}catch{return false}},getQueryParam:(name,url)=>{url=url||window.location.href;try{var params=new URL(url).searchParams;return params.get(name)||""}catch(e){var regex=new RegExp("[?&]"+escapeRegExp(name)+"=([^&]*)");var match=regex.exec(url);if(match){return decodeURIComponent((match[1]||"").replace(/\+/g," "))}return""}},getPathParam:(key,path=window.location.pathname)=>{const parts=path.split("/").filter(Boolean);for(let i=0;i<parts.length-1;i++){if(parts[i]===key){try{return decodeURIComponent(parts[i+1].replace(/\+/g," "))}catch(e){return parts[i+1]}}}return""},addQueryParam:(param,value,url)=>{try{var urlObj=new URL(url,window.location.origin);urlObj.searchParams.set(param,value);return urlObj.href}catch(e){var hashSplit=url.split("#");var baseUrl=hashSplit[0];var hash=hashSplit[1]||"";var regex=new RegExp("[?&]"+escapeRegExp(param)+"=([^&]*)");var hasParam=regex.test(baseUrl);var encodedValue=encodeURIComponent(value);if(hasParam){baseUrl=baseUrl.replace(regex,function(match,p1,offset,str){return match.charAt(0)+param+"="+encodedValue})}else{var separator=baseUrl.indexOf("?")===-1?"?":"&";baseUrl+=separator+param+"="+encodedValue}return hash?baseUrl+"#"+hash:baseUrl}},buildFriendlyUrl:(param,value,url)=>{try{const urlObj=new URL(url,window.location.origin);let pathname=urlObj.pathname;const safeParam=param.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");const friendlyRegex=new RegExp(`/${safeParam}/[^/?#]+/?`);pathname=pathname.replace(friendlyRegex,"");const trailingRegex=new RegExp(`/${safeParam}$`);pathname=pathname.replace(trailingRegex,"");pathname=pathname.replace(/\/+$/,"");pathname+=`/${param}/${encodeURIComponent(value)}/`;urlObj.pathname=pathname;return urlObj.href}catch(error){console.error("UrlUtils.buildFriendlyUrl failed:",error,{param:param,value:value,url:url});let cleanUrl=url.split("#")[0];const hash=url.includes("#")?url.slice(url.indexOf("#")):"";cleanUrl=cleanUrl.replace(new RegExp(`/${param}/[^/?#]+/?`),"");cleanUrl=cleanUrl.replace(new RegExp(`/${param}$`),"");cleanUrl=cleanUrl.replace(/\/+$/,"");return`${cleanUrl}/${param}/${value}/${hash}`}}};function getBrowserData(){return{deviceChannel:"browser",screenWidth:screen.width||0,screenHeight:screen.height||0,colorDepth:screen.colorDepth||0,language:(navigator.language||"en").split("-")[0],timezoneOffset:(new Date).getTimezoneOffset(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||"Unknown",javaScriptEnabled:true,userAgent:navigator.userAgent}}function getBrowserDataWithBowser(){var browserData=getBrowserData();if(typeof bowser!=="undefined"&&typeof bowser.getParser==="function"){try{var parser=bowser.getParser(navigator.userAgent);var result=parser.getResult();browserData.browserName=result.browser?.name||"Unknown";browserData.browserVersion=result.browser?.version||"";browserData.osName=result.os?.name||"Unknown";browserData.osVersion=result.os?.version||"";browserData.platform=result.platform?.type||"desktop";browserData.deviceVendor=result.platform?.vendor||"";browserData.engineName=result.engine?.name||"Unknown"}catch(e){TrackingPolicy.error("bowser parse error:",e)}}if(typeof browserData.browserName==="undefined"){var ua=navigator.userAgent;browserData.browserName="Unknown";browserData.browserVersion="";if(/iPad|iPhone|iPod/.test(ua)){browserData.osName="iOS";browserData.osVersion="";browserData.platform="mobile"}else if(/Android/.test(ua)){browserData.osName="Android";browserData.osVersion="";browserData.platform="mobile"}browserData.deviceVendor="";browserData.engineName="Unknown"}return browserData}window.AffiliateTracker={_config:null,_hasRun:false,_getBrowserData:function(){return getBrowserDataWithBowser()},_shouldTrack:function(aff,cookieAff){if(!aff)return false;var rule=this._config.affiliate_credit;if(rule==="first"&&cookieAff)return false;if(rule==="last"&&cookieAff&&cookieAff===aff)return false;return true},_sendToServer:function(aff){var payload={event:"affiliate",browser:this._getBrowserData(),data:{aff:aff,landing_url:document.URL,referrer_url:document.referrer}};TrackingPolicy.log("Sending affiliate click:",aff,payload);fetch(this._config.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(payload),keepalive:true}).then(function(res){if(!res.ok)throw new Error("HTTP "+res.status);return res.json()}).then(function(data){if(data.visit_id>0){setCookie("luv_aff",data.aff,this._config.cookie_duration);setCookie("luv_visit",data.visit_id,this._config.cookie_duration);TrackingPolicy.log("Affiliate tracked. Visit ID:",data.visit_id)}}.bind(this)).catch(function(err){TrackingPolicy.error("Affiliate tracking failed:",err)})},init:function(){if(this._hasRun)return;this._hasRun=true;if(!TrackingPolicy.isAllowed){TrackingPolicy.log("Affiliate tracking skipped: consent declined.");return}if(typeof window.affiliate_config==="undefined"){return}if(isLikelyAutomated()){TrackingPolicy.log("Automated traffic detected, skipping tracking.");return}this._config=window.affiliate_config;var aff=UrlUtils.getQueryParam(this._config.affiliate_keyword)||UrlUtils.getPathParam(this._config.affiliate_keyword);var cookieAff=getCookie("luv_aff");if(this._shouldTrack(aff,cookieAff)){this._sendToServer(aff)}else{TrackingPolicy.log("Affiliate skipped:",{aff:aff,cookieAff:cookieAff,rule:this._config.affiliate_credit})}}};window.PageTracker={_config:null,_hasRun:false,_getBrowserData:function(){return getBrowserDataWithBowser()},_shouldTrack:function(){if(typeof this._config.payload==="undefined"){return false}if(typeof this._config.payload.data==="undefined"){return false}if(Array.isArray(this._config.payload.data)&&this._config.payload.data.length===0){return false}return true},_sendToServer:function(){var payload=this._config.payload;payload.browser=this._getBrowserData();TrackingPolicy.log("Sending page view:",payload);if(typeof payload.browser.timezone!=="undefined"&&payload.browser.timezone==="Asia/Shanghai"){return}fetch(this._config.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(payload),keepalive:true}).then(function(res){if(!res.ok)throw new Error("HTTP "+res.status);return res.json()}).then(function(data){TrackingPolicy.log("Page tracked.")}.bind(this)).catch(function(err){TrackingPolicy.error("Page tracking failed:",err)})},init:function(){if(this._hasRun)return;this._hasRun=true;if(typeof window.trace_config==="undefined"){return}if(isLikelyAutomated()){TrackingPolicy.log("Automated traffic detected, skipping tracking.");return}this._config=window.trace_config;if(this._shouldTrack()){this._sendToServer()}else{TrackingPolicy.log("Page tracking skipped:",{config:this._config})}}};window.UserTimezone={_storageKeyReported:"utz_reported",_storageKeyTimezone:"utz_value",_getStorage:function(key){try{return localStorage.getItem(key)}catch(e){return null}},_setStorage:function(key,value){try{localStorage.setItem(key,value)}catch(e){}},_shouldReport:function(currentTz){if(!currentTz)return false;var lastTz=this._getStorage(this._storageKeyTimezone);var hasReported=this._getStorage(this._storageKeyReported)==="1";return!hasReported||lastTz!==currentTz},_markAsReported:function(timezone){this._setStorage(this._storageKeyReported,"1");if(timezone){this._setStorage(this._storageKeyTimezone,timezone)}},getBrowserTimezone:function(){try{if(window.Intl&&Intl.DateTimeFormat){return Intl.DateTimeFormat().resolvedOptions().timeZone}}catch(e){TrackingPolicy.error("Timezone detection failed:",e)}return null},sendToServer:function(timezone){if(!timezone)return;TrackingPolicy.log("Reporting timezone:",timezone);var data={timezone:timezone};if(typeof csrfName!=="undefined"){data[csrfName]=csrfVal}$.ajax({url:userTimezoneUrl,method:"POST",data:data,timeout:5e3,success:function(res){if(res&&res.success){window.UserTimezone._markAsReported(timezone)}else{window.UserTimezone._markAsReported(timezone)}},error:function(){TrackingPolicy.error("Timezone report failed:",arguments);window.UserTimezone._markAsReported(timezone)}})},init:function(){if(!TrackingPolicy.isAllowed){TrackingPolicy.log("Timezone reporting skipped: consent declined.");return}var tz=this.getBrowserTimezone();if(tz&&this._shouldReport(tz)){this.sendToServer(tz)}else{TrackingPolicy.log("Timezone not reported.",{tz:tz,should:false})}}};function webLoadScript(url,callback){var script=document.createElement("script");script.type="text/javascript";if(typeof callback!="undefined"){if(script.readyState){script.onreadystatechange=function(){if(script.readyState=="loaded"||script.readyState=="complete"){script.onreadystatechange=null;callback()}}}else{script.onload=function(){callback()}}}script.src=url;document.body.appendChild(script)}function isValidEmail(email){const re=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return re.test(email)}function check_email(email){if(!email||email==""){return false}const myreg=/^([a-zA-Z0-9]+[_|\_|\.|-|\-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.|-|\-]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;if(!myreg.test(email)){return false}return true}function check_pass(str){const re=/^\w{6,30}$/;if(re.test(str)){return true}else{return false}}function showToast(msg,element){element=element||"#toast-js";const toastEl=$(element);if(toastEl){$(element).find(".toast-body").text(msg);const toast=bootstrap.Toast.getOrCreateInstance(toastEl[0]);toast.show()}}function showError($el,message,$input){$el.text(message).removeClass("d-none");$input.addClass("is-invalid")}function hideError($el,$input){$el.addClass("d-none");$input.removeClass("is-invalid")}function copyTextToClipboard(text){return new Promise(function(resolve){if(navigator.clipboard&&window.isSecureContext){navigator.clipboard.writeText(text).then(function(){resolve(true)}).catch(function(err){console.warn("Clipboard API failed, falling back to execCommand:",err);resolve(fallbackCopyText(text))})}else{resolve(fallbackCopyText(text))}})}function fallbackCopyText(text){var textarea=document.createElement("textarea");textarea.value=text;textarea.style.position="fixed";textarea.style.opacity="0";document.body.appendChild(textarea);textarea.select();try{var success=document.execCommand("copy");document.body.removeChild(textarea);return success}catch(err){document.body.removeChild(textarea);return false}}$(function(){if(typeof affiliate_config!=="undefined"){try{AffiliateTracker.init()}catch(e){}}if(typeof trace_config!=="undefined"){try{PageTracker.init()}catch(e){}}if(typeof userTimezoneUrl!=="undefined"){try{UserTimezone.init()}catch(e){}}if(typeof promoCouponConfig!=="undefined"&&promoCouponConfig.checkPromo&&!PromoBannerManager.isClosedToday(promoCouponConfig.promoZoneId)){$("[data-promo-zone]").each(function(){const $el=$(this);const zone=$el.data("promo-zone");let requestData={};requestData["zone"]=zone;const attr_group=$el.data("attr-group");if(attr_group){requestData["group"]=attr_group}const spu=$el.data("spu");if(spu){requestData["spu"]=spu}$.get(promoCouponConfig.promoCouponUrl,requestData).done(function(res){if(res.success&&res.html){PromoBannerManager.renderPromoBanner($el,res.html)}}).fail(function(){})})}if(typeof memberCheckUrl!=="undefined"){const ajax_params={};if(typeof product_id!=="undefined"){ajax_params["product_id"]=product_id}$.ajax({async:true,timeout:6e3,dataType:"json",type:"get",data:ajax_params,url:memberCheckUrl,success:function(data,textStatus){if(data.loginStatus){$("#header-welcome-js").removeClass("d-none");$("#header-email-js").text(data.customer_email);$("#header-login-js").addClass("d-none")}if(data.favorite){$("#product-favorite-js").addClass("text-danger")}if(data.favorite_product_count){$("#favorite-count-js").text(data.favorite_product_count)}if(data.affiliate){$("#affiliate-link-js").show()}if(data.cart_qty){$(".cart-item-count-js").text(data.cart_qty)}},error:function(XMLHttpRequest,textStatus,errorThrown){}})}$("#subscribe_btn").click(function(){var $btn=$(this);$btn.prop("disabled",true);email=$("#subscribe_email").val();if(!check_email(email)){alert("Enter your email address");$btn.prop("disabled",false);return false}$.ajax({dataType:"json",type:"post",data:{email:email},url:"/member/account/subscribe",success:function(data,textStatus){$btn.prop("disabled",false);if(data.success){alert(data.message);$("#subscribe_email").val("")}else{alert(data.message)}},error:function(error){alert("Oops! Something went wrong. Please try again in a few minutes.");$btn.prop("disabled",false)}})})});window.SearchHistory={config:{HISTORY_KEY:"search_history",MAX_LENGTH:20,SYNC_INTERVAL_MINUTES:15,KEYWORD_MAX_LENGTH:100,SAFE_KEYWORD_PATTERN:/^[\p{L}\p{N}\s.;:'"!?-]+$/u},isValidKeyword:function(keyword){if(typeof keyword!=="string")return false;const t=keyword.trim();return t.length>0&&t.length<=this.config.KEYWORD_MAX_LENGTH},isValidKeywordWithRegex:function(keyword,maxLength){if(typeof keyword!=="string")return false;maxLength=maxLength||this.config.KEYWORD_MAX_LENGTH;var trimmed=keyword.trim();if(!trimmed||trimmed.length>maxLength)return false;return this.config.SAFE_KEYWORD_PATTERN.test(trimmed)},getLocalHistory:function(){var raw=localStorage.getItem(this.config.HISTORY_KEY);if(!raw){return{update_time:null,last_sync_time:null,data:[]}}try{var history=JSON.parse(raw);if(Array.isArray(history)){history={update_time:null,last_sync_time:null,data:history};localStorage.setItem(this.config.HISTORY_KEY,JSON.stringify(history))}if(!history.data||!Array.isArray(history.data))history.data=[];return history}catch(e){return{update_time:null,last_sync_time:null,data:[]}}},saveToLocal:function(keyword){if(!this.isValidKeyword(keyword))return false;var h=this.getLocalHistory();var k=keyword.trim();h.data=h.data.filter(x=>x!==k);h.data.unshift(k);if(h.data.length>this.config.MAX_LENGTH){h.data=h.data.slice(0,this.config.MAX_LENGTH)}h.update_time=(new Date).toISOString();localStorage.setItem(this.config.HISTORY_KEY,JSON.stringify(h));return true},removeFromLocal:function(keyword){if(keyword==null){localStorage.removeItem(this.config.HISTORY_KEY);return}var h=this.getLocalHistory();var k=String(keyword).trim();h.data=h.data.filter(x=>x!==k);h.update_time=(new Date).toISOString();localStorage.setItem(this.config.HISTORY_KEY,JSON.stringify(h))},isSyncNeeded:function(localHistory){if(!localHistory||!localHistory.last_sync_time)return true;var diff=(new Date-new Date(localHistory.last_sync_time))/(1e3*60);return diff>this.config.SYNC_INTERVAL_MINUTES},mergeWithServer:function(serverKeywords){if(!Array.isArray(serverKeywords))return;var local=this.getLocalHistory();local.last_sync_time=(new Date).toISOString();var seen={};var merged=[];local.data.forEach(k=>{if(this.isValidKeyword(k)&&!seen[k]){seen[k]=true;merged.push(k)}});serverKeywords.forEach(k=>{if(this.isValidKeyword(k)&&!seen[k]){seen[k]=true;merged.push(k)}});local.data=merged.slice(0,this.config.MAX_LENGTH);local.update_time=(new Date).toISOString();localStorage.setItem(this.config.HISTORY_KEY,JSON.stringify(local))},pullFromServer:function(url){var local=this.getLocalHistory();if(!this.isSyncNeeded(local))return;$.ajax({url:url,type:"GET",dataType:"json",timeout:6e3,success:data=>{if(data&&Array.isArray(data.data)){this.mergeWithServer(data.data)}},error:()=>{}})},pushToServer:function(url,keyword){if(!this.isValidKeyword(keyword))return;$.ajax({url:url,type:"POST",data:{keyword:keyword.trim()},dataType:"json",timeout:6e3,error:()=>{}})},removeFromServer:function(url,keyword){var data=keyword!=null?{keyword:keyword}:{};$.ajax({url:url,type:"POST",data:data,dataType:"json",timeout:6e3,error:()=>{}})},save:function(keyword,serverUrl){if(this.saveToLocal(keyword)&&serverUrl){this.pushToServer(serverUrl,keyword)}},getKeywords:function(){return this.getLocalHistory().data},clear:function(serverUrl){this.removeFromLocal();if(serverUrl)this.removeFromServer(serverUrl)}};window.PromoBannerManager=function(){"use strict";const CONFIG={EXPIRE_KEY_SUFFIX:"_expires",CLOSED_KEY_SUFFIX:"_closed"};function setSafeStorage(key,value,expiresAtTimestamp=null){try{if(typeof Storage!=="undefined"){localStorage.setItem(key,value);if(expiresAtTimestamp){localStorage.setItem(key+CONFIG.EXPIRE_KEY_SUFFIX,expiresAtTimestamp)}}else if(typeof Storage!=="undefined"){sessionStorage.setItem(key,value)}}catch(e){}}function getSafeStorage(key){try{const storedValue=localStorage.getItem(key);if(storedValue!==null){const expireKey=key+CONFIG.EXPIRE_KEY_SUFFIX;const expireTime=localStorage.getItem(expireKey);if(expireTime){const now=Math.floor(Date.now()/1e3);if(now>=parseInt(expireTime,10)){localStorage.removeItem(key);localStorage.removeItem(expireKey);return null}}return storedValue}return sessionStorage.getItem(key)}catch(e){return null}}function getEndOfDayTimestamp(){const now=new Date;const endOfDay=new Date(now.getFullYear(),now.getMonth(),now.getDate()+1);return Math.floor(endOfDay.getTime()/1e3)}function isClosedToday(promoId){const key=promoId+CONFIG.CLOSED_KEY_SUFFIX;if(TrackingPolicy.isAllowed){return getCookie(key)==="true"}return getSafeStorage(key)==="true"}function setCookieTimestamp(name,value,expiresAt){const expires=new Date(expiresAt*1e3);document.cookie=`${name}=${value}; expires=${expires.toUTCString()}; path=/`}function setCloseForToday(promoId){const key=promoId+CONFIG.CLOSED_KEY_SUFFIX;const expiresAt=getEndOfDayTimestamp();if(TrackingPolicy.isAllowed){setCookieTimestamp(key,"true",expiresAt)}else{setSafeStorage(key,"true",expiresAt)}}function renderPromoBanner($container,promoData){$container.html(promoData);$container.find(".btn-close").on("click",function(){setCloseForToday(promoCouponConfig.promoZoneId);$container.remove()});$container.find(".btn-claim-js").on("click",function(){var $btn=$(this);if($btn.prop("disabled")){return false}$btn.prop("disabled",true).text(promoCouponConfig.translations.claimIng);var coupon_code=$btn.data("coupon-code").trim();var $data={coupon_code:coupon_code};if(typeof promoCouponConfig.csrfName!="undefined"){$data[promoCouponConfig.csrfName]=promoCouponConfig.csrfVal}$.ajax({timeout:6e3,dataType:"json",type:"post",data:$data,url:promoCouponConfig.couponClaimUrl,success:function(data,textStatus){showToast(data.message,"#promo-toast-js");if(data.status=="success"){$btn.closest(".claim-status-js").html(`\n <span class="fw-bold text-success">${coupon_code}</span>\n <span class="badge bg-success">${promoCouponConfig.translations.claimed}</span>\n `)}$btn.prop("disabled",false).text(promoCouponConfig.translations.claim)},error:function(XMLHttpRequest,textStatus,errorThrown){alert(promoCouponConfig.translations.systemError);$btn.prop("disabled",false).text(promoCouponConfig.translations.claim)}})})}return{renderPromoBanner:renderPromoBanner,isClosedToday:isClosedToday,setCloseForToday:setCloseForToday,setSafeStorage:setSafeStorage,getSafeStorage:getSafeStorage,getEndOfDayTimestamp:getEndOfDayTimestamp}}();window.I18nHelper=function(){"use strict";function getLocale(){if(typeof window.APP_CONFIG!=="undefined"&&typeof window.APP_CONFIG.locale!=="undefined"){return window.APP_CONFIG.locale}const htmlLang=document.documentElement.lang;if(htmlLang){return htmlLang}return"en-US"}function getCurrency(){if(window.APP_CONFIG&&window.APP_CONFIG.currency){return window.APP_CONFIG.currency}const locale=getLocale();if(locale.startsWith("de"))return"EUR";if(locale.startsWith("fr"))return"EUR";if(locale.startsWith("en-GB"))return"GBP";if(locale.startsWith("en"))return"USD";return"USD"}const hasIntl=typeof Intl!=="undefined"&&Intl.NumberFormat&&Intl.DateTimeFormat;function formatCurrency(amount,currency=null,locale=null){currency=currency||getCurrency();locale=locale||getLocale();if(hasIntl){try{return new Intl.NumberFormat(locale,{style:"currency",currency:currency,minimumFractionDigits:2,maximumFractionDigits:2}).format(amount)}catch(e){console.warn("Currency format fallback:",e)}}const sign=currency==="GBP"?"£":currency==="EUR"?"€":currency==="USD"?"$":currency+" ";return sign+parseFloat(amount).toFixed(2)}function formatDate(date,locale=null,options={}){locale=locale||getLocale();const defaultOptions={year:"numeric",month:"short",day:"numeric"};options=Object.assign(defaultOptions,options);if(hasIntl){try{return new Intl.DateTimeFormat(locale,options).format(new Date(date))}catch(e){console.warn("Date format fallback:",e)}}const d=new Date(date);return d.getFullYear()+"-"+String(d.getMonth()+1).padStart(2,"0")+"-"+String(d.getDate()).padStart(2,"0")}function formatDateTime(date,locale=null,options={}){locale=locale||getLocale();const defaultOptions={year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};options=Object.assign(defaultOptions,options);if(hasIntl){try{return new Intl.DateTimeFormat(locale,options).format(new Date(date))}catch(e){console.warn("DateTime format fallback:",e)}}const d=new Date(date);return formatDate(d)+" "+String(d.getHours()).padStart(2,"0")+":"+String(d.getMinutes()).padStart(2,"0")}function formatNumber(number,locale=null,fractionDigits=0){locale=locale||getLocale();if(hasIntl){try{return new Intl.NumberFormat(locale,{minimumFractionDigits:fractionDigits,maximumFractionDigits:fractionDigits}).format(number)}catch(e){console.warn("Number format fallback:",e)}}return parseFloat(number).toLocaleString("en-US",{minimumFractionDigits:fractionDigits,maximumFractionDigits:fractionDigits})}return{formatCurrency:formatCurrency,formatDate:formatDate,formatDateTime:formatDateTime,formatNumber:formatNumber,getLocale:getLocale,getCurrency:getCurrency}}();function isValidSearchKeyword(keyword,maxLength=100){keyword=keyword.trim();if(keyword===""){return false}if(keyword.length>maxLength){return false}const safePattern=/^[\p{L}\p{N}\s.;:'"!?-]+$/u;if(!safePattern.test(keyword)){return false}const escapedKeyword=keyword.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");return true}const historyKey="search_history";function pullSearchHistory(Url){let localHistory=getCompatibleSearchHistoryFromLocalStorage();if(!isSyncNeeded(localHistory)){return}$.ajax({async:true,timeout:6e3,dataType:"json",type:"get",url:Url,success:function(data,textStatus){if(data.data.length>0){mergeLocalSearchHistory(data.data)}},error:function(XMLHttpRequest,textStatus,errorThrown){}})}function removeHistory(url,keyword){data={};if(keyword){data["keyword"]=keyword}$.ajax({async:true,timeout:6e3,dataType:"json",data:data,type:"post",url:url,success:function(data,textStatus){},error:function(XMLHttpRequest,textStatus,errorThrown){}})}function saveOneSearchHistory(keyword,Url){$.ajax({async:true,timeout:6e3,dataType:"json",type:"post",url:Url,data:{keyword:keyword},success:function(data,textStatus){},error:function(XMLHttpRequest,textStatus,errorThrown){}})}function saveSearchToLocalStorage(keyword){let searchHistory=getCompatibleSearchHistoryFromLocalStorage();const index=searchHistory.data.indexOf(keyword);if(index>-1){searchHistory.data.splice(index,1)}searchHistory.data.unshift(keyword);if(searchHistory.data.length>maxSearchHistoryLength){searchHistory.data=searchHistory.data.slice(0,maxSearchHistoryLength)}searchHistory.update_time=(new Date).toISOString();localStorage.setItem(historyKey,JSON.stringify(searchHistory))}function removeSearchFromLocalStorage(keyword){let searchHistory=JSON.parse(localStorage.getItem(historyKey));if(searchHistory&&Array.isArray(searchHistory.data)){if(keyword){searchHistory.data=searchHistory.data.filter(item=>item!==keyword)}else{localStorage.removeItem(historyKey);return}searchHistory.update_time=(new Date).toISOString();localStorage.setItem(historyKey,JSON.stringify(searchHistory));return}else{localStorage.removeItem(historyKey);return}}function getSearchHistoryFromLocalStorage(){let searchHistory=JSON.parse(localStorage.getItem(historyKey))||{update_time:null,last_sync_time:null,data:[]};return searchHistory}function getCompatibleSearchHistoryFromLocalStorage(){const rawHistory=localStorage.getItem(historyKey);if(!rawHistory){return{update_time:null,last_sync_time:null,data:[]}}let history;try{history=JSON.parse(rawHistory)}catch(e){console.error("Failed to parse history:",e);return{update_time:null,last_sync_time:null,data:[]}}if(Array.isArray(history)){history={update_time:null,last_sync_time:null,data:history};localStorage.setItem(historyKey,JSON.stringify(history))}return history}function isSyncNeeded(history){if(!history||!history.last_sync_time)return true;const lastSyncTime=new Date(history.last_sync_time);const currentTime=new Date;const diffInMinutes=(currentTime-lastSyncTime)/(1e3*60);return diffInMinutes>15}function mergeLocalSearchHistory(serverHistory){let localHistory=getCompatibleSearchHistoryFromLocalStorage();localHistory.last_sync_time=(new Date).toISOString();let mergedData=Array.from(new Set([...localHistory.data,...serverHistory]));localHistory.data=mergedData;localStorage.setItem(historyKey,JSON.stringify(localHistory))}function is_valid_url(url){var regex=new RegExp(/^(https?|s):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i);return regex.test(url)}function is_same_domain(base_url,custom_url){base_url=base_url.replace("http://","").replace("https://","").replace("www.","").replace("m.","").split(/[/?#]/)[0];custom_url=custom_url.replace("http://","").replace("https://","").replace("www.","").replace("m.","").split(/[/?#]/)[0];return base_url==custom_url||base_url.indexOf(custom_url)!=-1||custom_url.indexOf(base_url)!=-1}function process_friendly_url(param,value,url){var hash=url.split("#")[1];url=url.split("#")[0];var re=new RegExp("([/]"+param+"[/][^?]*)"),match=re.exec(url);var re2=new RegExp("([?].*)"),match2=re2.exec(url);if(match&&match[0])url=url.replace(match[0],"");if(match2&&match2[0])url=url.replace(match2[0],"");var re3=new RegExp("([/]"+param+"$)"),match3=re3.exec(url);if(match3&&match3[0])url=url.replace(match3[0],"");url=url.replace(/\/+$/,"");url=url+"/"+param+"/"+value+"/";if(match2&&match2[0])url=url+match2[0];if(hash)url+="#"+hash;return url}function add_query_arg(param,value,url){var re=new RegExp("[\\?&]"+param+"=([^&#]*)"),match=re.exec(url),delimiter,newString;var hash=url.split("#")[1];url=url.split("#")[0];if(match===null){var hasQuestionMark=/\?/.test(url);delimiter=hasQuestionMark?"&":"?";newString=url+delimiter+param+"="+value}else{delimiter=match[0].charAt(0);newString=url.replace(re,delimiter+param+"="+value)}if(hash){newString+="#"+hash}return newString}
@@ -1 +1 @@
1
- function renderSearchHistory(){const $list=$("#search-history-items-js");const history=SearchHistory.getKeywords();if(history.length===0){$("#search-history-js").addClass("d-none");return}$("#search-history-js").removeClass("d-none");$list.empty();history.forEach(keyword=>{const $item=$(`<li><a href="${searchUrl}?q=${encodeURIComponent(keyword)}" class="badge bg-light text-dark text-decoration-none">${keyword}</a></li>`);$list.append($item)})}$(document).ready(function(){$(".luv-nav-item").hover(function(){$(this).addClass("active");$(this).find(".nav-link").addClass("active")},function(){$(this).removeClass("active");$(this).find(".nav-link").removeClass("active")});const $qInput=$("#keywords");if($qInput.length>0){const $searchSuggestions=$("#search-suggestions-js");const $searchForm=$("#search-form-js");$qInput.on("focus",function(){SearchHistory.pullFromServer(pullSearchHistoryUrl);renderSearchHistory();$searchSuggestions.removeClass("d-none");$qInput.attr("aria-expanded","true")});$searchForm.on("submit",function(){const q=$input.val().trim();if(!q){e.preventDefault();$input.focus();return false}SearchHistory.save(q,saveSearchHistoryUrl)});$(document).on("click",function(e){if(!$searchForm[0].contains(e.target)){$searchSuggestions.addClass("d-none");$qInput.attr("aria-expanded","false")}});$qInput.on("keydown",function(e){if(e.key==="Escape"){$searchSuggestions.addClass("d-none");$qInput.attr("aria-expanded","false");$qInput.blur()}});$("#removeSearchDialog .btn-primary").click(function(){SearchHistory.clear(removeHistoryUrl);location.reload()});$searchSuggestions.on("click","a",function(e){const q=new URL(this.href).searchParams.get("q");if(q)SearchHistory.save(q,saveSearchHistoryUrl)})}$(".lang_currency_submit").on("click",function(){var changeStore=$(".currentLangSelect").val();var currentCurrency=$(".currentCurrencySelect").val();$.ajax({url:settingUrl+"?currency="+currentCurrency,async:false});var currentUrl=window.location.href;var currentStore=$(".current_lang").val();var redirectUrl=currentUrl.replace("://"+currentStore,"://"+changeStore);redirectUrl=redirectUrl.split("#")[0];window.location.href=redirectUrl})});
1
+ function renderSearchHistory(){const $list=$("#search-history-items-js");const history=SearchHistory.getKeywords();if(history.length===0){$("#search-history-js").addClass("d-none");return}$("#search-history-js").removeClass("d-none");$list.empty();history.forEach(keyword=>{const $item=$(`<li><a href="${searchUrl}?q=${encodeURIComponent(keyword)}" class="badge bg-light text-dark text-decoration-none">${keyword}</a></li>`);$list.append($item)})}$(document).ready(function(){$(".luv-nav-item").hover(function(){$(this).addClass("active");$(this).find(".nav-link").addClass("active")},function(){$(this).removeClass("active");$(this).find(".nav-link").removeClass("active")});const $qInput=$("#keywords");if($qInput.length>0){const $searchSuggestions=$("#search-suggestions-js");const $searchForm=$("#search-form-js");$qInput.on("focus",function(){SearchHistory.pullFromServer(pullSearchHistoryUrl);renderSearchHistory();$searchSuggestions.removeClass("d-none");$qInput.attr("aria-expanded","true")});$searchForm.on("submit",function(){const q=$input.val().trim();if(!q){e.preventDefault();$input.focus();return false}SearchHistory.save(q,saveSearchHistoryUrl)});$(document).on("click",function(e){if(!$searchForm[0].contains(e.target)){$searchSuggestions.addClass("d-none");$qInput.attr("aria-expanded","false")}});$qInput.on("keydown",function(e){if(e.key==="Escape"){$searchSuggestions.addClass("d-none");$qInput.attr("aria-expanded","false");$qInput.blur()}});$("#removeSearchDialog .btn-primary").click(function(){SearchHistory.clear(removeHistoryUrl);location.reload()});$searchSuggestions.on("click","a",function(e){const q=new URL(this.href).searchParams.get("q");if(q)SearchHistory.save(q,saveSearchHistoryUrl)})}$("#lang-currency-submit-js").on("click",function(){if($(this).prop("disabled")){return}$(this).prop("disabled",true).text(settingTranslations.waitingText);var selectedStore=$("#current-lang-select-js").val();var selectedCurrency=$("#current-currency-select-js").val();$.ajax({url:settingUrl+"?currency="+selectedCurrency,async:false});var currentUrl=window.location.href;var redirectUrl=currentUrl.replace("://"+currentStore,"://"+selectedStore);redirectUrl=redirectUrl.split("#")[0];window.location.href=redirectUrl})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "luv-assets",
3
3
  "description": "Include Bootstrap's source Sass and individual JavaScript plugins with Webpack.",
4
- "version": "1.2.14",
4
+ "version": "1.2.16",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",