Файловый менеджер - Редактировать - /var/www/html/wp-content/cache/minify/72400.js
Назад
function gtmkitLoad(){const a=window.gtmkit_settings.datalayer_name;let n;const d={"wp-block-handpicked-products":1,"wp-block-product-best-sellers":1,"wp-block-product-category":1,"wp-block-product-new":1,"wp-block-product-on-sale":1,"wp-block-products-by-attribute":1,"wp-block-product-tag":1,"wp-block-product-top-rated":1};document.querySelectorAll(".wc-block-grid .wc-block-grid__product").forEach(function(t){var e=t.closest(".wc-block-grid"),i=t.querySelector(".gtmkit_product_data");if(e&&i){var r,c=e.classList;if(c)for(const o in d)c.contains(o)&&((r=JSON.parse(i.getAttribute("data-gtmkit_product_data"))).item_list_name=window.gtmkit_settings.wc.text[o],r.index=d[o],i.setAttribute("data-gtmkit_product_data",JSON.stringify(r)),d[o]++)}});var t=document.querySelectorAll(".gtmkit_product_data");if(t.length){const i=[];let e;t.forEach(function(t){e=JSON.parse(t.getAttribute("data-gtmkit_product_data")),i.push(e)}),window[a].push({ecommerce:null}),window[a].push({event:"view_item_list",ecommerce:{items:i}})}document.addEventListener("click",function(t){t=t.target;let e;if(!t)return!0;if(t.closest(".add_to_cart_button.ajax_add_to_cart:not(.single_add_to_cart_button)"))e="add_to_cart";else{if(!t.closest(".products")&&!t.closest(".wc-block-grid__products")||!t.closest(window.gtmkit_settings.wc.css_selectors.product_list_wishlist))return!0;e="add_to_wishlist"}t=t.closest(".product,.wc-block-grid__product"),t=t&&t.querySelector(".gtmkit_product_data");if(!t)return!0;t=JSON.parse(t.getAttribute("data-gtmkit_product_data"));t.quantity=1,window[a].push({ecommerce:null}),window[a].push({event:e,ecommerce:{currency:window.gtmkit_data.wc.currency,value:t.price,items:[t]}})}),document.addEventListener("click",function(r){r=r.target;if(!r)return!0;let c,i=r.closest("form.cart");if(!i){let t=r.parentNode;for(;!i&&t;)i=t.querySelector("form.cart"),t=t.parentNode}if(!i)return!0;if(r.closest(".single_add_to_cart_button:not(.disabled,.input-needed)"))c="add_to_cart";else{if(!r.closest(window.gtmkit_settings.wc.css_selectors.single_product_wishlist))return!0;c="add_to_wishlist"}var r=i.querySelectorAll("[name=variation_id]"),t=i.classList&&i.classList.contains("grouped_form")&&!i.classList.contains("bundle_form");if(r.length){let t=1,e;n&&(r=i.querySelector("[name=quantity]"),n.quantity=r&&r.value||1,t=n.quantity,e=n.price),(n&&"add_to_cart"===c||"add_to_wishlist"===c)&&(window[a].push({ecommerce:null}),window[a].push({event:c,ecommerce:{currency:window.gtmkit_data.wc.currency,value:e*t,items:[n]}}))}else if(t){r=document.querySelectorAll(".grouped_form .gtmkit_product_data");const o=[];let i=0;if(r.forEach(function(t){let e=document.querySelectorAll("input[name=quantity\\["+t.getAttribute("data-gtmkit_product_id")+"\\]]");if(e=Number(e[0].value),0===(e=isNaN(e)?0:e)&&"add_to_cart"===c)return!0;0===e&&"add_to_wishlist"===c&&(e=1);t=JSON.parse(t.getAttribute("data-gtmkit_product_data"));t.quantity=e,o.push(t),i+=t.price*t.quantity}),0===o.length)return!0;window[a].push({ecommerce:null}),window[a].push({event:c,ecommerce:{currency:window.gtmkit_data.wc.currency,value:i,items:o}})}else{t=JSON.parse(i.querySelector("[name=gtmkit_product_data]")&&i.querySelector("[name=gtmkit_product_data]").value);t.quantity=i.querySelector("[name=quantity]")&&i.querySelector("[name=quantity]").value,window[a].push({ecommerce:null}),window[a].push({event:c,ecommerce:{currency:window.gtmkit_data.wc.currency,value:t.price*t.quantity,items:[t]}})}}),document.addEventListener("click",function(t){var t=t.target;return!t||!t.closest(".mini_cart_item a.remove,.product-remove a.remove")||!(t=JSON.parse(t.getAttribute("data-gtmkit_product_data")))||(window[a].push({ecommerce:null}),void window[a].push({event:"remove_from_cart",ecommerce:{items:[t]}}))}),document.addEventListener("click",function(t){t=t.target;if(!t.closest(window.gtmkit_settings.wc.css_selectors.product_list_select_item))return!0;var t=t.closest(".product,.wc-block-grid__product");let e;return!t||!(e=t.querySelector(".gtmkit_product_data"))||void 0===e.getAttribute("data-gtmkit_product_data")||!(t=JSON.parse(e.getAttribute("data-gtmkit_product_data")))||(window[a].push({ecommerce:null}),void window[a].push({event:"select_item",ecommerce:{items:[t]}}))}),jQuery(document).on("found_variation",function(t,e){if(void 0!==e){t=t.target;if(t.querySelector("[name=gtmkit_product_data]")){var t=JSON.parse(t.querySelector("[name=gtmkit_product_data]")&&t.querySelector("[name=gtmkit_product_data]").value),i=(t.id=t.item_id=window.gtmkit_settings.wc.pid_prefix+e.variation_id,window.gtmkit_settings.wc.use_sku&&e.sku&&""!==e.sku&&(t.id=t.item_id=window.gtmkit_settings.wc.pid_prefix+e.sku),t.price=e.display_price,[]);for(const r in e.attributes)i.push(e.attributes[r]);t.item_variant=i.filter(t=>t).join("|"),n=t,0!==window.gtmkit_settings.wc.view_item.config&&(window[a].push({ecommerce:null}),window[a].push({event:"view_item",ecommerce:{currency:window.gtmkit_data.wc.currency,value:t.price,items:[t]}})),!0===window.gtmkit_settings.console_log&&(console.log("GTM Kit: selectedProductVariationData"),console.log(n))}}})}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",gtmkitLoad):gtmkitLoad();
| ver. 1.4 |
Github
|
.
| PHP 8.1.2-1ubuntu2.19 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка