PageSourceSearch

https://www.nivea.co.jp/dist/NiveaX/modules/ExpandableSection.d4e28b49.js

js nivea.co.jp collected 2026-10-02 16:29:40 UTC 9,329 bytes, 2 lines download raw bytes

1"use strict";(self.NiveaXwebpackJsonp=self.NiveaXwebpackJsonp||[]).push([[48,3699,4318,8174,8242],{1001:(e,t,i)=>{i.r(t),i.d(t,{default:()=>s});var n=i(21464);class s{constructor(e,t={}){this.container=e,this.options=t,this.active=this.container.className.includes("active"),this.options=(0,n.$E)(this.container,Object.assign(this.getDefaultOptions(),this.options)),this.init()}init(){return this.setElementHeight(this.container,this.getSuitableHeight()),this.setOnResizeHandler(),this}saveInitialHeight(){return this.height=this.getElementHeight(this.container),this}getElementHeight(e){return e.offsetHeight}getSuitableHeight(){return this.active?"":this.options.collapsedHeight+"px"}setElementHeight(e,t){return e.style.maxHeight=null!=t?t:"",this}toggleState(){return this.active=!this.active,this}getDefaultOptions(){return{collapsedHeight:115}}setOnResizeHandler(){return NiveaX.addToEventStore("resize",()=>(0,n.Ys)(()=>this.onResize(),300),window),this}onResize(){const e=this.getSuitableHeight();this.setElementHeight(this.container,e)}setCollapsedHeight(e){return this.options.collapsedHeight=e,this}toggle(){return this.toggleState().setElementHeight(this.container,this.getSuitableHeight()),this}isActive(){return this.active}needToBeShown(){return this.height>1.25*this.options.collapsedHeight}clear(){return this.setElementHeight(this.container).saveInitialHeight(),this}render(){const e=this.getSuitableHeight();return this.setElementHeight(this.container,e),this}getContainer(){return this.container}}},23125:(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n=i(44648).default},33302:(e,t,i)=>{i.r(t),i.d(t,{default:()=>r});var n=i(23125),s=i(98684),a=i(21464);const o='[data-module="ExpandableSection"]';class r{static setup(e=o){Array.from(document.querySelectorAll(e)).filter(e=>!e.dataset.moduleInitialized).forEach(e=>{new r(e),e.dataset.moduleInitialized="true"})}constructor(e,t={}){this.element=e,this.options=t,this.options=(0,a.$E)(this.element,Object.assign(this.getDefaultOptions(),this.options)),this.container=this.getContainer(),this.button=(0,s.Tf)(`nx-u-plus-minus-btn ${this.options.expanderOptions.elementSelector}__button`),this.button.setAttribute("type","button"),this.displayType=this.getExpanderDisplayOption(),this.init()}getExpanderDisplayOption(){const{displayType:e}=this.options.expanderOptions,t=Object.entries(this.getExpandableDisplayOptions()).filter(([t,i])=>i==e);return Object.fromEntries(t)}init(){var e,t;if(this.initClasses().updateExpandableBgColor().setHeadlineAlignment(),!(null===(e=this.displayType)||void 0===e?void 0:e.NoExpander)&&!(null===(t=this.options)||void 0===t?void 0:t.hideExpandable))return this.initHeadline().initCollapsedHeight().initButton().initExpandable().setBeforeResizeCB(),this}updateExpandableBgColor(){return this.displayType.ExpOnlyOnDesktop&&this.element.classList.add("nx-expand-section__background--mobile"),this.displayType.ExpOnlyMobile&&this.element.classList.add("nx-expand-section__background--desktop"),this.displayType.NoExpander&&this.element.classList.add("nx-expand-section__no-expander"),this}initButton(){return this.headline.appendChild(this.button),this}initClasses(){return this.element.classList.add(this.options.expanderOptions.elementSelector),this.container.classList.add(this.options.expanderOptions.containerSelector),this}initHeadline(){return this.headline=this.getHeadline(),this.setHeadlineSelectorClass(),this}setHeadlineSelectorClass(){this.headline.classList.add(`${this.options.expanderOptions.elementSelector}__headline`)}getContainer(){return this.element.querySelector(`.${this.options.container}`)||this.element}getHeadline(){return this.element.querySelector(`.${this.options.headline}`)||this.createHeadline()}setHeadlineAlignment(){var e;const t=this.options.titleAlignment,i=null===(e=this.options.expanderOptions)||void 0===e?void 0:e.isExpanderOnPdp,n=this.element.querySelector(`.${this.options.headline}`);i?i&&""==t?null==n||n.classList.add("nx-u-txt--left","nx-u-txt--centered-desktop"):i&&t&&(null==n||n.classList.add(`nx-u-txt--${"centered"===t?"center":t}`)):null==n||n.classList.add("nx-u-txt--left")}createHeadline(){const e=(0,s.Uo)(this.options.headline);return this.element.insertBefore(e,this.element.firstChild),e}initCollapsedHeight(){return this.options.expanderOptions.expandableOptions.collapsedHeight=this.headline.offsetHeight,this}
1initExpandable(){return this.expander=new n.default(this.element,this.options.expanderOptions),this.expander.hideButton(!1),this}getDefaultOptions(){return{container:"nx-u-container",headline:"nx-u-section__headline",expanderOptions:{isExpanderOnPdp:!1,elementSelector:"nx-expand-section",containerSelector:"nx-expand-section__container",buttonSelector:"nx-expand-section__headline",isActive:!1,expandableOptions:{}}}}getExpandableDisplayOptions(){return Object.freeze({ExpOnlyOnDesktop:"desktop only",ExpOnlyMobile:"mobile only",ExpOnDesktopAndMobile:"desktop and mobile",NoExpander:"no accordion"})}setBeforeResizeCB(){return this.expander.setBeforResizeCB(()=>this.expander.setCollapsedHeight(this.headline.offsetHeight)),this}}r.setup(o)},44648:(e,t,i)=>{i.r(t),i.d(t,{default:()=>a});var n=i(89086),s=i(23425);class a extends((0,s.A)(n.default)){trackingEvent(e,t){if(window.NiveaX.deviceType.isDesktop)return;if(!t||e.closest(".nx-filter-layer"))return;let i=!1,n="";return e.className.search("active")>0&&(i=!0),n=this.setLabel(e),document.body.classList.contains("nx-pagetype-product")?this.trackPDPSection(e,"Tap minus",n):this.preventMultipleClicks(i,n),this}setLabel(e){let t=e.querySelector("h2"),i=e.querySelector("h3");return t?t.innerText:i?i.innerText:void 0}trackPDPSection(e,t,i){e.className.search("active")>0&&(t="Tap plus"),this.trackPDPSections("Product Detail Page",t,i)}preventMultipleClicks(e,t){e&&(this.element.classList.contains("nx-trigger-once")||(this.trackElementClick(t),this.element.classList.add("nx-trigger-once")),setTimeout(()=>{this.element.classList.remove("nx-trigger-once")},100))}trackElementClick(e){window.NiveaX.IsUAEnabled&&this.dataLayer.push({event:"ga_event",eventCategory:"Expand Content",eventAction:"Tap Button",eventLabel:e,eventNonInteraction:!1})}trackPDPSections(e,t,i){window.NiveaX.IsUAEnabled&&this.dataLayer.push({event:"ga_event",eventCategory:e,eventAction:t,eventLabel:i,eventNonInteraction:!1})}toggleExpander(e=!0){super.toggleExpander(e),this.trackingEvent(this.element,e),console.log(this.expanderState)}}},89086:(e,t,i)=>{i.r(t),i.d(t,{default:()=>o});var n=i(1001),s=i(21464);const a='[data-module="Expander"]';class o{static setup(e=a){Array.from(document.querySelectorAll(e)).filter(e=>!e.dataset.moduleInitialized).forEach(e=>{new o(e),e.dataset.moduleInitialized="true"})}constructor(e,t={}){this.element=e,this.options=t,this.options=(0,s.$E)(this.element,Object.assign(this.getDefaultOptions(),this.options)),this.container=this.element.querySelector(`.${this.options.containerSelector}`)||this.element,this.button=this.element.querySelector(`.${this.options.buttonSelector}`),this.expandable=new n.default(this.container,this.options.expandableOptions),this.init()}init(){return this.showExpanderButton().setButtonEventHandler().setOnResizeHandler().adjustAppearance().applyActiveFromOptions().applyContentAlignmentFromOptions(),this}showExpanderButton(){return this.button.hidden=!1,this}setButtonEventHandler(){return this.button.addEventListener("click",this.toggleExpander.bind(this)),this}toggleActiveModifier(e){return e?this.element.classList.add(`${this.options.elementSelector}--active`):this.element.classList.remove(`${this.options.elementSelector}--active`),this}showFade(e){return e?this.options.hasFade&&this.container.classList.add(`${this.options.containerSelector}--with-fade`):this.options.hasFade&&this.container.classList.remove(`${this.options.containerSelector}--with-fade`),this}toggleExpander(e=!0){this.expandable.toggle(),this.toggleActiveModifier(this.expandable.isActive()),this.expanderState=this.expandable.isActive()?"Expanded":"Collapsed"}onResize(){this.options.beforeResize(),this.options.isActive&&this.adjustAppearance()}applyActiveFromOptions(){return this.options.isActive&&this.toggleExpander(!1),this}applyContentAlignmentFromOptions(){return this.options.contentAlignment&&this.container.classList.add(`${this.options.containerSelector}--align-`+this.options.contentAlignment),this}setOnResizeHandler(){return NiveaX.addToEventStore("resize",()=>(0,s.Ys)(()=>this.onResize(),300),window),this}
1setupExpander(){return this.expandable.render(),this.showFade(!0).hideButton(!1),this}destroyExpander(){return this.expandable.clear(),this.showFade(!1).hideButton(!0),this}hideButton(e){return this.button.hidden=e,this}getDefaultOptions(){return{elementSelector:"nx-expander",containerSelector:"nx-expander__content",buttonSelector:"nx-expander__button",hasFade:!0,beforeResize:()=>{}}}adjustAppearance(){return this.expandable.clear(),this.expandable.needToBeShown()?this.setupExpander():this.destroyExpander(),this}setCollapsedHeight(e){return this.expandable.setCollapsedHeight(e),this}setBeforResizeCB(e){return this.options.beforeResize=e,this}isActive(){return this.expandable.isActive()}toggle(){return this.toggleExpander(),this}}o.setup(a)}}]);
2//# sourceMappingURL=/dist/NiveaX/./modules/ExpandableSection.d4e28b49.js.97026930.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.