1(function() { 2 if(/googlebot|ms search/i.test(navigator.userAgent)) 3 return; 4 5 //Enable TCF support for Google products 6 //window['gtag_enable_tcf_support'] = true; 7 8 //Deny analytics 9 // if (window.dataLayer) { 10 // const gtag = function () { 11 // window.dataLayer.push(arguments); 12 // }; 13 // gtag("consent", "default", { 14 // analytics_storage: "denied", 15 // }); 16 // } 17 18 var host = 'www.moche.pt'; 19 var element = document.createElement('script'); 20 var firstScript = document.getElementsByTagName('script')[0]; 21 var url = 'https://cmp.inmobi.com' 22 .concat('/choice/', 'QzvRgBkT302RF', '/', host, '/choice.js?tag_version=V3'); 23 var uspTries = 0; 24 var uspTriesLimit = 3; 25 element.async = true; 26 element.type = 'text/javascript'; 27 element.src = url; 28 29 firstScript.parentNode.insertBefore(element, firstScript); 30 31 function makeStub() { 32 var TCF_LOCATOR_NAME = '__tcfapiLocator'; 33 var queue = []; 34 var win = window; 35 var cmpFrame; 36 37 function addFrame() { 38 var doc = win.document; 39 var otherCMP = !!(win.frames[TCF_LOCATOR_NAME]); 40 41 if (!otherCMP) { 42 if (doc.body) { 43 var iframe = doc.createElement('iframe'); 44 45 iframe.style.cssText = 'display:none'; 46 iframe.name = TCF_LOCATOR_NAME; 47 doc.body.appendChild(iframe); 48 } else { 49 setTimeout(addFrame, 5); 50 } 51 } 52 return !otherCMP; 53 } 54 55 function tcfAPIHandler() { 56 var gdprApplies; 57 var args = arguments; 58 59 if (!args.length) { 60 return queue; 61 } else if (args[0] === 'setGdprApplies') { 62 if ( 63 args.length > 3 && 64 args[2] === 2 && 65 typeof args[3] === 'boolean' 66 ) { 67 gdprApplies = args[3]; 68 if (typeof args[2] === 'function') { 69 args[2]('set', true); 70 } 71 } 72 } else if (args[0] === 'ping') { 73 var retr = { 74 gdprApplies: gdprApplies, 75 cmpLoaded: false, 76 cmpStatus: 'stub' 77 }; 78 79 if (typeof args[2] === 'function') { 80 args[2](retr); 81 } 82 } else { 83 if(args[0] === 'init' && typeof args[3] === 'object') { 84 args[3] = Object.assign(args[3], { tag_version: 'V3' }); 85 } 86 queue.push(args); 87 } 88 } 89 90 function postMessageEventHandler(event) { 91 var msgIsString = typeof event.data === 'string'; 92 var json = {}; 93 94 try { 95 if (msgIsString) { 96 json = JSON.parse(event.data); 97 } else { 98 json = event.data; 99 } 100 } catch (ignore) {} 101 102 var payload = json.__tcfapiCall; 103 104 if (payload) { 105 window.__tcfapi( 106 payload.command, 107 payload.version, 108 function(retValue, success) { 109 var returnMsg = { 110 __tcfapiReturn: { 111 returnValue: retValue, 112 success: success, 113 callId: payload.callId 114 } 115 }; 116 if (msgIsString) { 117 returnMsg = JSON.stringify(returnMsg); 118 } 119 if (event && event.source && event.source.postMessage) { 120 event.source.postMessage(returnMsg, '*'); 121 } 122 }, 123 payload.parameter 124 ); 125 } 126 } 127 128 while (win) { 129 try { 130 if (win.frames[TCF_LOCATOR_NAME]) { 131 cmpFrame = win; 132 break; 133 } 134 } catch (ignore) {} 135 136 if (win === window.top) { 137 break; 138 } 139 win = win.parent; 140 } 141 if (!cmpFrame) { 142 addFrame(); 143 win.__tcfapi = tcfAPIHandler; 144 win.addEventListener('message', postMessageEventHandler, false); 145 } 146 }; 147 148 makeStub(); 149 150 function makeGppStub() { 151 const CMP_ID = 10; 152 const SUPPORTED_APIS = [ 153 '2:tcfeuv2', 154 '6:uspv1', 155 '7:usnatv1', 156 '8:usca', 157 '9:usvav1', 158 '10:uscov1', 159 '11:usutv1', 160 '12:usctv1' 161 ]; 162 163 window.__gpp_addFrame = function (n) { 164 if (!window.frames[n]) { 165 if (document.body) { 166 var i = document.createElement("iframe"); 167 i.style.cssText = "display:none"; 168 i.name = n; 169 document.body.appendChild(i); 170 } else { 171 window.setTimeout(window.__gpp_addFrame, 10, n); 172 } 173 } 174 }; 175 window.__gpp_stub = function () { 176 var b = arguments; 177 __gpp.queue = __gpp.queue || []; 178 __gpp.events = __gpp.events || []; 179 180 if (!b.length || (b.length == 1 && b[0] == "queue")) { 181 return __gpp.queue; 182 } 183 184 if (b.length == 1 && b[0] == "events") { 185 return __gpp.events; 186 } 187 188 var cmd = b[0]; 189 var clb = b.length > 1 ? b[1] : null; 190 var par = b.length > 2 ? b[2] : null; 191 if (cmd === "ping") { 192 clb( 193 { 194 gppVersion: "1.1", // must be âVersion.Subversionâ, current: â1.1â 195 cmpStatus: "stub", // possible values: stub, loading, loaded, error 196 cmpDisplayStatus: "hidden", // possible values: hidden, visible, disabled 197 signalStatus: "not ready", // possible values: not ready, ready 198 supportedAPIs: SUPPORTED_APIS, // list of supported APIs 199 cmpId: CMP_ID, // IAB assigned CMP ID, may be 0 during stub/loading 200 sectionList: [], 201 applicableSections: [-1], 202 gppString: "", 203 parsedSections: {}, 204 }, 205 true 206 ); 207 } else if (cmd === "addEventListener") { 208 if (!("lastId" in __gpp)) { 209 __gpp.lastId = 0; 210 } 211 __gpp.lastId++; 212 var lnr = __gpp.lastId; 213 __gpp.events.push({ 214 id: lnr, 215 callback: clb, 216 parameter: par, 217 }); 218 clb( 219 { 220 eventName: "listenerRegistered", 221 listenerId: lnr, // Registered ID of the listener 222 data: true, // positive signal 223 pingData: { 224 gppVersion: "1.1", // must be âVersion.Subversionâ, current: â1.1â 225 cmpStatus: "stub", // possible values: stub, loading, loaded, error 226 cmpDisplayStatus: "hidden", // possible values: hidden, visible, disabled 227 signalStatus: "not ready", // possible values: not ready, ready 228 supportedAPIs: SUPPORTED_APIS, // list of supported APIs 229 cmpId: CMP_ID, // list of supported APIs 230 sectionList: [], 231 applicableSections: [-1], 232 gppString: "", 233 parsedSections: {}, 234 }, 235 }, 236 true 237 ); 238 } else if (cmd === "removeEventListener") { 239 var success = false; 240 for (var i = 0; i < __gpp.events.length; i++) { 241 if (__gpp.events[i].id == par) { 242 __gpp.events.splice(i, 1); 243 success = true; 244 break; 245 } 246 } 247 clb( 248 { 249 eventName: "listenerRemoved", 250 listenerId: par, // Registered ID of the listener 251 data: success, // status info 252 pingData: { 253 gppVersion: "1.1", // must be âVersion.Subversionâ, current: â1.1â 254 cmpStatus: "stub", // possible values: stub, loading, loaded, error 255 cmpDisplayStatus: "hidden", // possible values: hidden, visible, disabled 256 signalStatus: "not ready", // possible values: not ready, ready 257 supportedAPIs: SUPPORTED_APIS, // list of supported APIs 258 cmpId: CMP_ID, // CMP ID 259 sectionList: [], 260 applicableSections: [-1], 261 gppString: "", 262 parsedSections: {}, 263 }, 264 }, 265 true 266 ); 267 } else if (cmd === "hasSection") { 268 clb(false, true); 269 } else if (cmd === "getSection" || cmd === "getField") { 270 clb(null, true); 271 } 272 //queue all other commands 273 else { 274 __gpp.queue.push([].slice.apply(b)); 275 } 276 }; 277 window.__gpp_msghandler = function (event) { 278 var msgIsString = typeof event.data === "string";
279 try { 280 var json = msgIsString ? JSON.parse(event.data) : event.data; 281 } catch (e) { 282 var json = null; 283 } 284 if (typeof json === "object" && json !== null && "__gppCall" in json) { 285 var i = json.__gppCall; 286 window.__gpp( 287 i.command, 288 function (retValue, success) { 289 var returnMsg = { 290 __gppReturn: { 291 returnValue: retValue, 292 success: success, 293 callId: i.callId, 294 }, 295 }; 296 event.source.postMessage(msgIsString ? JSON.stringify(returnMsg) : returnMsg, "*"); 297 }, 298 "parameter" in i ? i.parameter : null, 299 "version" in i ? i.version : "1.1" 300 ); 301 } 302 }; 303 if (!("__gpp" in window) || typeof window.__gpp !== "function") { 304 window.__gpp = window.__gpp_stub; 305 window.addEventListener("message", window.__gpp_msghandler, false); 306 window.__gpp_addFrame("__gppLocator"); 307 } 308 }; 309 310 makeGppStub(); 311 312 var uspStubFunction = function() { 313 var arg = arguments; 314 if (typeof window.__uspapi !== uspStubFunction) { 315 setTimeout(function() { 316 if (typeof window.__uspapi !== 'undefined') { 317 window.__uspapi.apply(window.__uspapi, arg); 318 } 319 }, 500); 320 } 321 }; 322 323 var checkIfUspIsReady = function() { 324 uspTries++; 325 if (window.__uspapi === uspStubFunction && uspTries < uspTriesLimit) { 326 console.warn('USP is not accessible'); 327 } else { 328 clearInterval(uspInterval); 329 } 330 }; 331 332 if (typeof window.__uspapi === 'undefined') { 333 window.__uspapi = uspStubFunction; 334 var uspInterval = setInterval(checkIfUspIsReady, 6000); 335 } 336})(); 337 338//Update gtag consent state 339__tcfapi("addEventListener", 2, function (tcData, success) { 340 if (tcData.eventStatus == "cmpuishown") { 341 let escapeKeyInterval; 342 escapeKeyInterval = setInterval(() => { 343 if (!!document.querySelector("#qc-cmp2-main")) { 344 document 345 .querySelector("#qc-cmp2-main") 346 .addEventListener( 347 "keydown", 348 function (event) { 349 if (event.key === "Escape") { 350 event.preventDefault(); 351 event.stopPropagation(); 352 } 353 }, 354 true 355 ); 356 clearInterval(escapeKeyInterval); 357 } 358 }, 100); 359 360 if(tcData.tcString == '') 361 window.consentGiven = "false"; 362 } 363 364 if ( 365 tcData.eventStatus == "useractioncomplete" || 366 tcData.eventStatus == "tcloaded" 367 ) { 368 if (window.dataLayer) { 369 const gtag = function () { 370 window.dataLayer.push(arguments); 371 }; 372 // let analytics_storage_value = "denied"; 373 374 // if (tcData.purpose && tcData.purpose.consents) { 375 // if (tcData.purpose.consents[8] === true) { 376 // analytics_storage_value = "granted"; 377 // } 378 // } 379 380 // gtag("consent", "update", { 381 // analytics_storage: analytics_storage_value, 382 // }); 383 384 if (tcData.eventStatus == "useractioncomplete"){ 385 if(window.consentGiven == "false"){ 386 //Fix pageview event on first consent 387 window.dataLayer.push({ event: "consentcreatecookie" }); 388 window.consentGiven = "true" 389 390 //novo AG 20241107 - flag de controlo para logica de push login 391 window.localStorage.consentGiven = true; 392 } 393 else{ 394 //Consent update 395 window.dataLayer.push({ event: "consentupdatecookie" }); 396 } 397 } 398 else if (tcData.eventStatus == "tcloaded"){ 399 //Consent update 400 window.dataLayer.push({ event: "consentupdatecookie" }); 401 } 402 } 403 } 404});
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.