PageSourceSearch

https://www.nivea.co.jp/dist/NiveaX/modules/ProductDetailPage-ProductDetailPage.e5254def.js

js nivea.co.jp collected 2026-10-02 16:31:38 UTC 11,299 bytes, 2 lines download raw bytes

1"use strict";(self.NiveaXwebpackJsonp=self.NiveaXwebpackJsonp||[]).push([[4196,5870],{43486:(t,e,o)=>{o.r(e),o.d(e,{default:()=>a});var i=o(98684),r=o(21464);const n='[data-module="Tab"]';class a{static setup(t=n){Array.from(document.querySelectorAll(t)).filter(t=>!t.dataset.moduleInitialized).forEach(t=>{new a(t),t.dataset.moduleInitialized="true"})}constructor(t){this.element=t,this.tabLinks=Array.from(this.element.querySelectorAll("[data-tab]")),this.tabSections=Array.from(this.element.querySelectorAll(".nx-tabs__item")),this.tabList=this.element.querySelector(".nx-scroll-wrapper__inner"),this.wrapperSelector=this.element.querySelector(".nx-scroll-wrapper__inner"),this.imageList=Array.from(this.element.querySelectorAll(".nx-tab-background")),this.tabLinks.length<=1||(this.cssClass={activeLink:"nx-tabs-links__item--active",activeSection:"nx-tabs__item--active",activeImage:"nx-tab-background--active"},this.init(),this.element.addEventListener("niveax:openTab",t=>this.openTabFromAnchor(t)))}init(){this.setTabEventHandler(),this.setActiveTabOnChange(0),(0,r.aO)(this.tabList),this.openTabFromAnchorOnLoad()}setTabEventHandler(){return this.tabLinks.forEach(t=>t.addEventListener("click",t=>this.onTabClick(t))),this}onTabClick(t){t.preventDefault(),this.changeTab(t)}changeTab(t,e=null){return this.clearActiveClass(),this.setActiveContainer(t,e),this}openTabFromAnchor(t){const e=t.detail.tabNode.getAttribute("data-tab-idx");this.changeTab(t,e),this.scrollToActive(e)}openTabFromAnchorOnLoad(){const t=window.location.hash.substring(1);if(t&&-1===t.indexOf("layer")&&this.element.contains(document.getElementById(`${t}`))){const e=this.findTabItemByAnchor(t);this.openTab(e),document.getElementById(`${t}`).scrollIntoView();const o=document.querySelector(".nx-anchor-navigation");window.scrollBy({top:o?-o.clientHeight:0,left:0,behavior:"auto"})}}findTabItemByAnchor(t){const e=this.element.querySelectorAll(".nx-tab-container-item");return Array.from(e).find(e=>e.contains(document.getElementById(`${t}`)))}openTab(t){const e=t.getAttribute("data-tab-idx");this.changeTab(null,e),this.scrollToActive(e)}scrollToActive(t){const e=this.element.querySelector(`.${this.cssClass.activeLink}[data-tab="${t}"]`);if(!e)return!1;const o=e.getBoundingClientRect().left-window.innerWidth/2+40;this.wrapperSelector.scrollLeft+=o}setActiveTabOnChange(t){this.tabLinks[t].classList.add(this.cssClass.activeLink),this.tabSections[t].classList.add(this.cssClass.activeSection)}clearActiveClass(){this.tabLinks.forEach(t=>t.classList.remove(this.cssClass.activeLink)),this.tabSections.forEach(t=>t.classList.remove(this.cssClass.activeSection)),this.imageList.forEach(t=>t.classList.remove(this.cssClass.activeImage)),this.element.setAttribute("style","")}setActiveContainer(t,e=null){let o=e||t.currentTarget.getAttribute("data-tab"),i=this.element.querySelector(`[id="${o}"], [data-tab-idx="${o}"]`),r=this.element.querySelector(`[data-tab-image-id="${o}"]`);const n=e?this.element.querySelector(`.nx-tabs-links__item[data-tab="${e}"]`):t.target;this.setActiveLink(n),this.setActiveTab(i),r&&this.setActiveImage(r),this.updateBackgroun
1dColor(n)}setActiveLink(t){t.classList.add(this.cssClass.activeLink)}setActiveTab(t){t.classList.add(this.cssClass.activeSection)}getHeightActiveTab(t){return t?(0,i.UI)(t):0}setActiveImage(t){t.classList.add(this.cssClass.activeImage)}updateBackgroundColor(t){this.element.setAttribute("style",null==t?void 0:t.getAttribute("data-style"))}}a.setup(n)},76766:(t,e,o)=>{o.r(e),o.d(e,{default:()=>s});var i=o(98684),r=o(21464),n=o(930),a=o(43486);class s{static setup(t='[data-module="ProductDetailPage"]'){Array.from(document.querySelectorAll(t)).filter(t=>!t.dataset.moduleInitialized).forEach(t=>{new s(t),t.dataset.moduleInitialized="true"})}constructor(t){this.element=t,this.cookieName="RecentlyViewed",this.recentlyViewedArray=new Array,this.productsToShow=12,this.policyAcceptedCookieName="cookie-policy-accepted",this.tabElement=document.querySelector(".nx-tabs"),this.productDetailElement=this.element.closest(".nx-product-detail"),this.cookieExpiration=Number(document.body.dataset.expirationPeriod||365),this.demandwareId=document.querySelector(".nx-product-information[data-demandware-id]")?document.querySelector(".nx-product-information[data-demandware-id]").attributes["data-demandware-id"].value:"";const e=(0,r.Ri)(this.policyAcceptedCookieName);document.addEventListener("niveax:cookieBannerAccept",()=>this.initCookie()),"1"!==e&&""!==e||this.initCookie(),this.tabElement&&(this.tab=new a.default(this.productDetailElement)),this.init()}init(){this.loadMoreListener(),this.eventHandlers(),document.addEventListener("layer:ShowLayer",()=>this.comparePreviouslyRatedProduct()),this.initBottomBar(),this.listenToCartChange()}listenToCartChange(){document.addEventListener("addtocart:cartchange",()=>{this.initBottomBar()})}initBottomBar(){if(document.querySelector(".nx-mob-nav__bottom-bar"))return;const t=document.querySelector(".nx-add-to-cart");if(t)this.initBottomBarEshop(t);else{const t=this.createBottomBarContentWtb();if(!t)return;this.addWtbElementsToBottomBar(t),this.observeBottomBarIntersection()}}initBottomBarEshop(t){const e=null==t?void 0:t.cloneNode(!0),o=null==e?void 0:e.querySelector("button");if(!e||!o)return void document.addEventListener("addtocart:loadpriceinfo",()=>{this.initBottomBar()});const i=this.createBottomBarContentEshop();i&&(this.addShopElementsToBottomBar(i,e,o),document.dispatchEvent(new CustomEvent("productdetailpage:bottombarinit",{detail:i})),this.observeBottomBarIntersection())}addWtbElementsToBottomBar(t){this.addProductImageToBottomBar(t),this.addRatingToBottomBar(t),this.addProductNameToBottomBar(t),this.addWtbButtonToBottomBar(t)}addWtbButtonToBottomBar(t){const e=(null==t?void 0:t.getAttribute("data-wtb-icon"))?t.getAttribute("data-wtb-icon"):"",o=null==t?void 0:t.getAttribute("data-wtb-button-txt");if(!o)return;const i=(0,n.Si)(e,o);t.querySelector(".nx-product-bottom-bar__content-wrapper").append(i)}addShopElementsToBottomBar(t,e,o){this.addPricesToBottomBar(t,e),this.addAddToCartButtonsToBottomBar(t,e,o),this.addProductImageToBottomBar(t),this.addRatingToBottomBar(t),this.addProductNameToBottomBar(t)}initCookie(){this.getRecentlyViewedCookie(this.cookieName)?this.currentProductExist()<0&&this.setCookie():this.setCookie()}getRecentlyViewedCookie(t){return(0,r.Ri)(t)}comparePreviouslyRatedProduct(){const t=sessionStorage.getItem("demandwareId");t?t!==this.demandwareId&&(this.removeFormSession(),sessionStorage.setItem("demandwareId",this.demandwareId)):sessionStorage.setItem("demandwareId",this.demandwareId)}removeFormSession(){for(let t=0;t<sessionStorage.length;t++)sessionStorage.key(t).indexOf("form_id_")>0&&sessionStorage.removeItem(sessionStorage.key(t))}unserializeCookie(){return this.recentlyViewedArray=this.getRecentlyViewedCookie(this.cookieName).split("|"),this.recentlyViewedArray}addToProductArray(t,e){return t?(t.length>=this.productsToShow&&t.pop(),t.unshift(e)):t.push(e),t}serializeCookie(t){return t.join("|")}currentProductExist(){return this.unserializeCookie().indexOf(this.demandwareId)}eventHandlers(){let t=document.querySelector(".nx-rating--pdp");t&&this.addListenerToRatingsAndReviewsAnchor(t)}addListenerToRatingsAndReviewsAnchor(t){t.addEventListener("click",()=>{if(this.productDetailElement)this.openRatingTab();else{if(void 0===this.scrollTo){return void(()=>o.e(8287).then(o.bind(o,19967)))().then(t=>{this.scrollTo=new t.default,this.scrollToRatingSection()})}this.scrollToRatingSection()}})}scrollToRatingSection(){var t;const e=document.querySelector(".nx-ratings-and-reviews-section"),o=e.querySelector("h2.nx-u-section__headline");return document.querySelector("body").classList.add("nx-scrolling"),e.classList.contains("nx-expand-section--active")||null==o||o.click(),null===(t=this.scrollTo)||void 0===t||t.animateScrollTop(e,450,
10,()=>{document.querySelector("body").classList.remove("nx-scrolling")}),this}openRatingTab(){const t=Array.from(this.productDetailElement.querySelectorAll(".nx-tabs__item")).findIndex(t=>t.querySelector(".nx-ratings-and-reviews-section-slider"));t>-1&&(this.tab.clearActiveClass(),this.tab.setActiveTabOnChange(t),this.productDetailElement.querySelector(".nx-tabs__wrapper").removeAttribute("style"))}loadMoreListener(){return document.addEventListener("NiveaXLoadMoreLoaded",t=>{document.querySelector(".nx-ratings-and-reviews-section .nx-u-container").style.maxHeight="initial"}),this}setCookie(){(0,r.TV)(this.cookieName,this.serializeCookie(this.addToProductArray(this.recentlyViewedArray,this.demandwareId)),this.cookieExpiration)}observeBottomBarIntersection(){this.intersectionObserver=this.createIntersectionObserver();const t=document.querySelector(".nx-footer");t&&this.intersectionObserver.observe(t);const e=document.querySelector(".nx-product-stage");e&&this.intersectionObserver.observe(e)}createIntersectionObserver(){return new IntersectionObserver(t=>{const e=this.element.querySelector(".nx-product-bottom-bar");e&&t.forEach(t=>{t.isIntersecting?(0,i.vy)(e,"nx-product-bottom-bar--visible"):(0,i.iQ)(e,"nx-product-bottom-bar--visible")})})}createBottomBarContentEshop(){const t=this.element.querySelector(".nx-product-bottom-bar");if(t)return t.innerHTML="",t.appendChild((0,n.Aj)()),t}createBottomBarContentWtb(){const t=this.element.querySelector(".nx-product-bottom-bar");if(t)return t.innerHTML="",t.appendChild((0,n.wF)()),t}addProductNameToBottomBar(t){const e=t.querySelector(".nx-product-bottom-bar__product-wrapper");if(e){const t=this.getProductName();t&&e.append(t)}}addRatingToBottomBar(t){const e=t.querySelector(".nx-product-bottom-bar__product-wrapper");if(e){const t=this.getRating();t&&(this.addListenerToRatingsAndReviewsAnchor(t),e.append(t))}}addProductImageToBottomBar(t){const e=t.querySelector(".nx-product-bottom-bar__image-wrapper");if(e){const t=this.getProductImage();t&&e.appendChild(t)}}addAddToCartButtonsToBottomBar(t,e,o){const i=t.querySelector(".nx-product-bottom-bar__content-wrapper"),r=e.querySelector(".nx-range-dropdown");null==o||o.classList.add("nx-product-bottom-bar__add-to-cart-button"),null==i||i.append(r,o)}addPricesToBottomBar(t,e){const o=t.querySelector(".nx-product-bottom-bar__price-wrapper");if(o){const t=e.querySelector(".nx-original-price")?e.querySelector(".nx-original-price"):"",i=e.querySelector(".nx-pricing")?e.querySelector(".nx-pricing"):"",r=e.querySelector(".nx-unit-price")?e.querySelector(".nx-unit-price"):"",n=o.querySelector(".nx-product-bottom-bar__price-wrapper-pricing");null==n||n.append(t,i);const a=o.querySelector(".nx-product-bottom-bar__price-wrapper-unit-price");null==a||a.append(r)}}getProductImage(){var t;const e=null===(t=this.element.querySelector(".nx-product-stage__item--image"))||void 0===t?void 0:t.cloneNode(!0);return null==e?void 0:e.querySelector("picture")}getRating(){var t;return null===(t=this.element.querySelector(".nx-rating"))||void 0===t?void 0:t.cloneNode(!0)}getProductName(){const t=document.querySelector(".nx-product-stage__headline"),e=t?(0,i._A)(t):"";return(0,i.Uo)(`<h4 class="nx-font-heading-4 nx-font--bold nx-txt-uppercase nx-u-mb-base-0">${e}</h4>`)}}}}]);
2//# sourceMappingURL=/dist/NiveaX/./modules/ProductDetailPage-ProductDetailPage.e5254def.js.2ea9d7f8.map

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.