PageSourceSearch

https://zooart.com.pl/gfx/pol/hotspots_javascript.js.gzip?r=1790665955

js zooart.com.pl collected 2026-10-02 17:37:21 UTC 17,919 bytes, 1 lines download raw bytes

1const HOTSPOTS_GQL={HOTSPOT:(t,e)=>`${t}: hotspots(${e}) {\n      products {\n        id\n        type\n        code\n        name\n        producer {\n          name\n        }\n        link\n        zones\n        icon\n        iconSecond\n        iconSmall\n        iconSmallSecond\n        price {\n          rebateCodeActive\n          price {\n            ${app_shop.vars.priceType} {\n              value\n              formatted\n            }\n          }\n          omnibusPrice {\n            ${app_shop.vars.priceType} {\n              value\n              formatted\n            }\n          }\n          omnibusPriceDetails {\n            unit {\n              ${app_shop.vars.priceType} {\n                value\n                formatted\n              }\n            }\n            youSavePercent\n            omnibusPriceIsHigherThanSellingPrice\n            newPriceEffectiveUntil {\n              formatted\n            }\n          }\n          max {\n            ${app_shop.vars.priceType} {\n              value\n              formatted\n            }\n          }\n          unit {\n            ${app_shop.vars.priceType} {\n              value\n              formatted\n            }\n          }\n          unitConvertedPrice {\n            ${app_shop.vars.priceType} {\n              value\n              formatted\n            }\n          }\n          youSavePercent\n          beforeRebate {\n            ${app_shop.vars.priceType} {\n              value\n              formatted\n            }\n          }\n          beforeRebateDetails {\n            youSavePercent\n            unit {\n              ${app_shop.vars.priceType} {\n                value\n                formatted\n              }\n            }\n          }\n          advancePrice {\n            ${app_shop.vars.priceType} {\n              value\n              formatted\n            }\n          }\n          suggested {\n            ${app_shop.vars.priceType} {\n              value\n              formatted\n            }\n          }\n          rebateNumber {\n            number\n            ${app_shop.vars.priceType} {\n              value\n              formatted\n            }\n          }\n        }\n        awardedParameters {\n          id\n          name\n          values {\n            id\n            name\n            link\n            description\n          }\n        }\n        sizes {\n          id\n          weight\n          price {\n            rebateCodeActive\n            price {\n              ${app_shop.vars.priceType} {\n                value\n                formatted\n              }\n            }\n            omnibusPrice {\n              ${app_shop.vars.priceType} {\n                value\n                formatted\n              }\n            }\n            omnibusPriceDetails {\n              unit {\n                ${app_shop.vars.priceType} {\n                  value\n                  formatted\n                }\n              }\n              youSavePercent\n              omnibusPriceIsHigherThanSellingPrice\n              newPriceEffectiveUntil {\n                formatted\n              }\n            }\n            max {\n              ${app_shop.vars.priceType} {\n                value\n                formatted\n              }\n            }\n            unit {\n              ${app_shop.vars.priceType} {\n                value\n                formatted\n              }\n            }\n            unitConvertedPrice {\n              ${app_shop.vars.priceType} {\n                value\n                formatted\n              }\n            }\n            youSavePercent\n            beforeRebate {\n              ${app_shop.vars.priceType} {\n                value\n                formatted\n              }\n            }\n            beforeRebateDetails {\n              youSavePercent\n              unit {\n                ${app_shop.vars.priceType} {\n                  value\n                  formatted\n                }\n              }\n            }\n            advancePrice {\n              ${app_shop.vars.priceType} {\n                value\n                formatted\n              }\n            }\n            suggested {\n              ${app_shop.vars.priceType} {\n                value\n                formatted\n              }\n            }\n            rebateNumber {\n              number\n              ${app_shop.vars.priceType} {\n                value\n                formatted\n              }\n            }\n          }\n        }\n        unit {\n          sellBy\n          plural\n          singular\n          unitConvertedFormat\n        }\n        points\n      }\n      name\n      url\n      type\n      took\n      ${"function"==typeof app_shop?.vars?.additionalHotspotQueryReduce?app_shop?.vars?.additionalHotspotQueryReduce():""}\n    }`,HOTSPOTS_ALL_QUERY:t=>JSON.stringify({query:`query {\n      ${t}\n    }`})};class GetHotspots{constructor(t={}){this.allHotspots=[...document.querySelectorAll(".hotspot__wrapper[data-
1pagetype]")],this.allHotspotsData=[],this.hotspotsToLoad=[...this.allHotspots],this.hotspotsInView=[],this.loadedHotspots=[],this.hotspotsInViewDelay=400,this.priceType=t.priceType,this.callbacksBeforeAppend=t.callbacksBeforeAppend||{},this.callbacksAfterAppend=t.callbacksAfterAppend||{},this.productsMinHeight=t.productsMinHeight??!1,this.omnibusDataAll=[],this.txt={pkt:"pkt","punktów":"punktów",od:"od",do:"do",Subskrypcja:"Subskrypcja","Strefa rekomendacji":"Strefa rekomendacji","Zobacz więcej":"Zobacz więcej",netto:"netto",brutto:"brutto"}}async fetchData(t={}){const{data:e,link:s,linkParameter:a=""}=t;if(!e)return!1;try{const t=await fetch(`${s||app_shop.urls.graphql||"/graphql/v1"}${a}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:e});return await t.json()}catch(t){return!1}}async loadHotspots(){const t=HOTSPOTS_GQL.HOTSPOTS_ALL_QUERY(this.hotspotsInView.reduce(((t,e)=>{const s=this.allHotspotsData.filter((t=>e.id===t.id))?.[0],a=`hotspotsPanelParamsInput: { page: ${s?.page}, zone: zone${s?.zone} ${s.products?`, products: [${s.products}]`:""}}`;return t+=HOTSPOTS_GQL.HOTSPOT(s.id,a)}),""));this.hotspotsInView=[];const e=await this.fetchData({data:t,linkParameter:"?hotspots"});e.data&&(Object.entries(e?.data),this.loadedHotspots=[...this.loadedHotspots,...Object.entries(e?.data)],this.hotspotsToSet=[...Object.entries(e?.data)]),this.hotspotsToSet?.forEach((t=>{const e=this.allHotspots.filter((e=>t[0]===e.id))?.[0];return!!e&&(this.setHotspot(t[1],e),!0)}))}loadHotspotsDelay(){clearTimeout(this.loadingTimer),this.loadingTimer=setTimeout((()=>{this.loadHotspots()}),this.hotspotsInViewDelay)}getHotspotsInPage(){this.allHotspotsData=this.allHotspots.map((t=>({id:t?.id,page:t.dataset?.pagetype,zone:t.dataset?.zone,products:t.dataset?.products||null})))}hotspotObserverFunc(t){t.forEach((t=>{if(!t.isIntersecting)return!1;if(this.hotspotsToLoad.includes(t.target)){if(t.target.querySelector(".hotspot.--initialized"))return;this.hotspotsToLoad=this.hotspotsToLoad.filter((e=>e!==t.target)),this.hotspotsInView.push(t.target),this.loadHotspotsDelay(),this.hotspotObserver.unobserve(t.target)}return!0}))}hotspotObserverInit(){this.hotspotObserver=new IntersectionObserver((t=>{this.hotspotObserverFunc(t)})),this.allHotspots.forEach((t=>this.hotspotObserver.observe(t)))}setHtml(t,e,s,a){const n=this.activeTemplate.querySelector(`${t}`);return s?.forEach((t=>{n?.setAttribute(t?.name,t?.val)})),!(!n||!e)&&(e&&n?.insertAdjacentHTML(a||"beforeend",e),n?.classList.remove("--hidden"),!0)}getHotspotWrapperName(t,e,s){const a=e?".hotspot_link_headline":".hotspot_headline",n=s.querySelector(a)?.content.cloneNode(!0);if(!n||!t)return null;const i=`${this.txt["Strefa rekomendacji"]}: ${t}`,o=`${this.txt["Strefa rekomendacji"]} ${t}: ${this.txt["Zobacz więcej"]}`;return n.querySelector(".headline__name")?.insertAdjacentHTML("afterbegin",t),n.querySelector(".headline__name")?.setAttribute("aria-label",i),n.querySelector("a.headline")?.setAttribute("href",e),n.querySelector("a.headline")?.setAttribute("title",i),n.querySelector("a.headline__after")?.setAttribute("href",e),n.querySelector("a.headline__after")?.setAttribute("title",o),n.querySelector("a.headline__after .link__text")?.setAttribute("aria-label",o),n}getHotspotWrapper(t,e){const s=e.querySelector("template.hotspot_wrapper")?.content.cloneNode(!0);if(!s)return null;const{name:a,url:n}=t,i=this.getHotspotWrapperName(a,n,e);return i?(s.querySelector(".hotspot__name").append(i),s):(s.querySelector(".hotspot__name")?.remove(),s)}getImgElement(){return""+(void 0!==this.currProductsData.iconSecond&&void 0!==this.currProductsData.iconSmallSecond?`<picture>\n        <source media="(min-width: 421px)" type="image/webp" srcset="${this.currProductsData.icon}"/>\n        <source media="(min-width: 421px)" type="image/jpeg" srcset="${this.currProductsData.iconSecond}"/>\n        <source media="(max-width: 420px)" type="image/webp" srcset="${this.currProductsData.iconSmall}"/>\n        <source media="(max-width: 420px)" type="image/jpeg" srcset="${this.currProductsData.iconSmallSecond}"/>\n        <img src="${this.currProductsData.iconSecond}" loading="lazy" alt="${this.currProductsData.name}">\n      </picture>`:`<picture>\n        <source media="(min-width: 421px)" srcset="${this.currProductsData.icon}"/>\n        <source media="(max-width: 420px)" srcset="${this.currProductsData.iconSmall}"/>\n        <img src="${this.currProductsData.iconSecond}" loading="lazy" alt="${this.currProductsData.name}">\n      </picture>`)}setLabels(t){t?.length&&t.includes("subscription")&&this.setHtml(".label_icons",`<span class="label --subscription">${this.txt.Subskrypcja}</span>`)}setOmnibus(t,e){if(!t||!e)return!1;this.omnibusData=app_shop.fn.getOmnibusDetails?.({productData:this.currProductsData});const s=this.activeTemplate.querySelector(".product__prices"),a=this.activeTemplate.querySelector(".product"),n=this.activeTemplate.querySelector(".product__content_wrapper");return!!this.omnibusData&&(s?.classList.add(...this.omnibusData.classes.add),s?.classList.remove(...this.omnibusData.classes.remove),a?.classList.add(...this.omnibusData.classes.add),a?.classList.remove(...this.omnibusData.classes.remove),this.omnibusData?.max?.visible&&s?.classList.add("--max-price"),this.setHtml(".price.--omnibus",this.omnibusData?.omnibus?.visible?this.omnibusData?.omnibus?.html:null),this.setHtml(".price.--max",this.omnibusData?.max?.visible?this.omnibusData?.max?.html:null),this.setHtml(".price.--before-rebate",this.omnibusData?.beforeRebate?.visible?this.omnibusData?.beforeRebate?.html:null),this.setHtml(".price.--new-price",this.omnibusData?.newPriceEffectiveUntil?.visible?this.omnibusData?.newPriceEffectiveUntil?.html:null),(this.omnibusData?.max||this.omnibusData?.omnibus||this.omnibusData?.beforeRebate||this.omnibusData?.newPriceEffectiveUntil)&&n.classList.add("--promotion-idm"),this.omnibusData?.omnibusLabel?.length&&this.omnibusData?.omnibusLabel.forEach((t=>{this.setHtml(".label_icons",t.html)})),this.omnibusDataAll?.push(this.omnibusData),!0)}setPrices(){const{price:t}=this.currProductsData.price,{unit:e}=this.currProductsData,s=this.priceType;if(0===t[s].value)return this.activeTemplate.querySelector(".price.--phone")?.classList.remove("--hidden"),this.activeTemplate.querySelector(".price.--normal.--main")?.classList.add("--hidden"),this.activeTemplate.querySelector(".product")?.classList.add("--phone"),!1;const{sizes:a,id:n}=this.currProductsData,i=a?.map((t=>t?.price?.unit?.[s]||t?.price?.price?.[s])),o=((t=[])=>t.reduce(((t,e)=>t?.value>e?.value?e:t),t[0]))(i),r=((t=[])=>t.reduce(((t,e)=>t?.value<e?.value?e:t),t[0]))(i);this.setHtml(".price_vat","gross"==app_shop.vars?.priceType?` ${this.txt.brutto}`:` ${this.txt.netto}`),this.setHtml(".price_sellby__sellby",`${e?.sellBy}`,[{name:"data-sellby",val:e?.sellBy}]),this.setHtml(".price_sellby__unit",`${e?.sellBy>1?e?.plural:e?.singular}`),this.setHtml(".price_sellby__sep","/");const p=this.currProductsData.price?.unitConvertedPrice?.[s]?.formatted;p&&this.setHtml(".price.--convert",`(${p} / ${e?.unitConvertedFormat})`);const c=this.currProductsData?.points;return c&&this.setHtml(".price.--points",`${c} <span aria-hidden="true">${this.txt?.pkt}</span><span class="sr-only">${this.txt?.["punktów"]}</span>`),o?.value!==r?.value?(this.setHtml(".price.--normal .price__range.--min",`<span class="sr-only">${this.txt?.od} </span>${o.formatted}`),this.setHtml(".price.--normal .price__range.--max",`<span class="sr-only">${this.txt?.do} </span>${r.formatted}`),this.setHtml(".price.--normal .price__sep"," - "),!1):(this.setOmnibus(n,a),this.setLabels(this.currProductsData.zones),t?.[s]?(this.setHtml(".price.--normal .price__sub",this.currProductsData.price?.unit?.[s]?.formatted||t?.[s]?.formatted),!1):(t?.omnibusPrice?.gross?.formatted&&this.setHtml(".price__max",this.currProductsData.price?.gross?.formatted),!0))}getHotspotProducts(t,e){const s=t?.products,a=[];return s?.forEach((t=>{const n=e.querySelector("template.hotspot_product")?.content.cloneNode(!0);if(!s||!n)return;this.currProductsData=t,this.activeTemplate=n;const{id:i,name:o,link:r}=this.currProductsData,p=[{name:"href",val:r},{name:"title",val:o}],c=idmGetProductWeight(this.currProductsData);this.setHtml(".product",!1,[{name:"data-id",val:i}]),this.setHtml(".product__name",o,p),this.setHtml(".product__icon",this.getImgElement(),p,"afterbegin"),c&&this.setHtml(".product__weight",`${c}`),this.setPrices(),this.setHtml(".bmFavourites",!1,[{name:"data-productid",val:i}]),a.push(n)})),a}async initCallback(t,e,s,a){t&&await Object.values(t).reduce((async(t,n)=>{await t,await(n?.(e,s,a))}),Promise.resolve())}hideHotspotWrapper(t){const e=t.querySelector(".skeleton");e?.parentNode?.classList?.add?.("--hidden"),e?.parentNode?.removeChild(e)}async setHotspot(t,e){if(null===t)return void this.hideHotspotWrapper(e);const s=this.getHotspotWrapper(t,e);if(!s)return;const a=e.querySelector(".skeleton"),n=this.getHotspotProducts(t,e);n&&0!==n.length?(n?.forEach((t=>{s?.querySelector(".hotspot__products")?.append(t)})),s?.firstChild?.classList.add("--initialized"),await this.initCallback(this.callbacksBeforeAppend,t,s,e),a?.parentNode?.removeChild(a),e.prepend(s),await this.initCallback(this.callbacksAfterAppend,t,s,e),attachFavListListener()):this.hideHotspotWrapper(e)}init(){this.allHotspots=[...document.querySelectorAll(".hotspot__wrapper[data-
1pagetype]")].filter((t=>t.querySelector(".hotspot:not(.--initialized)"))),this.allHotspotsData=[],this.hotspotsToLoad=[...this.allHotspots],this.hotspotsInView=[],this.getHotspotsInPage(),this.hotspotObserverInit()}}app_shop.vars.hotspotCallbacksBeforeAppend={},app_shop.vars.hotspotCallbacksAfterAppend={},app_shop.vars.additionalHotspotQueryObj={},app_shop.vars.productsMinHeight=app_shop?.vars?.hotspotsConfig?.productsMinHeight??!1,app_shop.vars.additionalHotspotQueryReduce=()=>"object"!=typeof app_shop.vars.additionalHotspotQueryObj?"":Object.values(app_shop.vars.additionalHotspotQueryObj).reduce(((t,e,s)=>`${0!==s?`${t} \n `:""} ${e}`),"");const hotspotOptions={priceType:app_shop.vars.priceType||"net",callbacksBeforeAppend:app_shop.vars.hotspotCallbacksBeforeAppend||[],callbacksAfterAppend:app_shop.vars.hotspotCallbacksAfterAppend||[],productsMinHeight:app_shop.vars.productsMinHeight??!1};app_shop.vars.hotspotCallbacksAfterAppend.omnibus=()=>{"function"==typeof runOmnibusFallback&&runOmnibusFallback()},app_shop.vars.hotspots=new GetHotspots(hotspotOptions),app_shop.run((function(){try{app_shop.vars.hotspots.init()}catch(t){window?.errorLog?.(t)}}),"all",".hotspot__wrapper",!0);const HOTSPOTS_OPINION_GQL={OPINION:(t,e)=>`${t}: opinion(${e}) {\n      id\n      author\n      content\n      rating\n      confirmedByPurchase\n    }`,OPINION_ALL_QUERY:t=>JSON.stringify({query:`query {\n      ${t}\n    }`})};class HotspotOpinionsPlugin extends GetHotspots{constructor(){super(),this.txt={"Potwierdzona zakupem":"Potwierdzona zakupem"}}async getOpinion(){const t=this.products.filter((t=>!sessionStorage.getItem(`productOpinions_${t}`))),e=this.products.filter((t=>sessionStorage.getItem(`productOpinions_${t}`))),s=HOTSPOTS_OPINION_GQL.OPINION_ALL_QUERY(t.reduce(((t,e)=>t+=HOTSPOTS_OPINION_GQL.OPINION(`productOpinions_${e}`,`SearchOpinionsInput: { type: "product", ordersBy: "date", sourceId: "${e}", resultsLimit: 1 }`)),"")),a={};e.forEach((t=>{a[`productOpinions_${t}`]=JSON.parse(sessionStorage.getItem(`productOpinions_${t}`))}));const n=t.length?await this.fetchData({data:s,linkParameter:"?opinion"}):{data:a};if(!n)return!1;const i={...n.data,...a};return this.productsRatings=this.products.map((t=>{const e=i[`productOpinions_${t}`]?.[0];return sessionStorage.getItem(`productOpinions_${t}`)||sessionStorage.setItem(`productOpinions_${t}`,JSON.stringify(i[`productOpinions_${t}`]||[])),{id:t,rating:e?.rating||0}})),!0}setOpinions(t=[]){const e=new Map(t.map((({id:t,rating:e})=>[String(t),e])));this.hotspotWrapper.querySelectorAll(".product").forEach((t=>{const s=e.get(t.dataset.id)||0,a=document.createElement("div");a.className="comments_info",a.innerHTML=`\n        <div class="comments">\n          <div class="note">\n            <span>\n              ${Array.from({length:5},((t,e)=>`\n                <i class="icon-star ${e<s?"active":""}"></i>\n              `)).join("")}\n            </span>\n            \n            <small>${s}/5</small>\n          </div>\n        </div>\n      `,t.querySelector(".product__name")?.before(a)}))}async init(t){const[e,s,a]=t;return this.hotspotData=e,this.hotspotWrapper=s,this.hotspotElement=a,this.products=this.hotspotData?.products?.map((t=>t.id))||[],await this.getOpinion(),!0}}app_shop.vars.hotspotCallbacksBeforeAppend.opinion=async(...t)=>{const e=new HotspotOpinionsPlugin;await e.init(t),e.setOpinions(e.productsRatings)};

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.