PageSourceSearch

https://www.thehomebrewbarn.com/a/j/push-cart.js

js thehomebrewbarn.com collected 2026-10-08 07:12:23 UTC 2,001 bytes, 33 lines download raw bytes

1function callFunctionIfDefined(callback) {
2    if (typeof callback === "function") {
3        callback();
4    }
5}
6
7function addPushCartPriceObserver() {
8    const checkIfPushCartIsConstructed = window.setInterval(() => {
9        const element = document.querySelector(".push-cart__footer--price");
10        if (element) {
11            const observer = new MutationObserver(
12                (mutationList, observer) => {
13                    for (const mutation of mutationList) {
14                        //when the page initially loads, the removed nodes is empty, because the element has no data
15                        //after this, the removed nodes will have the old value in it, and this change will only happen when the push cart opens
16                        //we can filter this initial change as the push cart will not be open on page load, and the action of opening the push cart will trigger the desired elements to load for the first time
17                        //we only want to trigger changes to the elements once the elements are loaded
18                        //alternatively, we could check if the elements are loaded instead, but I'm not sure what that looks like yet
19                        if(mutation.removedNodes.length > 0) {
20                            if (typeof paypalPushCartManageMessagingElementOnceLoaded !== 'undefined') callFunctionIfDefined(paypalPushCartManageMessagingElementOnceLoaded);
21                            if (typeof addPaypalButtonsWhenPushCartOpen !== 'undefined') callFunctionIfDefined(addPaypalButtonsWhenPushCartOpen);
22                            if (typeof stripePushCartLoadElementsWithDelay !== 'undefined') callFunctionIfDefined(stripePushCartLoadElementsWithDelay);
23                        }
24                    }
25                }
26            );
27
28            observer.observe(element, { childList: true});
29            clearInterval(checkIfPushCartIsConstructed);
30        }
31    }, 200);
32}
33addPushCartPriceObserver();

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.