PageSourceSearch

https://foretagande.se/js/inmobi_choice.js

js foretagande.se collected 2026-09-26 08:57:03 UTC 4,987 bytes, 160 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/', '9vGSFXQMP4VN1', '/', 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
87            var payload = json.__tcfapiCall;
88
89            if (payload) {
90                window.__tcfapi(
91                    payload.command,
92                    payload.version,
93                    function (retValue, success) {
94                        var returnMsg = {
95                            __tcfapiReturn: {
96                                returnValue: retValue,
97                                success: success,
98                                callId: payload.callId
99                            }
100                        };
101                        if (msgIsString) {
102                            returnMsg = JSON.stringify(returnMsg);
103                        }
104                        if (event && event.source && event.source.postMessage) {
105                            event.source.postMessage(returnMsg, '*');
106                        }
107                    },
108                    payload.parameter
109                );
110            }
111        }
112
113        while (win) {
114            try {
115                if (win.frames[TCF_LOCATOR_NAME]) {
116                    cmpFrame = win;
117                    break;
118                }
119            } catch (ignore) {
120            }
121
122            if (win === window.top) {
123                break;
124            }
125            win = win.parent;
126        }
127        if (!cmpFrame) {
128            addFrame();
129            win.__tcfapi = tcfAPIHandler;
130            win.addEventListener('message', postMessageEventHandler, false);
131        }
132    };
133
134    makeStub();
135
136    var uspStubFunction = function () {
137        var arg = arguments;
138        if (typeof window.__uspapi !== uspStubFunction) {
139            setTimeout(function () {
140                if (typeof window.__uspapi !== 'undefined') {
141                    window.__uspapi.apply(window.__uspapi, arg);
142                }
143            }, 500);
144        }
145    };
146
147    var checkIfUspIsReady = function () {
148        uspTries++;
149        if (window.__uspapi === uspStubFunction && uspTries < uspTriesLimit) {
150            console.warn('USP is not accessible');
151        } else {
152            clearInterval(uspInterval);
153        }
154    };
155
156    if (typeof window.__uspapi === 'undefined') {
157        window.__uspapi = uspStubFunction;
158        var uspInterval = setInterval(checkIfUspIsReady, 6000);
159    }
160})();

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.