PageSourceSearch

https://bromarkt.pl/gfx/pol/menu_shoppinglist.js.gzip?r=1790776705

js bromarkt.pl collected 2026-10-09 00:20:44 UTC 10,844 bytes, 1 lines download raw bytes

1app_shop.run((function(){app_shop.fn.shoppingList=new ShoppingList,document.getElementById("container").appendChild(document.querySelector(".sl_choose")),document.addEventListener("click",(function(t){if(t.target.closest(".projector_buttons_obs")){if(t.preventDefault(),!app_shop.fn.sizeSelected())return app_shop.fn.alertProjector(),!1;if("function"==typeof app_shop.fn.bundleSizeSelected&&!app_shop.fn.bundleSizeSelected())return!1;app_shop.fn.shoppingList.addProductToList([[document.getElementById("projector_product_hidden").value,document.getElementById("projector_size_hidden").value]])}if(t.target.closest(".basketedit_page .tool__button.--add-to-favorite")){t.preventDefault();const e=[];document.querySelectorAll("#Basket .basket__block[data-product-id]").forEach((t=>{const s=t.getAttribute("data-product-id"),i=t.getAttribute("data-product-size");e.push([s,i])})),app_shop.fn.shoppingList.addProductToList(e)}return!1}))}),"all",".sl_choose");const ShoppingListTxt={firstListName:"Lista zakupowa",productAlreadyOnList:"Produkt znajduje się już na jednej z Twoich list zakupowych"};ShoppingList=function(t){const e=this;return this.params=t||{},this.vars={selectedProducts:[]},this.fetchData=async t=>{try{const e=await fetch("/graphql/v1/",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:t});await app_shop.graphql.trackingEvents(e);return await e.json()}catch(t){return!1}},this.getListQuery=t=>{const{idList:e,nameList:s,linkList:i,countList:a}=t;return JSON.stringify({query:`query {\n        shoppingList(ShoppingListInput: {\n          id: ${e}\n        }) {\n          ${void 0!==s&&s?"name":""}\n          ${void 0!==i&&i?"link":""}\n          ${void 0!==a&&a?"productCount":""}\n        }\n      }`})},this.addListQuery=t=>JSON.stringify({query:`mutation {\n      shoppingListCreate(ShoppingListSettingsInput: {\n        name: "${t}",\n        public: true,\n      }) {\n        status\n        id\n      }\n    }`}),this.deleteListQuery=t=>JSON.stringify({query:`mutation {\n      shoppingListDelete(ShoppingListInput: {\n        id: ${t}\n      }) {\n        status\n      }\n    }`}),this.updateListQuery=t=>{const{idList:e,nameList:s,publicList:i}=t;return JSON.stringify({query:`mutation {\n        setShoppingList(ShoppingListInput: {\n          ${void 0!==e?`id: ${e},`:""}\n        }, ShoppingListSettingsInput: {\n          ${void 0!==s?`name: "${s}",`:""}\n          ${void 0!==i?`public: ${i},`:""}\n        }) {\n          status\n        }\n      }`})},this.addProductQuery=(t,e)=>JSON.stringify({query:`mutation {\n      addToShoppingList(ShoppingListInput: {\n        id: ${t}\n      }, ShoppingListProduct: [${e.map((t=>`{\n        id: ${t[0]},\n        size: "${"onesize"===t[1]?"uniw":t[1]}",\n      }`)).join(",")}]) {\n        status\n      }\n    }`}),this.deleteProductQuery=(t,e)=>JSON.stringify({query:`mutation {\n      removeFromShoppingList(ShoppingListInput: {\n        id: ${t}\n      }, ShoppingListProduct: [${e.map((t=>`{\n        id: ${t[0]},\n        size: "${"onesize"===t[1]?"uniw":t[1]}",\n      }`)).join(",")}]) {\n        status\n      }\n    }`}),this.queryCombo=async t=>{const{statusElement:e,fetchDataQuery:s,afterSuccess:i,afterError:a}=t;e&&this.status(e,"loading");const o=await this.fetchData(s);o.data&&(o.data.shoppingListCreate&&"success"===o.data.shoppingListCreate.status||o.data.shoppingListDelete&&"success"===o.data.shoppingListDelete.status||o.data.setShoppingList&&"success"===o.data.setShoppingList.status||o.data.addToShoppingList&&"success"===o.data.addToShoppingList.status||o.data.removeFromShoppingList&&"success"===o.data.removeFromShoppingList.status)?(e&&this.status(e,"success"),i&&i(o)):(e&&this.status(e,"error"),o.errors&&o.errors[0]&&o.errors[0].message&&Alertek.Start(o.errors[0].message),a&&a(o))},this.status=(t,e,s)=>{if(t)switch(e){case"loading":t&&t.classList.add("--loading");break;case"success":t&&(t.classList.remove("--loading"),t.classList.add("--success"),s||setTimeout((function(){t.classList.remove("--success")}),1e3));break;case"error":t&&(t.classList.remove("--loading"),t.classList.add("--error"),s||setTimeout((function(){t.classList.remove("--error")}),1e3));break;default:return t&&t.classList.remove("--loading","--success","--errror"),!1}return!0},this.updateListName=(t,e)=>{document.querySelectorAll(`[data-list_id="${t}"]`).forEach((s=>{s.querySelectorAll("[data-list_name]").forEach((s=>{s.closest("[data-list_id]").getAttribute("data-list_id")===t&&(s.textContent=e)}))}))},this.updateListCount=async t=>{const{idList:e,afterSuccess:s,afterError:i}=t,a=await this.fetchData(this.getListQuery({idList:e,countList:!0}));if(a.data&&a.data.shoppingList){const t=a.data.shoppingList[0].productC
1ount;document.querySelectorAll(`[data-list_id="${e}"]`).forEach((s=>{s.querySelectorAll("[data-list_count]").forEach((s=>{s.closest("[data-list_id]").getAttribute("data-list_id")===e&&(s.textContent=t)}))})),s&&s(a)}else i&&i(a)},this.updateListShare=t=>{document.querySelectorAll(`[data-list_id="${t}"]`).forEach((t=>{t.hasAttribute("data-shared")?t.removeAttribute("data-shared"):t.setAttribute("data-shared","true")}))},this.updateListDelete=t=>{document.querySelectorAll(`[data-list_id="${t}"]`).forEach((t=>{2===t.parentNode.querySelectorAll("[data-list_id]").length&&t.closest("[data-empty]")&&t.closest("[data-empty]").setAttribute("data-empty","true"),t.parentNode.removeChild(t)}))},this.updateListCreate=async t=>{const{idList:e,afterSuccess:s,afterError:i}=t,a=await this.fetchData(this.getListQuery({idList:e,nameList:!0,linkList:!0}));if(a.data&&a.data.shoppingList){const t=a.data.shoppingList[0].name,i=a.data.shoppingList[0].link;document.querySelectorAll("[data-list_skeleton]").forEach((s=>{const a=s.cloneNode(!0);a.hasAttribute("data-list_id")&&a.setAttribute("data-list_id",e),a.removeAttribute("data-list_skeleton"),a.querySelectorAll("[data-list_name]").forEach((e=>{e.textContent=t})),a.querySelectorAll("[data-list_href]").forEach((t=>{t.setAttribute("href",i)})),a.querySelectorAll("[data-list_position]").forEach((t=>{t.hasAttribute("id")&&t.setAttribute("id",`${t.getAttribute("id")}${s.parentNode.childElementCount}`),t.hasAttribute("for")&&t.setAttribute("for",`${t.getAttribute("for")}${s.parentNode.childElementCount}`)})),s.parentNode.appendChild(a),s.closest("[data-empty]")&&s.closest("[data-empty]").setAttribute("data-empty","false")})),s&&s(a)}else i&&i(a)},this.addProductToList=(t,e)=>{const s=document.querySelector(".sl_choose");if(this.callbackAfterAddProductToList=e,s){s.querySelectorAll(".--success").forEach((t=>{t.classList.remove("--success")}));1===s.querySelectorAll(".sl_choose__list").length&&(this.status(s.querySelector(".sl_choose__wrapper"),"loading"),this.queryCombo({fetchDataQuery:this.addListQuery(ShoppingListTxt.firstListName),afterSuccess:t=>{this.updateListCreate({idList:t.data.shoppingListCreate.id,afterSuccess:()=>{s.querySelector(".sl_choose__list:last-child input").checked=!0,this.status(s.querySelector(".sl_choose__wrapper"))}})}})),s.classList.add("--active"),Modal({element:s,classList:"--sl-choose --medium --mobile",afterClose:()=>{s.classList.remove("--active")}})}this.vars.selectedProducts=t},this.initEvents=()=>{document.addEventListener("click",(async function(t){if(t.target.closest(".sl_create__link")){t.preventDefault();const e=t.target.closest(".sl_create__link").parentNode;e.classList.toggle("--active"),e.querySelector("input").focus(),e.scrollIntoView()}if(t.target.closest(".sl_create__button")){t.preventDefault();const s=t.target.closest(".sl_create__button"),i=s.closest(".sl_create").querySelector(".sl_create__input"),a=s.closest(".sl_create");return i.checkValidity()?(e.status(a,"loading"),e.queryCombo({fetchDataQuery:e.addListQuery(i.value),afterSuccess:t=>{e.updateListCreate({idList:t.data.shoppingListCreate.id,afterSuccess:()=>{e.status(a,"success"),a.classList.remove("--active"),i.value="",a.scrollIntoView(),assignTabIndexes?.(),a?.parentElement?.querySelector(".sl_d_manage__list:last-child .sl_d_manage__list_sub")?.focus(),a?.parentElement?.querySelector(".sl_m_manage__list:last-child .sl_m_manage__list_sub")?.focus();const t=a?.parentElement?.querySelector(".sl_choose__list:last-child .sl_choose__input");t&&(t.checked=!0,t.focus())},afterError:()=>{e.status(a,"error")}})},afterError:()=>{e.status(a,"error")}}),!1):(i.reportValidity(),!1)}if(t.target.closest(".sl_choose__button")){t.preventDefault();const s=t.target.closest(".sl_choose__button").closest(".sl_choose__wrapper").querySelector(".sl_choose__input:checked"),i=s.closest("[data-list_id]").getAttribute("data-list_id"),a=s.closest(".sl_choose__list");e.status(a,"loading"),e.queryCombo({fetchDataQuery:e.addProductQuery(i,e.vars.selectedProducts),afterSuccess:async()=>{e.updateListCount({idList:i,afterSuccess:()=>{e.status(a,"success",!0)},afterError:()=>{e.status(a,"error")}}),"function"==typeof e.callbackAfterAddProductToList&&e.callbackAfterAddProductToList(),await app_shop.fn.fetchShoppingListAndStore(),app_shop.fn.markWishlistActive()},afterError:()=>{e.status(a,"error")}})}return!1}))},this.initEvents()},app_shop.fn.updateShoppingListBadge=function(t){const e=document.querySelector(".shopping_list_top .badge-info");e&&(e.textContent=t>0?t:"",e.classList.toggle("--hidden",0===t))},app_shop.fn.fetchShoppingListAndStore=async function(){try{const t=await fetch("/graphql/v1/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:"\n    query {\n      shoppingList {\n        products {\n          productId\n        }\n      }\n    }\n  "})});if(!t.ok)throw new Error(`GraphQL request failed: ${t.status} ${t.statusText}`);const{data:e,errors:s}=await t.json();if(s?.length)return null;const i=(e?.shoppingList??[]).flatMap((t=>t.products??[])).map((t=>t.productId));return sessionStorage.setItem("shoppingListProductIds",JSON.stringify(i)),app_shop.fn.updateShoppingListBadge(i.length),i}catch(t){return null}},app_shop.fn.markWishlistActive=function(){const t=sessionStorage.getItem("shoppingListProductIds");if(!t)return;let e=[];try{e=JSON.parse(t)}catch(t){return}Array.isArray(e)&&e.length&&(document.querySelectorAll(".product__wishlist.--active").forEach((t=>{t.classList.remove("--active")})),document.querySelector(".projector_page")&&(document.querySelectorAll(".projector_buy__shopping_list.--active").forEach((t=>{t.classList.remove("--active")})),e.forEach((t=>{document.querySelectorAll(`.projector_buy__shopping_list[data-id="${t}"]`).forEach((t=>{t.classList.add("--active")}))}))),e.forEach((t=>{document.querySelectorAll(`.product__wishlist[data-id="${t}"]`).forEach((t=>{t.classList.add("--active")}))})))},app_shop.run((async function(){await app_shop.fn.fetchShoppingListAndStore(),app_shop.fn.markWishlistActive()}),"all","#container",!0);

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.