PageSourceSearch

https://www.fcsg.ch/cdn/shop/t/48/assets/cart-notification.js?v=91993832395680102881790856091

js fcsg.ch collected 2026-10-02 16:39:46 UTC 6,335 bytes, 2 lines download raw bytes

1class CartNotification extends HTMLElement{constructor(){super(),this.notification=document.getElementById("cart-notification"),this.header=document.querySelector("sticky-header"),this.onBodyClick=this.handleBodyClick.bind(this),this.notification.addEventListener("keyup",evt=>evt.code==="Escape"&&this.close()),this.querySelectorAll('button[type="button"]').forEach(closeButton=>closeButton.addEventListener("click",this.close.bind(this)))}open(){this.notification.classList.add("animate","active"),this.notification.addEventListener("transitionend",()=>{this.notification.focus(),trapFocus(this.notification)},{once:!0}),document.body.addEventListener("click",this.onBodyClick)}close(){this.notification.classList.remove("active"),document.body.removeEventListener("click",this.onBodyClick),removeTrapFocus(this.activeElement)}renderContents(parsedState){if(parsedState.key)this.cartItemKey=parsedState.key;else{let item_key_index=parsedState.items.length-1;this.cartItemKey=parsedState.items[item_key_index].key}this.getSectionsToRender().forEach(section=>{if(section){let sectionElement=document.getElementById(section.id);sectionElement?sectionElement.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.id],section.selector):console.warn(`Element with ID '${section.id}' not found.`)}}),this.header&&this.header.reveal(),this.open()}getSectionsToRender(){return[{id:"cart-notification-product",selector:`[id="cart-notification-product-${this.cartItemKey}"]`},{id:"cart-icon-bubble"}]}getSectionInnerHTML(html,selector=".shopify-section"){let parsedDoc=new DOMParser().parseFromString(html,"text/html"),sectionElement=parsedDoc.querySelector(selector);if(sectionElement){if(window.aico_percentage_discount&&window.aico_percentage_discount!=0){let priceValueNew=0,checkComparePrice=sectionElement.querySelector(".cart-notification-price");if(checkComparePrice){var comparePriceAttr=checkComparePrice.getAttribute("data_compare_price");console.log("comparePriceAttr11",comparePriceAttr)}else console.log("checkComparePrice element not found");let priceElement=sectionElement.querySelector(".cart-notification-price .product-option"),priceElementTrikot=sectionElement.querySelector(".cart-notification-price .price");if(document.querySelectorAll(".cart-item__old-price").forEach(element=>element.remove()),priceElementTrikot&&(priceElement=priceElementTrikot),console.log("priceElement",priceElement),priceElement){let priceText=priceElement.textContent.trim(),priceValue=parseFloat(priceText.replace(/[^\d,.]/g,"").replace(",","."));console.log("Price value as float:",priceValue);let discountedPrice,originalPrice=priceText;if(comparePriceAttr){let comparePriceValue=comparePriceAttr/100;console.log("Using compare_at_price for discount:",comparePriceValue);let compareDiscountPrice=applyAicoDiscount(comparePriceValue);compareDiscountPrice<priceValue?(console.log("Using discounted price (better for customer):",compareDiscountPrice),discountedPrice=compareDiscountPrice,originalPrice=`CHF ${comparePriceValue.toFixed(2)}`):(console.log("Using current price (better for customer):",priceValue),discountedPrice=priceValue.toFixed(2),originalPrice=`CHF ${comparePriceValue.toFixed(2)}`)}else console.log("Using current price for discount:",priceValue),discountedPrice=applyAicoDiscount(priceValue),originalPrice=priceText;if(priceValueNew){let discountedPriceNew=(parseFloat(discountedPrice)+parseFloat(priceValueNew)).toFixed(2);discountedPrice=discountedPriceNew,console.log("discountedPriceNew",discountedPriceNew)}console.log("Original price for strikethrough:",originalPrice);let strikePriceElement=parsedDoc.querySelector(".cart-notification-price .af-strike-price");console.log("strikePriceElement",strikePriceElement),strikePriceElement?strikePriceElement.innerHTML=originalPrice:console.log(".af-strike-price element not found."),console.log("cart-notification"),priceElement.innerHTML=`<span class="af-discount-price"><span class="af-discount-text">DEIN PREIS:</span><span class="af-discount-price-inner">CHF ${formatCHF(discountedPrice)}</span></span>`}else console.warn(".product-option price element not found in section")}return this.processCartRelatedProducts(),sectionElement.innerHTML}else return console.warn(`Selector '${selector}' not found in parsed HTML.`),""}handleBodyClick(evt){const target=evt.target;if(target!==this.notification&&!target.closest("cart-notification")){const disclosure=target.closest("details-disclosure, header-menu");this.activeElement=disclosure?disclosure.querySelector("summary"):null,this.close()}}setActiveElement(element){this.activeElement=element}processCartRelatedProducts(){const relatedProducts=$(".cart-notification-product .connected_products_wrapper li").not('[data-processed="true"]');return relatedProducts.length?(relatedProducts.each(function(){const li=$(this),span=li.find("span#aico-price-list");if(span.length){const dataAttr=span.attr("data-aico_price_object");
1if(dataAttr)try{const dataObj=JSON.parse(dataAttr);if(window.aico_percentage_discount&&window.aico_percentage_discount!=0){let amount=0,originalPrice;if(dataObj.compare_price){let comparePriceValue=parseFloat(dataObj.compare_price),compareDiscountPrice=applyAicoDiscount(comparePriceValue),currentPriceValue=parseFloat(dataObj.price);compareDiscountPrice<currentPriceValue?(amount=compareDiscountPrice,originalPrice=`CHF ${comparePriceValue.toFixed(2)}`):(amount=currentPriceValue,originalPrice=`CHF ${comparePriceValue.toFixed(2)}`)}else amount=applyAicoDiscount(dataObj.price),originalPrice=`CHF ${parseFloat(dataObj.price).toFixed(2)}`;li.find(".af-strike-price").html(originalPrice),console.log("cart-notification 1"),li.find(".af-price").html(`<span class="af-discount-text">DEIN PREIS:</span><span class="af-discount-price-inner">CHF ${formatCHF(amount)}</span>`).addClass("af-discount-price"),li.find(".card_options_form form #price_item_discount").remove(),li.find(".card_options_form form ").append(`<input id="price_item_discount" type="hidden" name="properties[_price_item_discount]" value="${amount}">`),li.attr("data-processed","true")}}catch(e){console.error("Invalid JSON in data-aico_price_object",e)}}}),!0):!1}}customElements.define("cart-notification",CartNotification);
2//# sourceMappingURL=/cdn/shop/t/48/assets/cart-notification.js.map?v=91993832395680102881790856091

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.