PageSourceSearch

https://www.tomsguide.com/shop-assets/scripts/consent/tcf-stub.js

js tomsguide.com collected 2026-09-24 08:24:36 UTC 2,705 bytes, 95 lines download raw bytes

1/**
2 * TCF (Transparent Consent Framework) API stub
3 * Provides __tcfapi until the real CMP loads. See IAB Europe TCF.
4 */
5/* eslint-disable @typescript-eslint/no-unused-expressions */
6"use strict";
7
8function _typeof(t) {
9  return (_typeof =
10    "function" == typeof Symbol && "symbol" == typeof Symbol.iterator
11      ? function (t) {
12          return typeof t;
13        }
14      : function (t) {
15          return t &&
16            "function" == typeof Symbol &&
17            t.constructor === Symbol &&
18            t !== Symbol.prototype
19            ? "symbol"
20            : typeof t;
21        })(t);
22}
23
24!(function () {
25  var t = function () {
26    var t,
27      e,
28      o = [],
29      n = window,
30      r = n;
31    for (; r; ) {
32      try {
33        if (r.frames.__tcfapiLocator) {
34          t = r;
35          break;
36        }
37      } catch {}
38      if (r === n.top) break;
39      r = r.parent;
40    }
41    t ||
42      (!(function t() {
43        var e = n.document,
44          o = !!n.frames.__tcfapiLocator;
45        if (!o)
46          if (e.body) {
47            var r = e.createElement("iframe");
48            (r.style.cssText = "display:none"),
49              (r.name = "__tcfapiLocator"),
50              e.body.appendChild(r);
51          } else setTimeout(t, 5);
52        return !o;
53      })(),
54      (n.__tcfapi = function () {
55        for (var t = arguments.length, n = new Array(t), r = 0; r < t; r++)
56          n[r] = arguments[r];
57        if (!n.length) return o;
58        if ("setGdprApplies" === n[0])
59          return n.length > 3 &&
60            2 === parseInt(n[1], 10) &&
61            "boolean" == typeof n[3]
62            ? ((e = n[3]), "function" == typeof n[2] && n[2]("set", !0))
63            : o.push(n);
64        if ("ping" === n[0])
65          return "function" == typeof n[2] &&
66            n[2]({ gdprApplies: e, cmpLoaded: !1, cmpStatus: "stub" });
67        o.push(n);
68      }),
69      n.addEventListener(
70        "message",
71        (function (t) {
72          var e = "string" == typeof t.data,
73            o = {};
74          if (e) try {
75            o = JSON.parse(t.data);
76          } catch {}
77          else o = t.data;
78          var n =
79            "object" === _typeof(o) && null !== o ? o.__tcfapiCall : null;
80          n &&
81            window.__tcfapi(n.command, n.version, function (o, r) {
82              var a = {
83                __tcfapiReturn: { returnValue: o, success: r, callId: n.callId },
84              };
85              t &&
86                t.source &&
87                t.source.postMessage &&
88                t.source.postMessage(e ? JSON.stringify(a) : a, "*");
89            }, n.parameter);
90        }),
91        !1
92      ));
93  };
94  "undefined" != typeof module ? (module.exports = t) : t();
95})();

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.