(function(a,b){"function"==typeof define&&define.amd?define("frontAPI",[],b):"object"==typeof module&&module.exports?module.exports=b():a.frontAPI?a["frontAPI"+b().getVersion().replace(/\./g,"")]=b():a.frontAPI=b()})(window,function(){function a(){return window.Shop&&Shop.values?Shop.values.currency||"PLN":"PLN"}function b(){return window.Shop&&Shop.lang?Shop.lang.name||"pl_PL":"pl_PL"}function c(a,b){return a.replace(/\{(.+?)\}/g,function(a,c){return c in b?b[c]:a})}function d(d,e){var f;return f=c(d,{id:e.id||"",lang:e.lang||b(),currency:e.currency||a(),search:e.search||""}),e.urlParams&&(f+=e.urlParams),f}function e(a,b,c,d){return"function"!=typeof c&&(c=!1),d=d||{},d.data&&(d.data=JSON.stringify(d.data)),!0===d.noCache&&(b+="?noCache"+Date.now()),!1===c?(syncReq=g.send(b,d.data||"",function(){},a,!1,d.headers),syncReq.responseText?JSON.parse(syncReq.responseText):200===syncReq.status):void i.push({url:b,data:d.data||"",callback:c,method:a,headers:d.headers})}var f,g,h,i;i={requestInProgress:!1,maxRequests:3,requests:0,queue:[],push:function(a){this.queue.push(a),this.requestsb?1:a { if (product.querySelector('.sm-gapL-div')) { return; } var emElement = (product.querySelector('div.price.f-row')) ? product.querySelector('div.price.f-row').querySelector('p') : null; if (emElement) { var sm_prd_id = product.getAttribute('data-product-id'); if (prdAttrName[sm_prd_id]) { var attrList = ''; prdAttrName[sm_prd_id].forEach((sm_a) => { if (attrName[sm_a]) { attrList += smSetImg( attrName[sm_a]['img'], attrName[sm_a]['url'], attrName[sm_a]['info'] ); } }); if (attrList) { var newDiv = document.createElement('div'); newDiv.classList.add('sm-gapL-div'); newDiv.innerHTML = attrList; emElement.insertAdjacentElement('beforeend', newDiv); } } } }); } function observeProductList() { var productListContainer = document.querySelector('.products'); if (!productListContainer) return; var observer = new MutationObserver(mutations => { mutations.forEach(mutation => { mutation.addedNodes.forEach(node => { if (node.nodeType === 1 && node.matches('[data-product-id]')) { addGAPToProducts([node]); } }); }); }); observer.observe(productListContainer, { childList: true, subtree: false }); } function smSetImg(img, url, info) { var sHtml = ''; sHtml += '
'; if (info != '') sHtml += '
'; sHtml += ''; if (info != '') sHtml += '
'+info+'
'; sHtml += '
'; return sHtml; } showGAP(); observeProductList();