PageSourceSearch

http://oreillyhouse.org/js/shopify-2.js

js oreillyhouse.org collected 2026-10-07 00:00:49 UTC 2,485 bytes, 87 lines download raw bytes

1window.addEventListener("load", function () {
2  if (!window.Shopify || !window.Shopify.loadFeatures) return;
3
4  function initializeConsent() {
5    document.addEventListener("cookieyes_consent_update", updateShopifyConsent);
6    document.addEventListener("cookieyes_banner_load", updateShopifyConsent);
7    updateShopifyConsent();
8  }
9
10  window.Shopify.loadFeatures(
11    [
12      {
13        name: "consent-tracking-api",
14        version: "0.1",
15      },
16    ],
17    initializeConsent
18  );
19
20  function updateShopifyConsent(metaData) {
21    let applicableLaw = "";
22    let categories = {};
23    let consentDataAvailable = false;
24
25    if (typeof window.getCkyConsent === "function") {
26      const consentData = window.getCkyConsent();
27      if (consentData) {
28        applicableLaw = consentData.activeLaw;
29        categories = consentData.categories;
30        consentDataAvailable = true;
31      }
32    } else if (
33      metaData &&
34      metaData.detail &&
35      window.cookieyes &&
36      window.cookieyes._ckyStore &&
37      window.cookieyes._ckyStore._bannerConfig
38    ) {
39      applicableLaw = window.cookieyes._ckyStore._bannerConfig.activeLaw;
40      metaData.detail.accepted.forEach((category) => {
41        categories[category] = true;
42      });
43      metaData.detail.rejected.forEach((category) => {
44        categories[category] = false;
45      });
46      consentDataAvailable = true;
47    }
48
49    if (!consentDataAvailable) {
50      return;
51    }
52
53    if (applicableLaw === "gdpr") {
54      const isTrackingAccepted = categories["analytics"] ?? false;
55      const isMarketingAccepted = categories["advertisement"] ?? false;
56      const isFunctionalAccepted = categories["functional"] ?? false;
57
58      window.Shopify.customerPrivacy.setTrackingConsent(
59        {
60          analytics: isTrackingAccepted,
61          marketing: isMarketingAccepted,
62          preferences: isFunctionalAccepted,
63        },
64        _ckyNoop
65      );
66    } else if (applicableLaw === "ccpa") {
67      const isCCPAAccepted = Object.values(categories).every(
68        (value) => value === true
69      );
70      window.Shopify.customerPrivacy.setTrackingConsent(
71        { sale_of_data: isCCPAAccepted },
72        _ckyNoop
73      );
74    } else if (applicableLaw === "") {
75      window.Shopify.customerPrivacy.setTrackingConsent(
76        {
77          analytics: true,
78          marketing: true,
79          preferences: true,
80          sale_of_data: true,
81        },
82        _ckyNoop
83      );
84    }
85  }
86  function _ckyNoop() {}
87});

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.