PageSourceSearch

https://nordisk.de/cdn/shop/t/11/assets/feature-lsp.js?v=12464539260615109011790851864

js nordisk.de collected 2026-10-08 09:45:24 UTC 21,041 bytes, 2 lines download raw bytes

1var options=window.themeVariables.optionsLSP,lang=window.themeVariables.langLSP,lspSheetStorageVersion="lspDataSheet-v"+options.sheetStorageVersion;csvFetchLSP();async function csvFetchLSP(){function getIpCountryCode(){return new Promise((resolve,reject)=>{const attemptRequest=attempt=>{try{const shopSwitchIpLocation=JSON.parse(localStorage.getItem("geodata")).country_code;resolve(shopSwitchIpLocation)}catch{if(attempt===4){var url="https://api.ipstack.com/check?access_key="+options.ipstackAPIKey;fetch(url).then(response=>{if(!response.ok)throw new Error("Failed to fetch");return response.json()}).then(data2=>{window.ipstack=data2,localStorage.setItem("geodata",JSON.stringify(window.ipstack)),resolve(window.ipstack.country_code)}).catch(()=>{resolve("DEFAULT")})}else setTimeout(()=>{attemptRequest(attempt+1)},500)}};attemptRequest(1)})}function lspStoredDataGet(){return new Promise(resolve=>{resolve(JSON.parse(localStorage.getItem(lspSheetStorageVersion)))})}var lspStoredData=await lspStoredDataGet(),locationData=await getIpCountryCode();if(lspStoredData){var data=lspStoredData;console.log("has local data"),getCountryData(locationData,data)}else if(locationData){console.log("get new data");const sheetURL=options.sheetUrl,sheetName=options.sheetName,sheetAPIKey=options.sheetAPIKey;if(console.log("test 1"),sheetURL&&sheetName&&sheetAPIKey){const fetchUrl="https://sheets.googleapis.com/v4/spreadsheets/"+options.sheetUrl+"/values/"+options.sheetName+"?alt=json&key="+options.sheetAPIKey;$.ajax({url:fetchUrl,type:"GET",dataType:"json"}).done(function(data2){if(console.log("got data"),console.log(data2),locationData&&data2){getCountryData(locationData,data2),localStorage.setItem(lspSheetStorageVersion,JSON.stringify(data2));for(var lspOldStorageArr=[],i=0;i<localStorage.length;i++){const lspStorageInstancePrefix=localStorage.key(i).split("DataSheet-v").shift();localStorage.key(i)===lspSheetStorageVersion||lspStorageInstancePrefix==="lsp"&&lspOldStorageArr.push(localStorage.key(i))}for(var i=0;i<lspOldStorageArr.length;i++)localStorage.removeItem(lspOldStorageArr[i])}}).fail(e=>console.log(e.status))}}}var renderDataLSP=function(currentCountryActiveData,currentCountryActiveUspData,uspFallbackTextData){showShippingInfo(currentCountryActiveData),showCountrySelector(currentCountryActiveData),$.getJSON("/cart.js",function(cart){var currentCart=cart;insertUSPData(currentCart,currentCountryActiveData,currentCountryActiveUspData,uspFallbackTextData),updateShippingProgress(currentCart,currentCountryActiveData,currentCountryActiveUspData)}),updateCartPriceAndShipping(currentCountryActiveData,currentCountryActiveUspData),startCurrentCartListener(currentCountryActiveData,currentCountryActiveUspData,uspFallbackTextData)};function insertUSPData(currentCart,currentCountryActiveData,currentCountryActiveUspData,uspFallbackTextData){let currentCountryShippingPrice="",currentCountryDeliveryTime="",currentCountryFreeShippingThreshold="";var minOrderAmount="",currentCountryName="";let isHeavyShippingProduct=!1,isHeavyDeliveryTimeProduct=!1,isHeavyThresholdProduct=!1;options.productIsHeavyWeight&&(currentCountryActiveData.DeliveryTimeHeavy&&(isHeavyDeliveryTimeProduct=!0),currentCountryActiveData.ShippingPriceHeavy&&(isHeavyShippingProduct=!0),currentCountryActiveData.FreeShippingThresholdHeavy&&(isHeavyThresholdProduct=!0)),document.querySelectorAll("[data-lsp-heavy-weight-item]")[0]&&(isHeavyDeliveryTimeProduct=!0,isHeavyShippingProduct=!0,isHeavyThresholdProduct=!0),currentCountryDeliveryTime=isHeavyDeliveryTimeProduct?currentCountryActiveData.DeliveryTimeHeavy:currentCountryActiveData.DeliveryTime,currentCountryShippingPrice=isHeavyShippingProduct?currentCountryActiveData.ShippingPriceHeavy:currentCountryActiveData.ShippingPrice,currentCountryFreeShippingThreshold=isHeavyThresholdProduct?currentCountryActiveData.FreeShippingThresholdHeavy:currentCountryActiveData.FreeShippingThreshold,currentCountryFreeShippingThreshold&&(currentCountryFreeShippingThreshold=parseInt(currentCountryFreeShippingThreshold)),currentCountryDeliveryTime&&(currentCountryDeliveryTime=currentCountryDeliveryTime+" "+lang.days),currentCountryFreeShippingThreshold&&(minOrderAmount=slateCurrency.formatMoney(currentCountryFreeShippingThreshold*100,window.themeVariables.settings.moneyFormat)),currentCountryActiveData.Country&&(currentCountryName=currentCountryActiveData.Country),currentCountryShippingPrice&&(currentCountryShippingPrice=slateCurrency.formatMoney(currentCountryShippingPrice*100,window.themeVariables.settings.moneyFormat)),$(".lspList .lspListInner").each(function(index){var allUspMessageContent="";isHeavyShippingProduct&&uspFallbackTextData&&(currentCountryActiveUspData.find(currentCountryActiveUspData2=>currentCountryActiveUspData2.includes(uspFallbackTextData))||currentCountryActiveUspData.push(uspFallbackTextData));for(var uspCount=0;uspCount<currentCountryActiveUspData.length;uspCount++){let formatedCurrentCountryActiveUspData=currentCountryActiveUspData[uspCount];if(formatedCurrentCountryActiveUspData){let isFallBackUSP=!1;formatedCurrentCountryActiveUspData===uspFallbackTextData&&(isFallBackUSP=!0),currentCountryFreeShippingThreshold===0&&!isFallBackUSP?(formatedCurrentCountryActiveUspData.includes("[amount]")||formatedCurrentCountryActiveUspData.includes("[time]"))&&(formatedCurrentCountryActiveUspData=""):isHeavyShippingProduct&&isFallBackUSP&&currentCountryFreeShippingThreshold===0&&formatedCurrentCountryActiveUspData.includes("[amount]")&&(formatedCurrentCountryActiveUspData=""),isHeavyDeliveryTimeProduct&&formatedCurrentCountryActiveUspData.includes("[hide-heavy]")&&(formatedCurrentCountryActiveUspData=""),formatedCurrentCountryActiveUspData.includes("[amount]")&&minOrderAmount&&(formatedCurrentCountryActiveUspData=formatedCurrentCountryActiveUspData.replace("[amount]",minOrderAmount)),formatedCurrentCountryActiveUspData.includes("[time]")&&currentCountryDeliveryTime&&(formatedCurrentCountryActiveUspData=formatedCurrentCountryActiveUspData.replace("[time]",currentCountryDeliveryTime)),formatedCurrentCountryActiveUspData.includes("[country]")&&currentCountryName&&(formatedCurrentCountryActiveUspData=formatedCurrentCountryActiveUspData.replace("[country]",currentCountryName)),formatedCurrentCountryActiveUspData.includes("[hide-heavy]")&&currentCountryName&&(formatedCurrentCountryActiveUspData=formatedCurrentCountryActiveUspData.replace("[hide-heavy]",""));var iconCount="";formatedCurrentCountryActiveUspData.includes("[icon")&&(iconCount=currentCountryActiveUspData[uspCount].split("[icon").filter(function(v){return v.indexOf("]")>-1}).map(function(value){iconCount=value.split("]")[0];const currentUspIcon="usp_icon_"+iconCount;iconShortcode="[icon"+iconCount+"]",currentCountryActiveData.USPIcons&&currentCountryActiveData.USPIcons[currentUspIcon]?formatedCurrentCountryActiveUspData=formatedCurrentCountryActiveUspData.replace(iconShortcode,currentCountryActiveData.USPIcons[currentUspIcon]):formatedCurrentCountryActiveUspData=formatedCurrentCountryActiveUspData.replace(iconShortcode,"")})),allUspMessageContent=allUspMessageContent+'<div class="lspListItem">'+formatedCurrentCountryActiveUspData+"</div>"}currentCountryActiveData.EnabledCountry==="TRUE"&&($(this).parent().removeClass("skeletonHidden"),$(this).parent().addClass("skeletonShow"))}$(this).html(allUspMessageContent)})}function showCountrySelector(currentCountryActiveData){var currentCountryName="";currentCountryActiveData.Country&&(currentCountryName=currentCountryActiveData.Country),$(".lspCountrySelect").each(function(index){$(this)[0].innerHTML=currentCountryName})}function showShippingInfo(currentCountryActiveData){console.log("here"),console.log(currentCountryActiveData);let isHeavyDeliveryTimeProduct=!1;
1options.productIsHeavyWeight&&currentCountryActiveData.DeliveryTimeHeavy&&(isHeavyDeliveryTimeProduct=!0),document.querySelectorAll("[data-lsp-heavy-weight-item]")[0]&&(isHeavyDeliveryTimeProduct=!0);let currentCountryDeliveryTime=isHeavyDeliveryTimeProduct?currentCountryActiveData.DeliveryTimeHeavy:currentCountryActiveData.DeliveryTime;currentCountryDeliveryTime&&(currentCountryDeliveryTime=currentCountryDeliveryTime+" "+lang.days),$(".lspShippingInfo").each(function(index){let deliveryTimeEl=$(this).find(".lspExpectedDeliveryTime")[0];deliveryTimeEl&&currentCountryDeliveryTime&&(deliveryTimeEl.innerHTML=currentCountryDeliveryTime,currentCountryActiveData.EnabledCountry==="TRUE"&&($(this).removeClass("skeletonHidden"),$(this).addClass("skeletonShow")))})}function updateCartPriceAndShipping(currentCountryActiveData){document.addEventListener("cart:content:changed",event=>{let currentCountryShippingPrice="",currentCountryShippingPriceRaw="",currentCountryFreeShippingThreshold="",hasHeavyWeightCartItem=!1,isHeavyThresholdProduct=!1;document.querySelectorAll("[data-lsp-heavy-weight-item]")[0]&&(hasHeavyWeightCartItem=!0,isHeavyThresholdProduct=!0),currentCountryShippingPriceRaw=hasHeavyWeightCartItem?currentCountryActiveData.ShippingPriceHeavy:currentCountryActiveData.ShippingPrice,currentCountryShippingPriceRaw&&(currentCountryShippingPrice=slateCurrency.formatMoney(currentCountryShippingPriceRaw*100,window.themeVariables.settings.moneyFormat)),currentCountryFreeShippingThreshold=isHeavyThresholdProduct?currentCountryActiveData.FreeShippingThresholdHeavy:currentCountryActiveData.FreeShippingThreshold,$(".CartTotalLSP").each(function(index){var currentCountryName="";currentCountryActiveData.Country&&(currentCountryName=currentCountryActiveData.Country);let cartShippingPriceEl=$(this).find(".Cart__ShippingPrice"),cartShippingPriceTitleEl=$(this).find(".Cart__Shipping [data-shipping-title]")[0];if(cartShippingPriceTitleEl){let cartShippingPriceTitle=cartShippingPriceTitleEl.innerHTML;cartShippingPriceTitleEl&&cartShippingPriceTitle.includes("[country]")&&currentCountryName&&(cartShippingPriceTitle=cartShippingPriceTitle.replace("[country]",currentCountryName),cartShippingPriceTitleEl.innerHTML=cartShippingPriceTitle)}const cartTotalPriceEl=$(this).find(".Cart__TotalPrice"),cartTotalPriceValue=$(this).find(".Cart__TotalPrice").attr("data-cart-total-price");var freeShippingThreshold=parseInt(currentCountryFreeShippingThreshold);if(freeShippingThreshold!==""&&Number(cartTotalPriceValue)){var thresholdInCents=freeShippingThreshold*100,cartThresholdDifference=Number(cartTotalPriceValue)/thresholdInCents*100,currentProgress=0;currentProgress=cartThresholdDifference,Number(cartTotalPriceValue)==0?currentProgress=0:currentProgress>=100&&(currentProgress=100)}if(cartTotalPriceEl&&cartTotalPriceValue&&currentCountryShippingPrice){const totalPriceWithShipping=Number(cartTotalPriceValue)+Number(currentCountryShippingPriceRaw*100);if(totalPriceWithShipping){const totalPriceWithShippingFormatPrice=slateCurrency.formatMoney(totalPriceWithShipping,window.themeVariables.settings.moneyFormat);currentProgress<100||currentCountryFreeShippingThreshold==="0"?(cartTotalPriceEl.html(totalPriceWithShippingFormatPrice),cartShippingPriceEl&&currentCountryShippingPrice&&cartShippingPriceEl.html(currentCountryShippingPrice)):cartShippingPriceEl.html(lang.freeShippingShort)}}currentCountryActiveData.EnabledCountry==="TRUE"&&($(this).find(".Cart__Shipping").removeClass("skeletonHidden"),$(this).find(".Cart__Shipping").addClass("skeletonShow"))})})}function updateShippingProgress(currentCart,currentCountryActiveData){let currentCountryFreeShippingThreshold="",isHeavyThresholdProduct=!1;options.productIsHeavyWeight&&currentCountryActiveData.FreeShippingThresholdHeavy&&(isHeavyThresholdProduct=!0),document.querySelectorAll("[data-lsp-heavy-weight-item]")[0]&&(isHeavyThresholdProduct=!0),currentCountryFreeShippingThreshold=isHeavyThresholdProduct?currentCountryActiveData.FreeShippingThresholdHeavy:currentCountryActiveData.FreeShippingThreshold;var freeShippingThreshold=parseInt(currentCountryFreeShippingThreshold);if(freeShippingThreshold!==""&&currentCart.total_price!==""){var remainingAmou
1nt=currentCart.total_price/100-freeShippingThreshold,remainingAmountFormat=slateCurrency.formatMoney(remainingAmount*-1*100,window.themeVariables.settings.moneyFormat),thresholdInCents=freeShippingThreshold*100,cartThresholdDifference=currentCart.total_price/thresholdInCents*100,currentProgress=0;currentProgress=cartThresholdDifference,currentCart.total_price==0?currentProgress=0:currentProgress>=100&&(currentProgress=100);let progressAboveMinCartTotal=!0;if(options.progressMinCartTotal){let progressMinCartTotal=options.progressMinCartTotal*100;currentCart.total_price<progressMinCartTotal&&(progressAboveMinCartTotal=!1)}currentProgressWithPercentage=currentProgress+"%",progressAboveMinCartTotal&&$(".ProgressLSP").each(function(index){const progressBarElWrapper=$(this),progressBarEl=$(this).find(".ProgressBar__Active"),progressBarShowing=progressBarEl.hasClass("ProgressLSPShow");freeShippingThreshold!==""&&freeShippingThreshold===0?progressBarShowing&&progressBarElWrapper.removeClass("ProgressLSPShow"):currentCart.total_price!==0&&(progressBarShowing||progressBarElWrapper.addClass("ProgressLSPShow")),progressBarEl&&progressBarEl.css("width",currentProgressWithPercentage);var progressBarTextEl=$(this).find(".ProgressLSPText");let progressBarText=lang.freeShippingRemaining;progressBarText.includes("{{remaining_amount}}")&&currentProgress<100?(console.log("here 1"),currentProgress<100&&(progressBarText=progressBarText.replace("{{remaining_amount}}",remainingAmountFormat))):currentProgress>=100&&(console.log("here 2"),console.log("lang.freeShippingReached",lang.freeShippingReached),progressBarText=lang.freeShippingReached),progressBarTextEl.html(progressBarText),currentCountryActiveData.EnabledCountry==="TRUE"&&($(this).removeClass("skeletonHidden"),$(this).addClass("skeletonShow"))})}}async function startCurrentCartListener(currentCountryActiveData,currentCountryActiveUspData,uspFallbackTextData){listenCartChange(),window.addEventListener("SCE:action",event=>{$.getJSON("/cart.js",function(cart){var currentCart=cart;insertUSPData(currentCart,currentCountryActiveData,currentCountryActiveUspData,uspFallbackTextData),updateShippingProgress(currentCart,currentCountryActiveData)})})}var getCountryData=function(locationData,data){const tableJSON=data.values,keys=Object.keys(tableJSON[0]).map(i=>tableJSON[0][i]);let countryData=tableJSON.map(obj=>{const replacedObj={},oriKeys=Object.keys(obj);for(let i=0;i<keys.length;i++)replacedObj[keys[i]]=obj[oriKeys[i]];return replacedObj});var uspAllTextData=[],uspFallbackTextData="";let uspTextDataCount=0,UPSIndex=null,uspData=tableJSON.map((obj,index)=>{const replacedObj={},oriKeys=Object.keys(obj);if(index==0)for(let j=0;j<obj.length;j++)obj[j]=="USP text"&&(UPSIndex=j);
1index===11&&index!==0?obj[UPSIndex]&&(uspFallbackTextData=obj[UPSIndex]):obj[UPSIndex]&&index!==0&&uspAllTextData.push(obj[UPSIndex])}),fallbackCountry=countryData.filter(function(item){return item.CountryCode=="DEFAULT"});var fallbackCountryObj=fallbackCountry[Object.keys(fallbackCountry)[0]],currentCountryCode=locationData;let currentCountry=countryData.filter(function(item){return item.CountryCode==currentCountryCode});var currentCountryObj=currentCountry[Object.keys(currentCountry)[0]];currentCountryObj||(fallbackCountryObj?currentCountryObj=fallbackCountryObj:console.log("editor fallback"));var currentCountryActiveData={EnabledCountry:currentCountryObj.Active,Country:currentCountryObj.Country||fallbackCountryObj.Country,DeliveryTime:currentCountryObj["Delivery time"]||fallbackCountryObj["Delivery time"],DeliveryTimeHeavy:currentCountryObj["Delivery time heavy"]||fallbackCountryObj["Delivery time heavy"],FreeShippingThreshold:currentCountryObj["Free shipping threshold"]||fallbackCountryObj["Free shipping threshold"],FreeShippingThresholdHeavy:currentCountryObj["Free shipping threshold heavy"]||fallbackCountryObj["Free shipping threshold heavy"],ShippingPrice:currentCountryObj["Shipping price"]||fallbackCountryObj["Shipping price"],ShippingPriceHeavy:currentCountryObj["Shipping price heavy"]||fallbackCountryObj["Shipping price heavy"],USPIcons:window.themeVariables.iconsLSP},currentCountryActiveUspData=getCountryUspData(currentCountryObj,uspAllTextData);currentCountryActiveUspData.length===0&&(currentCountryActiveUspData=getCountryUspData(fallbackCountryObj,uspAllTextData)),currentCountryActiveData.EnabledCountry==="TRUE"?(console.log("here"),renderDataLSP(currentCountryActiveData,currentCountryActiveUspData,uspFallbackTextData)):(console.log("here 2"),renderDataLSP(currentCountryActiveData,currentCountryActiveUspData,uspFallbackTextData))},unsupportedCountryWarning=function(currentCountryActiveData,currentCountryActiveUspData){},getCountryUspData=function(currentCountryObj,uspAllTextData,uspFallbackTextData){let currentCountryUspStatus=[],currentCountryUspCount=0;for(let i=0;i<10;i++){currentCountryUspCount=currentCountryUspCount+1;let i2=currentCountryUspCount;currentCountryObj[`USP${currentCountryUspCount}`]!=="TRUE"?currentCountryUspStatus.push("FALSE"):currentCountryUspStatus.push(currentCountryObj[`USP${currentCountryUspCount}`])}let currentCountryActiveUspData=[];for(var statusCount=0;statusCount<currentCountryUspStatus.length;statusCount++)if(currentCountryUspStatus[statusCount]==="TRUE"){for(var textCount=0;textCount<uspAllTextData.length;textCount++)if(uspAllTextData[statusCount]){currentCountryActiveUspData.push(uspAllTextData[statusCount]);break}}return currentCountryActiveUspData};async function listenCartChange(){(function(){if(!window||!window.Shopify)return;const CartEvents={add:"SCE:action",update:"SCE:action",change:"SCE:action",clear:"SCE:action",mutate:"SCE:action"},ShopifyCartURLs=["/cart/add","/cart/update","/cart/change","/cart/clear","/cart/add.js","/cart/update.js","/cart/change.js","/cart/clear.js"];function isShopifyCartURL(url){if(!url)return!1;const path=url.split("/").pop();return ShopifyCartURLs.includes(`/cart/${path}`)}function updateType(url){return url?url.includes("cart/add")?"add":url.includes("cart/update")?"update":url.includes("cart/change")?"change":url.includes("cart/clear")?"clear":!1:!1}function dispatchEvent(url,detail){if(typeof detail=="string")try{detail=JSON.parse(detail)}catch{}switch(updateType(url)){case"add":window.dispatchEvent(new CustomEvent(CartEvents.add,{detail}));break;case"update":window.dispatchEvent(new CustomEvent(CartEvents.update,{detail}));break;case"change":window.dispatchEvent(new CustomEvent(CartEvents.change,{detail}));break;case"clear":window.dispatchEvent(new CustomEvent(CartEvents.clear,{detail}));break;default:break}}function XHROverride(){if(!window.XMLHttpRequest)return;const originalOpen=window.XMLHttpRequest.prototype.open;window.XMLHttpRequest.prototype.open=function(){const url=arguments[1];return this.addEventListener("load",function(){isShopifyCartURL(url)&&dispatchEvent(url,this.response)}),originalOpen.apply(this,arguments)}}function fetchOverride(){if(!window.fetch||typeof window.fetch!="function")return;const originalFetch=window.fetch;window.fetch=function(){const response=originalFetch.apply(this,arguments);return isShopifyCartURL(arguments[0])&&response.then(res=>{res.clone().json().then(data=>
1dispatchEvent(res.url,data))}),response}}fetchOverride(),XHROverride()})()}slateUtils={findInstance:function(array,key,value){for(var i=0;i<array.length;i++)if(array[i][key]===value)return array[i]},removeInstance:function(array,key,value){for(var i=array.length;i--;)if(array[i][key]===value){array.splice(i,1);break}return array},compact:function(array){for(var index=-1,length=array==null?0:array.length,resIndex=0,result=[];++index<length;){var value=array[index];value&&(result[resIndex++]=value)}return result},defaultTo:function(value,defaultValue){return value==null||value!==value?defaultValue:value}},slateCurrency=(function(){var moneyFormat="${{amount}}";function formatMoney(cents,format){typeof cents=="string"&&(cents=cents.replace(".",""));var value="",placeholderRegex=/\{\{\s*(\w+)\s*\}\}/,formatString=format||moneyFormat;function formatWithDelimiters(number,precision,thousands,decimal){if(precision=slateUtils.defaultTo(precision,2),thousands=slateUtils.defaultTo(thousands,","),decimal=slateUtils.defaultTo(decimal,"."),isNaN(number)||number==null)return 0;number=(number/100).toFixed(precision);var parts=number.split("."),dollarsAmount=parts[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+thousands),centsAmount=parts[1]?decimal+parts[1]:"";return dollarsAmount+centsAmount}switch(formatString.match(placeholderRegex)[1]){case"amount":value=formatWithDelimiters(cents,2);break;case"amount_no_decimals":value=formatWithDelimiters(cents,0);break;case"amount_with_comma_separator":value=formatWithDelimiters(cents,2,".",",");break;case"amount_no_decimals_with_comma_separator":value=formatWithDelimiters(cents,0,".",",");break}return formatString.replace(placeholderRegex,value)}return{formatMoney}})();
2//# sourceMappingURL=/cdn/shop/t/11/assets/feature-lsp.js.map?v=12464539260615109011790851864

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.