PageSourceSearch

https://www.manukainer.at/wp-content/cache/min/1/wp-content/themes…/js/cart-state-tracking.js?ver=1791042444

js manukainer.at collected 2026-10-07 16:42:06 UTC 1,840 bytes, 10 lines download raw bytes

1(function(){var HASH_COOKIE="woocommerce_cart_hash";var LS_HASH="mw_cart_hash_prev";var LS_COUNT="mw_cart_count_prev";var POLL_MS=800;function getCookie(name){var match=document.cookie.match(new RegExp('(?:^|; )'+name.replace(/[-.$?*|{}()[\]\\/+^]/g,'\\$&')+'=([^;]*)'));return match?decodeURIComponent(match[1]):null}
2function toInt(v){var n=parseInt(v,10);return Number.isFinite(n)?n:0}
3async function fetchCart(){var res=await fetch("/wp-json/wc/store/v1/cart",{credentials:"include"});if(!res.ok)throw new Error("Cart API not available");return await res.json()}
4function getCartCount(cart){if(cart&&typeof cart.items_count!=="undefined")return toInt(cart.items_count);if(cart&&Array.isArray(cart.items)){return cart.items.reduce(function(sum,it){return sum+toInt(it.quantity||0)},0)}
5return 0}
6function pushEvent(name,payload){window.dataLayer=window.dataLayer||[];window.dataLayer.push(Object.assign({event:name,source:"divi_cart_state"},payload||{}))}
7async function checkCartChange(reason){var currentHash=getCookie(HASH_COOKIE)||"";var prevHash=localStorage.getItem(LS_HASH)||"";if(currentHash===prevHash)return;var prevCount=toInt(localStorage.getItem(LS_COUNT)||"0");try{var cart=await fetchCart();var newCount=getCartCount(cart);if(newCount>prevCount){pushEvent("add_to_cart",{items_delta:newCount-prevCount,cart_items:newCount,reason:reason||"hash_change"})}else if(newCount<prevCount){pushEvent("remove_from_cart",{items_delta:prevCount-newCount,cart_items:newCount,reason:reason||"hash_change"})}else{pushEvent("cart_updated",{cart_items:newCount,reason:reason||"hash_change"})}
8localStorage.setItem(LS_COUNT,String(newCount))}catch(e){pushEvent("cart_updated",{reason:"hash_change_no_api"})}
9localStorage.setItem(LS_HASH,currentHash)}
10checkCartChange("page_load");setInterval(function(){checkCartChange("poll")},POLL_MS)})()

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.