PageSourceSearch

https://www.barnsley-mad.co.uk/modules/consent.js

js barnsley-mad.co.uk collected 2026-10-02 22:30:00 UTC 9,685 bytes, 320 lines download raw bytes

1(function() {
2  var host = window.location.hostname;
3  var element = document.createElement('script');
4  var firstScript = document.getElementsByTagName('script')[0];
5  var url = 'https://cmp.inmobi.com'
6    .concat('/choice/', 'w3r1PCdFU4LrX', '/', host, '/choice.js?tag_version=V3');
7  var uspTries = 0;
8  var uspTriesLimit = 3;
9  element.async = true;
10  element.type = 'text/javascript';
11  element.src = url;
12
13  firstScript.parentNode.insertBefore(element, firstScript);
14
15  function makeStub() {
16    var TCF_LOCATOR_NAME = '__tcfapiLocator';
17    var queue = [];
18    var win = window;
19    var cmpFrame;
20
21    function addFrame() {
22      var doc = win.document;
23      var otherCMP = !!(win.frames[TCF_LOCATOR_NAME]);
24
25      if (!otherCMP) {
26        if (doc.body) {
27          var iframe = doc.createElement('iframe');
28
29          iframe.style.cssText = 'display:none';
30          iframe.name = TCF_LOCATOR_NAME;
31          doc.body.appendChild(iframe);
32        } else {
33          setTimeout(addFrame, 5);
34        }
35      }
36      return !otherCMP;
37    }
38
39    function tcfAPIHandler() {
40      var gdprApplies;
41      var args = arguments;
42
43      if (!args.length) {
44        return queue;
45      } else if (args[0] === 'setGdprApplies') {
46        if (
47          args.length > 3 &&
48          args[2] === 2 &&
49          typeof args[3] === 'boolean'
50        ) {
51          gdprApplies = args[3];
52          if (typeof args[2] === 'function') {
53            args[2]('set', true);
54          }
55        }
56      } else if (args[0] === 'ping') {
57        var retr = {
58          gdprApplies: gdprApplies,
59          cmpLoaded: false,
60          cmpStatus: 'stub'
61        };
62
63        if (typeof args[2] === 'function') {
64          args[2](retr);
65        }
66      } else {
67        if(args[0] === 'init' && typeof args[3] === 'object') {
68          args[3] = Object.assign(args[3], { tag_version: 'V3' });
69        }
70        queue.push(args);
71      }
72    }
73
74    function postMessageEventHandler(event) {
75      var msgIsString = typeof event.data === 'string';
76      var json = {};
77
78      try {
79        if (msgIsString) {
80          json = JSON.parse(event.data);
81        } else {
82          json = event.data;
83        }
84      } catch (ignore) {}
85
86      var payload = json.__tcfapiCall;
87
88      if (payload) {
89        window.__tcfapi(
90          payload.command,
91          payload.version,
92          function(retValue, success) {
93            var returnMsg = {
94              __tcfapiReturn: {
95                returnValue: retValue,
96                success: success,
97                callId: payload.callId
98              }
99            };
100            if (msgIsString) {
101              returnMsg = JSON.stringify(returnMsg);
102            }
103            if (event && event.source && event.source.postMessage) {
104              event.source.postMessage(returnMsg, '*');
105            }
106          },
107          payload.parameter
108        );
109      }
110    }
111
112    while (win) {
113      try {
114        if (win.frames[TCF_LOCATOR_NAME]) {
115          cmpFrame = win;
116          break;
117        }
118      } catch (ignore) {}
119
120      if (win === window.top) {
121        break;
122      }
123      win = win.parent;
124    }
125    if (!cmpFrame) {
126      addFrame();
127      win.__tcfapi = tcfAPIHandler;
128      win.addEventListener('message', postMessageEventHandler, false);
129    }
130  };
131
132  makeStub();
133
134  function makeGppStub() {
135    const CMP_ID = 10;
136    const SUPPORTED_APIS = [
137      '2:tcfeuv2',
138      '6:uspv1',
139      '7:usnatv1',
140      '8:usca',
141      '9:usvav1',
142      '10:uscov1',
143      '11:usutv1',
144      '12:usctv1'
145    ];
146
147    window.__gpp_addFrame = function (n) {
148      if (!window.frames[n]) {
149        if (document.body) {
150          var i = document.createElement("iframe");
151          i.style.cssText = "display:none";
152          i.name = n;
153          document.body.appendChild(i);
154        } else {
155          window.setTimeout(window.__gpp_addFrame, 10, n);
156        }
157      }
158    };
159    window.__gpp_stub = function () {
160      var b = arguments;
161      __gpp.queue = __gpp.queue || [];
162      __gpp.events = __gpp.events || [];
163
164      if (!b.length || (b.length == 1 && b[0] == "queue")) {
165        return __gpp.queue;
166      }
167
168      if (b.length == 1 && b[0] == "events") {
169        return __gpp.events;
170      }
171
172      var cmd = b[0];
173      var clb = b.length > 1 ? b[1] : null;
174      var par = b.length > 2 ? b[2] : null;
175      if (cmd === "ping") {
176        clb(
177          {
178            gppVersion: "1.1", // must be “Version.Subversion”, current: “1.1”
179            cmpStatus: "stub", // possible values: stub, loading, loaded, error
180            cmpDisplayStatus: "hidden", // possible values: hidden, visible, disabled
181            signalStatus: "not ready", // possible values: not ready, ready
182            supportedAPIs: SUPPORTED_APIS, // list of supported APIs
183            cmpId: CMP_ID, // IAB assigned CMP ID, may be 0 during stub/loading
184            sectionList: [],
185            applicableSections: [-1],
186            gppString: "",
187            parsedSections: {},
188          },
189          true
190        );
191      } else if (cmd === "addEventListener") {
192        if (!("lastId" in __gpp)) {
193          __gpp.lastId = 0;
194        }
195        __gpp.lastId++;
196        var lnr = __gpp.lastId;
197        __gpp.events.push({
198          id: lnr,
199          callback: clb,
200          parameter: par,
201        });
202        clb(
203          {
204            eventName: "listenerRegistered",
205            listenerId: lnr, // Registered ID of the listener
206            data: true, // positive signal
207            pingData: {
208              gppVersion: "1.1", // must be “Version.Subversion”, current: “1.1”
209              cmpStatus: "stub", // possible values: stub, loading, loaded, error
210              cmpDisplayStatus: "hidden", // possible values: hidden, visible, disabled
211              signalStatus: "not ready", // possible values: not ready, ready
212              supportedAPIs: SUPPORTED_APIS, // list of supported APIs
213              cmpId: CMP_ID, // list of supported APIs
214              sectionList: [],
215              applicableSections: [-1],
216              gppString: "",
217              parsedSections: {},
218            },
219          },
220          true
221        );
222      } else if (cmd === "removeEventListener") {
223        var success = false;
224        for (var i = 0; i < __gpp.events.length; i++) {
225          if (__gpp.events[i].id == par) {
226            __gpp.events.splice(i, 1);
227            success = true;
228            break;
229          }
230        }
231        clb(
232          {
233            eventName: "listenerRemoved",
234            listenerId: par, // Registered ID of the listener
235            data: success, // status info
236            pingData: {
237              gppVersion: "1.1", // must be “Version.Subversion”, current: “1.1”
238              cmpStatus: "stub", // possible values: stub, loading, loaded, error
239              cmpDisplayStatus: "hidden", // possible values: hidden, visible, disabled
240              signalStatus: "not ready", // possible values: not ready, ready
241              supportedAPIs: SUPPORTED_APIS, // list of supported APIs
242              cmpId: CMP_ID, // CMP ID
243              sectionList: [],
244              applicableSections: [-1],
245              gppString: "",
246              parsedSections: {},
247            },
248          },
249          true
250        );
251      } else if (cmd === "hasSection") {
252        clb(false, true);
253      } else if (cmd === "getSection" || cmd === "getField") {
254        clb(null, true);
255      }
256      //queue all other commands
257      else {
258        __gpp.queue.push([].slice.apply(b));
259      }
260    };
261    window.__gpp_msghandler = function (event) {
262      var msgIsString = typeof event.data === "string";
263      try {
264        var json = msgIsString ? JSON.parse(event.data) : event.data;
265      } catch (e) {
266        var json = null;
267      }
268      if (typeof json === "object" && json !== null && "__gppCall" in json) {
269        var i = json.__gppCall;
270        window.__gpp(
271          i.command,
272          function (retValue, success) {
273            var returnMsg = {
274              __gppReturn: {
275                returnValue: retValue,
276                success: success,
277                callId: i.callId,
278              },
279            };
280            event.source.postMessage(msgIsString ? JSON.stringify(returnMsg) : returnMsg, "*");
281          },
282          "parameter" in i ? i.parameter : null,
283          "version" in i ? i.version : "1.1"
284        );
285      }
286    };
287    if (!("__gpp" in window) || typeof window.__gpp !== "function") {
288      window.__gpp = window.__gpp_stub;
289      window.addEventListener("message", window.__gpp_msghandler, false);
290      window.__gpp_addFrame("__gppLocator");
291    }
292  };
293
294  makeGppStub();
295
296  var uspStubFunction = function() {
297    var arg = arguments;
298    if (typeof window.__uspapi !== uspStubFunction) {
299      setTimeout(function() {
300        if (typeof window.__uspapi !== 'undefined') {
301          window.__uspapi.apply(window.__uspapi, arg);
302        }
303      }, 500);
304    }
305  };
306
307  var checkIfUspIsReady = function() {
308    uspTries++;
309    if (window.__uspapi === uspStubFunction && uspTries < uspTriesLimit) {
310      console.warn('USP is not accessible');
311    } else {
312      clearInterval(uspInterval);
313    }
314  };
315
316  if (typeof window.__uspapi === 'undefined') {
317    window.__uspapi = uspStubFunction;
318    var uspInterval = setInterval(checkIfUspIsReady, 6000);
319  }
320})();

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.