PageSourceSearch

https://www.tynaarlo.nl/modules/custom/tynaarlo_custom/js/facebook.js?tlx3bu

js tynaarlo.nl collected 2026-10-02 08:22:25 UTC 2,564 bytes, 115 lines download raw bytes

1(function (window, document) {
2  var consentAppIds = ['facebook_pixel_meta', 'facebook'];
3  var pixelId = '892445065620757';
4  var hasLoaded = false;
5  var hasSubscribed = false;
6
7  function parseKlaroCookie() {
8    var cookieMatch = document.cookie.match(/(?:^|; )klaro=([^;]+)/);
9
10    if (!cookieMatch || !cookieMatch[1]) {
11      return null;
12    }
13
14    try {
15      return JSON.parse(decodeURIComponent(cookieMatch[1]));
16    }
17    catch (e) {
18      return null;
19    }
20  }
21
22  function hasCookieConsent(appId) {
23    var klaroCookie = parseKlaroCookie();
24
25    if (!klaroCookie || !klaroCookie.consents) {
26      return false;
27    }
28
29    return klaroCookie.consents[appId] === true;
30  }
31
32  function loadPixel() {
33    if (hasLoaded) {
34      return;
35    }
36    hasLoaded = true;
37
38    if (!window.fbq) {
39      var fbq = function () {
40        fbq.callMethod ? fbq.callMethod.apply(fbq, arguments) : fbq.queue.push(arguments);
41      };
42      fbq.queue = [];
43      fbq.loaded = true;
44      fbq.version = '2.0';
45      fbq.push = fbq;
46      window.fbq = fbq;
47      window._fbq = fbq;
48
49      var fbScript = document.createElement('script');
50      fbScript.async = true;
51      fbScript.src = 'https://connect.facebook.net/en_US/fbevents.js';
52      var firstScript = document.getElementsByTagName('script')[0];
53      firstScript.parentNode.insertBefore(fbScript, firstScript);
54    }
55
56    window.fbq('init', pixelId);
57    window.fbq('track', 'PageView');
58  }
59
60  function getManager() {
61    if (!window.klaro || typeof window.klaro.getManager !== 'function') {
62      return null;
63    }
64    try {
65      return window.klaro.getManager();
66    }
67    catch (e) {
68      return null;
69    }
70  }
71
72  function hasConsent() {
73    return consentAppIds.some(function (appId) {
74      return hasCookieConsent(appId);
75    });
76  }
77
78  function subscribe(manager) {
79    if (hasSubscribed || !manager || typeof manager.watch !== 'function') {
80      return;
81    }
82    hasSubscribed = true;
83    manager.watch({
84      update: function (mgr, event) {
85        if (hasConsent()) {
86          loadPixel();
87        }
88      },
89    });
90  }
91
92  function tryInit() {
93    var manager = getManager();
94    if (!manager) {
95      return false;
96    }
97    if (hasConsent()) {
98      loadPixel();
99    }
100    subscribe(manager);
101    return true;
102  }
103
104  if (!tryInit()) {
105    var interval = setInterval(function () {
106      if (tryInit()) {
107        clearInterval(interval);
108      }
109    }, 500);
110  }
111
112  if (document.readyState === 'loading') {
113    document.addEventListener('DOMContentLoaded', tryInit);
114  }
115})(window, document);

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.