1// InMobi Choice. Consent Manager Tag v3.0 (for TCF 2.2) 2/* eslint-disable prefer-rest-params */ 3/* eslint-disable func-names */ 4/* eslint-disable no-empty */ 5/* eslint-disable consistent-return */ 6 7;(function () { 8 const url = 'https://cmp.inmobi.com'.concat( 9 '/choice/', 10 'LgFdH1-NZSKZ_', 11 '/', 12 window.location.hostname, 13 '/choice.js?tag_version=V3', 14 ) 15 let uspTries = 0 16 const uspTriesLimit = 3 17 18 const isScriptAlreadyLoaded = document.querySelector(`script[src="${url}"]`) 19 20 if (!isScriptAlreadyLoaded) { 21 const element = document.createElement('script') 22 23 element.async = true 24 element.type = 'text/javascript' 25 element.src = url 26 27 const firstScript = document.getElementsByTagName('script')[0] 28 firstScript.parentNode.insertBefore(element, firstScript) 29 } 30 31 function makeStub() { 32 const TCF_LOCATOR_NAME = '__tcfapiLocator' 33 const queue = [] 34 let win = window 35 let cmpFrame 36 37 function addFrame() { 38 const doc = win.document 39 const otherCMP = !!win.frames[TCF_LOCATOR_NAME] 40 41 if (!otherCMP) { 42 if (doc.body) { 43 const isTcfLocatorIframeAppended = doc.body.querySelector( 44 `iframe[name=${TCF_LOCATOR_NAME}]`, 45 ) 46 47 if (!isTcfLocatorIframeAppended) { 48 const iframe = doc.createElement('iframe') 49 50 iframe.style.cssText = 'display:none' 51 iframe.name = TCF_LOCATOR_NAME 52 doc.body.appendChild(iframe) 53 } 54 } else { 55 setTimeout(addFrame, 5) 56 } 57 } 58 return !otherCMP 59 } 60 61 function tcfAPIHandler() { 62 let gdprApplies 63 const args = arguments 64 65 if (!args.length) { 66 return queue 67 } 68 if (args[0] === 'setGdprApplies') { 69 if (args.length > 3 && args[2] === 2 && typeof args[3] === 'boolean') { 70 // eslint-disable-next-line prefer-destructuring 71 gdprApplies = args[3] 72 if (typeof args[2] === 'function') { 73 args[2]('set', true) 74 } 75 } 76 } else if (args[0] === 'ping') { 77 const retr = { 78 gdprApplies, 79 cmpLoaded: false, 80 cmpStatus: 'stub', 81 } 82 83 if (typeof args[2] === 'function') { 84 args[2](retr) 85 } 86 } else { 87 if (args[0] === 'init' && typeof args[3] === 'object') { 88 args[3] = Object.assign(args[3], { tag_version: 'V3' }) 89 } 90 queue.push(args) 91 } 92 } 93 94 function postMessageEventHandler(event) { 95 const msgIsString = typeof event.data === 'string' 96 let json = {} 97 98 try { 99 if (msgIsString) { 100 json = JSON.parse(event.data) 101 } else { 102 json = event.data 103 } 104 } catch (ignore) {} 105 106 const payload = json.__tcfapiCall 107 108 if (payload) { 109 window.__tcfapi( 110 payload.command, 111 payload.version, 112 function (retValue, success) { 113 let returnMsg = { 114 __tcfapiReturn: { 115 returnValue: retValue, 116 success, 117 callId: payload.callId, 118 }, 119 } 120 if (msgIsString) { 121 returnMsg = JSON.stringify(returnMsg) 122 } 123 if (event && event.source && event.source.postMessage) { 124 event.source.postMessage(returnMsg, '*') 125 } 126 }, 127 payload.parameter, 128 ) 129 } 130 } 131 132 while (win) { 133 try { 134 if (win.frames[TCF_LOCATOR_NAME]) { 135 cmpFrame = win 136 break 137 } 138 } catch (ignore) {} 139 140 if (win === window.top) { 141 break 142 } 143 win = win.parent 144 } 145 if (!cmpFrame) { 146 addFrame() 147 win.__tcfapi = tcfAPIHandler 148 win.addEventListener('message', postMessageEventHandler, false) 149 } 150 } 151 152 makeStub() 153 154 const uspStubFunction = function () { 155 const arg = arguments 156 // eslint-disable-next-line valid-typeof 157 if (typeof window.__uspapi !== uspStubFunction) { 158 setTimeout(function () { 159 if (typeof window.__uspapi !== 'undefined') { 160 window.__uspapi.apply(window.__uspapi, arg) 161 } 162 }, 500) 163 } 164 } 165 166 const checkIfUspIsReady = function () { 167 // eslint-disable-next-line no-plusplus 168 uspTries++ 169 if (window.__uspapi === uspStubFunction && uspTries < uspTriesLimit) { 170 console.warn('USP is not accessible') 171 } else { 172 // eslint-disable-next-line @typescript-eslint/no-use-before-define, block-scoped-var 173 clearInterval(uspInterval) 174 } 175 } 176 177 if (typeof window.__uspapi === 'undefined') { 178 window.__uspapi = uspStubFunction 179 // eslint-disable-next-line vars-on-top, no-var 180 var uspInterval = setInterval(checkIfUspIsReady, 6000) 181 } 182})()
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.