PageSourceSearch

https://therealestatetrainer.com/wp-content/plugins/duracelltomi-g…/build/gtm4wp-woocommerce.js?ver=2.0.0

js therealestatetrainer.com collected 2026-09-26 00:26:14 UTC 12,964 bytes, 1 lines download raw bytes

1(()=>{let t;function e(t,e){const o=parseInt(t&&t[e],10);return Number.isNaN(o)?null:o}function o(){return"undefined"!=typeof gtm4wp_list_attribution&&!!gtm4wp_list_attribution}function r(){document.querySelectorAll(".product-quantity input.qty").forEach(function(t){const e=t.defaultValue;let o=parseInt(t.value);if(isNaN(o)&&(o=e),e!=o){const r=t.closest(".cart_item"),c=r&&r.querySelector(".remove");if(!c)return;const n=gtm4wp_read_json_from_node(c,"gtm4wp_product_data");if(!n)return!0;e<o?(n.quantity=o-e,gtm4wp_push_ecommerce("add_to_cart",[n],{currency:gtm4wp_currency,value:n.price*n.quantity})):(n.quantity=e-o,gtm4wp_push_ecommerce("remove_from_cart",[n],{currency:gtm4wp_currency,value:n.price*n.quantity}))}})}function c(){if(gtm4wp_checkout_step_fired.indexOf("payment_method")>-1)return;if("complete"!=document.readyState)return;let t="(payment type not found)",e=document.querySelector(".payment_methods input:checked");e||(e=document.querySelector("input[name^=payment_method]")),e&&(t=e.value),gtm4wp_push_ecommerce("add_payment_info",window.gtm4wp_checkout_products,{currency:gtm4wp_currency,payment_type:t,value:window.gtm4wp_checkout_value}),gtm4wp_checkout_step_fired.push("payment_method")}function n(){if(gtm4wp_checkout_step_fired.indexOf("shipping_method")>-1)return;if("complete"!=document.readyState)return;let t="(shipping tier not found)",e=document.querySelector("input[name^=shipping_method]:checked");e||(e=document.querySelector("input[name^=shipping_method]")),e&&(t=e.value),gtm4wp_push_ecommerce("add_shipping_info",window.gtm4wp_checkout_products,{currency:gtm4wp_currency,shipping_tier:t,value:window.gtm4wp_checkout_value}),gtm4wp_checkout_step_fired.push("shipping_method")}function i(r,c){if(!r||!r.closest)return!1;const n=r.closest(".single_add_to_cart_button")||r;if(n.classList&&(n.classList.contains("disabled")||n.disabled))return!1;const i=c||r.closest("form.cart");if(!i)return!1;if("function"==typeof i.checkValidity&&!i.checkValidity())return!1;const d=i.querySelectorAll("[name=variation_id]"),_=i.classList&&i.classList.contains("grouped_form");if(d.length>0){if(t){const o=e(i.querySelector("[name=quantity]"),"value");t.quantity=null===o||o<1?1:o,gtm4wp_push_ecommerce("add_to_cart",[t],{currency:gtm4wp_currency,value:(t.price*t.quantity).toFixed(2)})}}else if(_){const t=document.querySelectorAll(".grouped_form .gtm4wp_productdata"),r=[];let c=0;if(t.forEach(function(t){const n=gtm4wp_read_json_from_node(t,"gtm4wp_product_data",["productlink"]);if(!n)return!0;let i=0;const d=document.querySelectorAll("input[name=quantity\\["+n.internal_id+"\\]]");return!(d.length>0)||(i=e(d[0],"value"),0===i||(n.quantity=null===i||i<1?1:i,o()&&gtm4wp_apply_stored_item_list(n,n.internal_id),delete n.internal_id,r.push(n),void(c+=n.price*n.quantity)))}),0==r.length)return!1;gtm4wp_push_ecommerce("add_to_cart",r,{currency:gtm4wp_currency,value:c.toFixed(2)})}else{const t=i.querySelector(".gtm4wp_single_productdata,[name=gtm4wp_product_data]");if(!t)return!1;const r=gtm4wp_read_from_json(t.dataset&&t.dataset.gtm4wp_product_data||t.value,["productlink"]);if(!r)return!1;const c=e(i.querySelector("[name=quantity]"),"value");r.quantity=null===c||c<1?1:c,o()&&gtm4wp_apply_stored_item_list(r,r.internal_id),delete r.internal_id,gtm4wp_push_ecommerce("add_to_cart",[r],{currency:gtm4wp_currency,value:r.price*r.quantity})}return!0}function d(t){if(!t||!t.closest)return!1;const e=t.closest(".product,.wc-block-grid__product,.wc-block-product"),o=e&&e.querySelector(".gtm4wp_productdata");let r;if(o)r=gtm4wp_read_json_from_node(o,"gtm4wp_product_data");else{const e=t.closest(".add_to_cart_button");r=e&&gtm4wp_read_json_from_node(e,"gtm4wp_product_data")}return!!r&&"variable"!==r.product_type&&"grouped"!==r.product_type&&(r.productlink&&delete r.productlink,delete r.product_type,r.quantity=1,gtm4wp_push_ecommerce("add_to_cart",[r],{currency:gtm4wp_currency,value:r.price}),!0)}function _(){if(window.gtm4wp_woocommerce_inited)return;window.gtm4wp_woocommerce_inited=!0;const _={"wp-block-handpicked-products":{displayname:"Handpicked Products",listid:"handpicked-products",counter:1},"wp-block-product-best-sellers":{displayname:"Best Selling Products",listid:"best-selling-products",counter:1},"wp-block-product-category":{displayname:"Product Category List",listid:"product-category-list",counter:1},"wp-block-product-new":{displayname:"New Products",listid:"new-products",counter:1},"wp-block-product-on-sale":{displayname:"Sale Products",listid:"sale-products",counter:1},"wp-block-products-by-attribute":{displayname:"Products By Attribute",listid:"products-by-attribute",counter:1},"wp-block-product-tag":{displayname:"Products By Tag",listid:"products-by-tag",counter:1},"wp-block-product-top-rated":{displayname:"Top Rated Products",listid:"top-rated-products",counter:1}};if(document.querySelectorAll(".wc-block-grid .wc-block-grid__product").forEach(function(t){const e=t.closest(".wc-block-grid"),o=t.querySelector(".gtm4wp_productdata");if(e&&o){const t=e.classList;if(t)for(const e in _)t.contains(e)&&(gtm4wp_update_json_in_node(o,"gtm4wp_product_data","item_list_name",_[e].displayname),gtm4wp_update_json_in_node(o,"gtm4wp_product_data","item_list_id",_[e].listid),gtm4wp_update_json_in_node(o,"gtm4wp_product_data","index",_[e].counter),_[e].counter++)}}),document.querySelectorAll(".gtm4wp_productdata,.widget-product-item").length>0){const t=[];if(document.querySelectorAll(".gtm4wp_productdata,.widget-product-item").forEach(function(e){const o=gtm4wp_read_json_from_node(e,"gtm4wp_product_data");if(!o)return!0;t.push(o)}),gtm4wp_product_per_impression>0){let e;for(;t.length;)e=t.splice(0,gtm4wp_product_per_impression),gtm4wp_push_ecommerce("view_item_list",e,{currency:gtm4wp_currency})}else gtm4wp_push_ecommerce("view_item_list",t,{currency:gtm4wp_currency})}document.addEventListener("click",function(t){const r=t.target;if(!r)return!0;r.closest(".add_to_cart_button:not(.product_type_variable, .product_type_grouped, .product_type_bundle_input_required, .single_add_to_cart_button)")&&d(r);const c=r.closest(".single_add_to_cart_button");if(c&&i(c),r.closest(".mini_cart_item a.remove,.product-remove a.remove")){const t=r&&r.closest(".mini_cart_item a.remove,.product-remove a.remove");
1if(!t)return!0;const o=gtm4wp_read_json_from_node(t,"gtm4wp_product_data");if(!o)return!0;let c=null;const n=t.closest(".cart_item");let i=n&&n.querySelectorAll(".product-quantity input.qty");if(i&&0!==i.length)c=e(i[0],"value");else{const o=t.closest(".mini_cart_item");i=o&&o.querySelectorAll(".quantity"),i&&i.length>0&&(c=e(i[0],"textContent"))}if(null===c||c<1)return!0;o.quantity=c,gtm4wp_push_ecommerce("remove_from_cart",[o],{currency:gtm4wp_currency,value:o.price*o.quantity})}const n=r.closest(".products li:not(.product-category) a:not(.add_to_cart_button):not(.quick-view-button),.wc-block-grid__products li:not(.product-category) a:not(.add_to_cart_button):not(.quick-view-button),.wc-block-product-template li.wc-block-product a:not(.add_to_cart_button):not(.quick-view-button),.products>div:not(.product-category) a:not(.add_to_cart_button):not(.quick-view-button),.widget-product-item,.woocommerce-grouped-product-list-item__label a");if(n){if("undefined"==typeof google_tag_manager)return!0;const e=t.target;let r,c=e.closest(".product,.wc-block-grid__product,.wc-block-product");c?r=c.querySelector(".gtm4wp_productdata"):(c=e.closest(".products li"),c?r=c.querySelector(".gtm4wp_productdata"):(c=e.closest(".products>div"),c?r=c.querySelector(".gtm4wp_productdata"):(c=e.closest(".woocommerce-grouped-product-list-item__label"),r=c?c.querySelector(".gtm4wp_productdata"):e)));const i=gtm4wp_read_json_from_node(r,"gtm4wp_product_data",["internal_id"]);if(!i)return!0;if(i.productlink!=n.getAttribute("href"))return!0;if(o()&&i.item_list_name){const t=gtm4wp_read_json_from_node(r,"gtm4wp_product_data",[]);t&&t.internal_id&&gtm4wp_store_item_list_attribution(t.internal_id,i.item_list_name,i.item_list_id)}for(const t in window.google_tag_manager)if("gtm-"==t.substring(0,4).toLowerCase()){window.gtm4wp_first_container_id=t;break}if(""===window.gtm4wp_first_container_id)return!0;let d=2e3;if("undefined"!=typeof gtm4wp_datalayer_max_timeout&&(d=gtm4wp_datalayer_max_timeout),d>0){const e=t.ctrlKey||t.metaKey,o="_blank"===n.target,r=t.defaultPrevented;r||t.preventDefault(),(e||o)&&(window.productpage_window=window.open("about:blank","_blank"));const c=i.productlink;delete i.productlink,gtm4wp_push_ecommerce("select_item",[i],{currency:gtm4wp_currency},function(t){if(void 0!==t&&window.gtm4wp_first_container_id!=t)return!0;r||((o||e)&&productpage_window?productpage_window.location.href=c:document.location.href=c)},d)}else delete i.productlink,gtm4wp_push_ecommerce("select_item",[i],{currency:gtm4wp_currency})}},{capture:!0}),jQuery(document).on("found_variation",function(e,r){if(void 0===r)return;if("interactive"===document.readyState&&gtm4wp_view_item_fired_during_pageload)return;const c=e.target;if(!c)return!0;const n=c.querySelector(".gtm4wp_single_productdata,[name=gtm4wp_product_data]");if(!n)return!0;let i;try{i=JSON.parse(n.dataset&&n.dataset.gtm4wp_product_data||n.value)}catch(t){return console&&console.error&&console.error(t.message),!0}if(!i)return!0;i.price=gtm4wp_make_sure_is_float(i.price),i.item_group_id=i.id,i.id=gtm4wp_remarketing_prod_id_prefix?gtm4wp_remarketing_prod_id_prefix+r.variation_id:r.variation_id,i.item_id=r.variation_id,i.sku=r.sku,gtm4wp_use_sku_instead&&r.sku&&""!==r.sku&&(i.id=gtm4wp_remarketing_prod_id_prefix?gtm4wp_remarketing_prod_id_prefix+r.sku:r.sku,i.item_id=r.sku),i.price=gtm4wp_make_sure_is_float(r.display_price);const d=[];for(const t in r.attributes)d.push(r.attributes[t]);i.item_variant=d.join(","),t=i;const _=i.internal_id;delete i.internal_id,i.quantity=1,o()&&gtm4wp_apply_stored_item_list(i,_),gtm4wp_push_ecommerce("view_item",[i],{currency:gtm4wp_currency,value:i.price}),"interactive"===document.readyState&&(gtm4wp_view_item_fired_during_pageload=!0)}),jQuery(".variations select").trigger("change"),jQuery(document).ajaxSuccess(function(t,e,r){void 0!==r&&r.url.indexOf("wc-api=WC_Quick_View")>-1&&setTimeout(function(){const t=document.querySelector("#gtm4wp_quickview_data");if(t&&t.dataset&&t.dataset.gtm4wp_datalayer)try{const e=JSON.parse(t.dataset.gtm4wp_datalayer);o()&&e&&e.ecommerce&&e.ecommerce.item&&gtm4wp_apply_stored_item_list(e.ecommerce.item,e.ecommerce.item.internal_id),e&&window[gtm4wp_datalayer_name]&&window[gtm4wp_datalayer_name].push(e)}catch(t){console&&console.error&&console.error(t.message)}},500)});let u=!1,a=!1;const p=document.querySelector("body");p&&(u=p.classList&&p.classList.contains("woocommerce-cart"),a=p.classList&&p.classList.contains("woocommerce-checkout")),u&&(document.addEventListener("click",function(t){const e=t.target;return!e||!e.closest("[name=update_cart]")||void r()}),document.addEventListener("keypress",function(t){const e=t.target;return!e||!e.closest(".woocommerce-cart-form input[type=number]")||void r()})),a&&(window.gtm4wp_checkout_value=window.gtm4wp_checkout_value||0,window.gtm4wp_checkout_products=window.gtm4wp_checkout_products||[],window.gtm4wp_checkout_products_ga4=window.gtm4wp_checkout_products_ga4||[],document.addEventListener("change",function(t){const e=t.target;return!e||!e.closest("input[name^=shipping_method]")||void n()}),document.addEventListener("change",function(t){const e=t.target;return!e||!e.closest("input[name=payment_method]")||void c()}),jQuery("form.checkout").on("checkout_place_order",function(){-1==gtm4wp_checkout_step_fired.indexOf("shipping_method")&&n(),-1==gtm4wp_checkout_step_fired.indexOf("payment_method")&&c()})),"undefined"!=typeof gtm4wp_checkoutwc&&gtm4wp_checkoutwc&&(window.gtm4wp_checkout_value=window.gtm4wp_checkout_value||0,window.gtm4wp_checkout_products=window.gtm4wp_checkout_products||[],window.gtm4wp_checkout_products_ga4=window.gtm4wp_checkout_products_ga4||[],document.addEventListener("cfw_step_changed",function(t){const e=function(t){let e="";return t&&t.detail&&(e="string"==typeof t.detail?t.detail:t.detail.step||t.detail.current||t.detail.to||t.detail.name||""),(""+e).toLowerCase()}(t);e.indexOf("payment")>-1||e.indexOf("review")>-1?(n(),c()):e.indexOf("shipping")>-1&&n()}),jQuery(document.body).on("cfw_before_submit checkout_place_order",function(){n(),c()}))}function u(){document.removeEventListener("DOMContentLoaded",u),window.removeEventListener("load",u),_(
1)}void 0===window.gtm4wp_view_item_fired_during_pageload&&(window.gtm4wp_view_item_fired_during_pageload=!1),void 0===window.gtm4wp_checkout_step_fired&&(window.gtm4wp_checkout_step_fired=[]),void 0===window.gtm4wp_first_container_id&&(window.gtm4wp_first_container_id=""),window.gtm4wp_track_single_add_to_cart=i,window.gtm4wp_track_list_add_to_cart=d,"loading"!==document.readyState?window.setTimeout(_):(document.addEventListener("DOMContentLoaded",u),window.addEventListener("load",u))})();

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.