PageSourceSearch

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

js tomsguide.com collected 2026-09-24 08:24:38 UTC 2,831 bytes, 102 lines download raw bytes

1/**
2 * GPP (Global Privacy Platform) API stub
3 * Provides __gpp until the real CMP loads. See IAB GPP.
4 */
5/* eslint-disable @typescript-eslint/no-unused-expressions */
6var PING_RESPONSE = {
7  gppVersion: "1.1",
8  cmpStatus: "stub",
9  cmpDisplayStatus: "hidden",
10  signalStatus: "not ready",
11  supportedAPIs: [
12    "2:tcfeuv2",
13    "5:tcfcav1",
14    "6:uspv1",
15    "7:usnat",
16    "8:usca",
17    "9:usva",
18    "10:usco",
19    "11:usut",
20    "12:usct",
21  ],
22  cmpId: 0,
23  sectionList: [],
24  applicableSections: [],
25  gppString: "",
26  parsedSections: {},
27};
28
29window.__gpp_addFrame = function (e) {
30  if (!window.frames[e])
31    if (document.body) {
32      var t = document.createElement("iframe");
33      t.style.cssText = "display:none";
34      t.name = e;
35      document.body.appendChild(t);
36    } else {
37      window.setTimeout(window.__gpp_addFrame, 10, e);
38    }
39};
40
41window.__gpp_stub = function () {
42  var e = arguments;
43  if ((__gpp.queue = __gpp.queue || []), (__gpp.events = __gpp.events || []))
44    ;
45  if (!e.length || (1 == e.length && "queue" == e[0])) return __gpp.queue;
46  if (1 == e.length && "events" == e[0]) return __gpp.events;
47
48  var t = e[0],
49    p = e.length > 1 ? e[1] : null,
50    s = e.length > 2 ? e[2] : null;
51
52  if ("ping" === t) {
53    p(PING_RESPONSE, !0);
54  } else if ("addEventListener" === t) {
55    "lastId" in __gpp || (__gpp.lastId = 0);
56    __gpp.lastId++;
57    var n = __gpp.lastId;
58    __gpp.events.push({ id: n, callback: p, parameter: s });
59    p({ eventName: "listenerRegistered", listenerId: n, data: !0, pingData: PING_RESPONSE }, !0);
60  } else if ("removeEventListener" === t) {
61    for (var a = !1, i = 0; i < __gpp.events.length; i++)
62      if (__gpp.events[i].id == s) {
63        __gpp.events.splice(i, 1);
64        a = !0;
65        break;
66      }
67    p({ eventName: "listenerRemoved", listenerId: s, data: a, pingData: PING_RESPONSE }, !0);
68  } else if ("hasSection" === t) {
69    p(!1, !0);
70  } else if ("getSection" === t || "getField" === t) {
71    p(null, !0);
72  } else {
73    __gpp.queue.push([].slice.apply(e));
74  }
75};
76
77window.__gpp_msghandler = function (e) {
78  var t = "string" == typeof e.data;
79  try {
80    var p = t ? JSON.parse(e.data) : e.data;
81  } catch {
82    p = null;
83  }
84  if ("object" == typeof p && null !== p && "__gppCall" in p) {
85    var s = p.__gppCall;
86    window.__gpp(
87      s.command,
88      function (p, n) {
89        var a = { __gppReturn: { returnValue: p, success: n, callId: s.callId } };
90        e.source.postMessage(t ? JSON.stringify(a) : a, "*");
91      },
92      "parameter" in s ? s.parameter : null,
93      "version" in s ? s.version : "1.1"
94    );
95  }
96};
97
98if (!("__gpp" in window && "function" == typeof window.__gpp)) {
99  window.__gpp = window.__gpp_stub;
100  window.addEventListener("message", window.__gpp_msghandler, !1);
101  window.__gpp_addFrame("__gppLocator");
102}

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.