1'use strict'; 2 3/*! ***************************************************************************** 4Copyright (c) Microsoft Corporation. 5 6Permission to use, copy, modify, and/or distribute this software for any 7purpose with or without fee is hereby granted. 8 9THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 10REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 12INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 14OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15PERFORMANCE OF THIS SOFTWARE. 16***************************************************************************** */ 17/* global Reflect, Promise */ 18 19 20var __assign = function() { 21 __assign = Object.assign || function __assign(t) { 22 for (var s, i = 1, n = arguments.length; i < n; i++) { 23 s = arguments[i]; 24 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 25 } 26 return t; 27 }; 28 return __assign.apply(this, arguments); 29}; 30 31function __awaiter(thisArg, _arguments, P, generator) { 32 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 33 return new (P || (P = Promise))(function (resolve, reject) { 34 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 35 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 36 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 37 step((generator = generator.apply(thisArg, [])).next()); 38 }); 39} 40 41function __generator(thisArg, body) { 42 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; 43 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 44 function verb(n) { return function (v) { return step([n, v]); }; } 45 function step(op) { 46 if (f) throw new TypeError("Generator is already executing."); 47 while (_) try { 48 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 49 if (y = 0, t) op = [op[0] & 2, t.value]; 50 switch (op[0]) { 51 case 0: case 1: t = op; break; 52 case 4: _.label++; return { value: op[1], done: false }; 53 case 5: _.label++; y = op[1]; op = [0]; continue; 54 case 7: op = _.ops.pop(); _.trys.pop(); continue; 55 default: 56 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 57 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 58 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 59 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 60 if (t[2]) _.ops.pop(); 61 _.trys.pop(); continue; 62 } 63 op = body.call(thisArg, _); 64 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 65 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 66 } 67} 68 69var IOLScriptLoaderModule = /** @class */ (function () { 70 function IOLScriptLoaderModule() { 71 this.promises = []; 72 } 73 IOLScriptLoaderModule.prototype.addScript = function (url) { 74 if (!this.isScriptLoaded(url)) { 75 var promise = new Promise(function (resolve, reject) { 76 var script = document.createElement("script"); 77 script.src = url; 78 script.addEventListener("load", function () { return resolve(script); }, false); 79 script.addEventListener("error", function () { return reject(script); }, false); 80 document.body.appendChild(script); 81 }); 82 this.promises.push(promise); 83 } 84 }; 85 IOLScriptLoaderModule.prototype.isScriptLoaded = function (url) { 86 return document.querySelector("script[src=\"" + url + "\"]") !== null; 87 }; 88 IOLScriptLoaderModule.prototype.addStyle = function (url) { 89 if (!this.isStyleLoaded(url)) { 90 var promise = new Promise(function (resolve, reject) { 91 var link = document.createElement("link"); 92 link.setAttribute("rel", "stylesheet"); 93 link.setAttribute("type", "text/css"); 94 link.setAttribute("href", url); 95 link.addEventListener("load", function () { return resolve(link); }, false); 96 link.addEventListener("error", function () { return reject(link); }, false); 97 document.body.appendChild(link); 98 }); 99 this.promises.push(promise); 100 } 101 }; 102 IOLScriptLoaderModule.prototype.isStyleLoaded = function (url) { 103 return document.querySelector("link[href=\"" + url + "\"]") !== null; 104 }; 105 IOLScriptLoaderModule.prototype.onLoaded = function (onLoaded, onError) { 106 Promise.all(this.promises).then(function () { return onLoaded(); }, function () { return onError(); }); 107 }; 108 return IOLScriptLoaderModule; 109}()); 110 111var IOLComercialSlotModel = /** @class */ (function () { 112 function IOLComercialSlotModel(name, sizes, viewport, formatName, targets, isRefreshable, extraCSS) { 113 this.name = name; 114 this.sizes = sizes; 115 this.viewports = viewport; 116 this.formatName = formatName; 117 this.key_values = targets; 118 this.isRefreshable = isRefreshable; 119 this.extraCSS = extraCSS; 120 } 121 return IOLComercialSlotModel; 122}()); 123 124//INTER [1, 1] 125//BILLBOARDXL [ "fluid", [2,1], [970,250], [989,250]] 126//BILLBOARD [[970,250], [989,250]] 127//LEADERBOARD [[728,90], [320,50]] 128//MPU [300,250] 129//MPUHALF [[300,250], [300,600]] 130//MPU2 [300,250] 131//INCONTENT [3, 3] 132//BRANDED ["fluid"] 133//POPIN [340, 100] 134//ANCHOR[320, 50] 135var IOLComercialFormatCreator = /** @class */ (function () { 136 function IOLComercialFormatCreator() { 137 } 138 IOLComercialFormatCreator.createSlotModel = function (slotID, formatName, position) { 139 return IOLComercialFormatCreator.FORMAT_CREATOR[formatName.toUpperCase()](slotID, position); 140 }; 141 IOLComercialFormatCreator.FORMAT_CREATOR = { 142 INTER: function (slotID) { 143 return new IOLComercialSlotModel(slotID, [[1, 1]], undefined, "INTER", { pos: "inter" }, false, ""); 144 }, 145 BILLBOARD_XL: function (slotID) { 146 return new IOLComercialSlotModel(slotID, [[970, 250], [980, 250], [320, 100], "fluid", [2, 1], [4, 4], [5, 5
146]], [ 147 { 148 viewport: [980, 600], 149 sizes: [[970, 250], [980, 250], "fluid", [2, 1], [4, 4], [5, 5]] 150 }, 151 { 152 viewport: [0, 0], 153 sizes: [[320, 100], "fluid", [2, 1], [4, 4], [5, 5]] 154 } 155 ], "BILLBOARDXL", { 156 pos: "billboardxl" 157 }, false, "iol-comercial-placement-label"); 158 }, 159 POPIN: function (slotID) { 160 return new IOLComercialSlotModel(slotID, [[340, 100]], undefined, "POPIN", { 161 pos: "popin" 162 }, true, ""); 163 }, 164 INCONTENT: function (slotID) { 165 return new IOLComercialSlotModel(slotID, [[3, 3]], undefined, "INCONTENT", { 166 pos: "incontent" 167 }, true, ""); 168 }, 169 MPU_HALF: function (slotID) { 170 return new IOLComercialSlotModel(slotID, [[300, 250], [300, 600]], undefined, "MPU_HALF", { 171 pos: "mpuhalf" 172 }, true, "iol-comercial-placement-label"); 173 }, 174 MPU: function (slotID) { 175 return new IOLComercialSlotModel(slotID, [[300, 250]], undefined, "MPU", { 176 pos: "mpu" 177 }, true, "iol-comercial-placement-label"); 178 }, 179 MPU2: function (slotID) { 180 return new IOLComercialSlotModel(slotID, [[300, 250]], undefined, "MPU2", { 181 pos: "mpu2" 182 }, true, "iol-comercial-placement-label"); 183 }, 184 MPUHALF_GAL: function (slotID) { 185 return new IOLComercialSlotModel(slotID, [[300, 250], [300, 600]], undefined, "MPUHALF_GAL", { 186 pos: "mpuhalf_gal" 187 }, true, "iol-comercial-placement-label"); 188 }, 189 MPUGAL: function (slotID) { 190 return new IOLComercialSlotModel(slotID, [[300, 250]], undefined, "MPUGAL", { 191 pos: "mpugal" 192 }, true, "iol-comercial-placement-label"); 193 }, 194 ANCHOR: function (slotID) { 195 return new IOLComercialSlotModel(slotID, [[320, 50]], undefined, "ANCHOR", { 196 pos: "anchor" 197 }, true, "iol-comercial-placement-label"); 198 }, 199 BRANDED: function (slotID) { 200 return new IOLComercialSlotModel(slotID, ["fluid"], undefined, "BRANDED_CONTENT", { pos: "branded" }, true, "iol-comercial-placement-label"); 201 }, 202 IOL_BRANDED: function (slotID) { 203 return new IOLComercialSlotModel(slotID, ["fluid"], undefined, "IOL_BRANDED_CONTENT", { 204 pos: "iol_branded" 205 }, true, "iol-comercial-placement-label"); 206 }, 207 LEADERBOARD: function (slotID) { 208 return new IOLComercialSlotModel(slotID, [ 209 [728, 90], 210 [320, 50], 211 [970, 250], 212 [980, 250] 213 ], [ 214 { 215 viewport: [728, 600], 216 sizes: [[728, 90]] 217 }, 218 { 219 viewport: [320, 400], 220 sizes: [[320, 50], [320, 100]] 221 }, 222 { 223 viewport: [970, 600], 224 sizes: [[970, 250], [728, 90]] 225 }, 226 { 227 viewport: [980, 600], 228 sizes: [[980, 250], [970, 250], [728, 90]] 229 } 230 ], "LDB", { 231 pos: "ldb" 232 }, true, "iol-comercial-placement-label"); 233 }, 234 LEADERBOARD2: function (slotID) { 235 return new IOLComercialSlotModel(slotID, [ 236 [728, 90], 237 [320, 50] 238 ], [ 239 { 240 viewport: [728, 600], 241 sizes: [[728, 90]] 242 }, 243 { 244 viewport: [320, 400], 245 sizes: [[320, 50]] 246 } 247 ], "LDB2", { 248 pos: "ldb2" 249 }, true, "iol-comercial-placement-label"); 250 }, 251 BILLBOARD_LEADERBOARD: function (slotID) { 252 return new IOLComercialSlotModel(slotID, [ 253 [970, 250], 254 [980, 250], 255 [728, 90], 256 [320, 50] 257 ], [ 258 { 259 viewport: [980, 600], 260 sizes: [ 261 [970, 250], 262 [980, 250], 263 [728, 90] 264 ] 265 }, 266 { 267 viewport: [728, 600], 268 sizes: [[728, 90]] 269 }, 270 { 271 viewport: [320, 400], 272 sizes: [[320, 50]] 273 } 274 ], "LDB", { 275 pos: "ldb" 276 }, true, "iol-comercial-placement-label"); 277 }, 278 "SPONSOR": function (slotID, position) { 279 return new IOLComercialSlotModel(slotID, ["fluid"], undefined, "SPONSOR" + (position ? position : '1'), { 280 pos: "sponsor" + (position ? position : '1') 281 }, true, "iol-comercial-placement-label"); 282 }, 283 AUDIO: function (slotID) { 284 return new IOLComercialSlotModel(slotID, [[1, 1]], undefined, "AUDIO", { pos: "audio" }, true, "iol-comercial-placement-label"); 285 }, 286 OUTSTREAM: function (slotID) { 287 return new IOLComercialSlotModel(slotID, [[640, 480]], undefined, "OUTSTREAM", { 288 pos: "outstream" 289 }, true, "iol-comercial-placement-label"); 290 }, 291 AUTOPROMO: function (slotID) { 292 return new IOLComercialSlotModel(slotID, [[6, 6]], undefined, "AUTOPROMO", { pos: "autopromo" }, false, ""); 293 }, 294 L_BAND: function (slotID) { 295 return new IOLComercialSlotModel(slotID, [[7, 7]], undefined, "L_BAND", { pos: "LBAND" }, false, ""); 296 } 297 }; 298 return IOLComercialFormatCreator; 299}()); 300 301var bidders = { 302 // appnexus: { 303 // bidder: "appnexus", 304 // params: { 305 // placementId: 26457981 306 // } 307 // }, 308 // sovrn: { 309 // bidder: "sovrn", 310 // params: { 311 // tagid: "12345" 312 // } 313 // }, 314 criteo: { 315 bidder: "criteo", 316 params: { 317 pubid: "110947", 318 networkId: "3705" 319 } 320 }, 321 ttd: { 322 bidder: "ttd", 323 params: { 324 publisherId: "1", 325 supplySourceId: "direct64qhs3p1" 326 } 327 }, 328 improvedigital: { 329 bidder: "improvedigital", 330 params: { 331 // MediaCapital_Web_RON_Display (banner only; Web_RON_Video is 23506262, Inapp_RON_Display is 23506264) 332 placementId: 23506263, 333 publisherId: 2673, 334 publisherName: "Media Capital" 335 } 336 }, 337 rubicon: { 338 bidder: "rubicon", 339 params: { 340 accountId: 14478, 341 siteId: 501028, 342 zoneId: 3960619 343 } 344 } 345}; 346 347var PT_TIMEZONES = ["Europe/Lisbon", "Atlantic/Madeira", "Atlantic/Azores"]; 348var MASKED_TIMEZONES = ["UTC", "GMT", "Etc/UTC", "Etc/GMT", "Etc/Greenwich"]; 349var PT_FLOOR_VALUES = { 350 "banner|300x250": 0.50, 351 "banner|300x600": 3.50, 352 "banner|728x90": 1.00, 353 "banner|320x50": 0.50, 354 "banner|970x250": 7.50 355}; 356var INTERNATIONAL_FLOOR_VALUES = { 357 "banner|300x250": 0.10, 358 "banner|300x600": 0.50, 359 "banner|728x90": 0.10, 360 "banner|320x50": 0.10, 361 "banner|970x250": 1.00 362}; 363var PT_FLOOR_DEFAULT = 0.50; 364var INTERNATIONAL_FLOOR_DEFAULT = 0.10; 365function readTimeZone() { 366 try { 367 if (typeof Intl === "undefined" || !Intl.DateTimeFormat) { 368 return null; 369 } 370 var resolved = Intl.DateTimeFormat().resolvedOptions(); 371 return resolved && resolved.timeZone ? resolved.timeZone : null; 372 } 373 catch (e) { 374 return null; 375 } 376} 377function readLanguage() { 378 var nav = navigator; 379 var language = (nav && (nav.language || nav.userLanguage)) || ""; 380 return String(language).toLowerCase(); 381} 382function isPortugalVisitor() { 383 var timeZone = readTimeZone(); 384 if (timeZone && MASKED_TIMEZONES.indexOf(timeZone) === -1) { 385 return PT_TIMEZONES.indexOf(timeZone) !== -1; 386 } 387 return readLanguage() === "pt-pt"; 388} 389function buildFloorsConfig(development) { 390 if (development) { 391 return { enabled: false }; 392 } 393 var portugal = isPortugalVisitor(); 394 var values = portugal ? PT_FLOOR_VALUES : INTERNATIONAL_FLOOR_VALUES; 395 var floorDefault = portugal ? PT_FLOOR_DEFAULT : INTERNATIONAL_FLOOR_DEFAULT; 396 if (localStorage.getItem("pbdebug") === "1") { 397 console.log("Prebid floors:", portugal ? "PT" : "INTERNATIONAL", "| timezone:", readTimeZone(), "| language:", readLanguage(), JSON.stringify(values, null, 2)); 398 } 399 return { 400 enabled: true, 401 floorMin: floorDefault, 402 enforcement: { 403 enforceJS: true, 404 floorDeals: false 405 }, 406 data: { 407 currency: "EUR", 408 schema: { 409 fields: ["mediaType", "size"] 410 }, 411 values: values, 412 default: floorDefault 413 } 414 }; 415} 416 417function allowedPrebidSizes(size) { 418 // let allowedSizes = ["300x250", "300x600", "320x50", "728x90", "970x250", "Pre-roll", "Mid-roll", "Post-roll", "Incontent video"]; 419 var allowedSizes = ["300x250", "300x600", "320x50", "728x90", "970x250"]; 420 // let allowedSizes = ["300x250"]; 421 return allowedSizes.includes(size); 422} 423function createPrebidAdUnit(slotID, formatName) { 424 var debugMode = localStorage.getItem("pbdebug") === "1"; 425 var slotModel = IOLComercialFormatCreator.createSlotModel(slotID, formatName, 0);
426 var validSizes = slotModel.sizes 427 .filter(function (s) { return Array.isArray(s) && s.length === 2 && s.every(Number.isFinite); }) 428 .filter(function (_a) { 429 var w = _a[0], h = _a[1]; 430 return allowedPrebidSizes(w + "x" + h); 431 }); // <-- filter by allowed sizes 432 if (!validSizes.length) { 433 return null; 434 } 435 var bidderKeys = Object.keys(bidders); 436 var adUnit = { 437 code: slotID, 438 mediaTypes: { 439 banner: { 440 sizes: validSizes, 441 // ...(hasFluid && { fluid: true }), 442 }, 443 }, 444 bids: bidderKeys.map(function (key) { 445 var baseConfig = __assign({}, bidders[key]); 446 if (key === "rubicon") { 447 var mappedSizes = mapRubiconSizes(validSizes); 448 if (!mappedSizes.length) { 449 return null; 450 } 451 return __assign(__assign({}, baseConfig), { params: __assign(__assign({}, baseConfig.params), { sizes: mappedSizes }) }); 452 } 453 return baseConfig; 454 }).filter(Boolean), 455 }; 456 if (debugMode) { 457 console.log("Prebid adUnit built:", formatName, JSON.stringify(adUnit, null, 2)); 458 } 459 return adUnit; 460} 461function setPrebidBidderSettings(pbjs) { 462 pbjs.bidderSettings = pbjs.bidderSettings || {}; 463 pbjs.bidderSettings.criteo = { storageAllowed: true }; 464 pbjs.bidderSettings.rubicon = { storageAllowed: true }; 465 pbjs.bidderSettings.ttd = { storageAllowed: true }; 466 pbjs.bidderSettings.improvedigital = { storageAllowed: true }; 467} 468function setPrebidConfig(pbjs) { 469 var environment = document.location.host.includes("localhost") || 470 document.location.host.includes("dev."); 471 var debugMode = localStorage.getItem("pbdebug") === "1"; 472 pbjs.setConfig({ 473 debug: debugMode, 474 enableTIDs: true, 475 s2sConfig: null, 476 maxRequests: 6, 477 enableSendAllBids: false, 478 bidderTimeout: 1200, 479 bidderSequence: "random", 480 auctionOptions: { 481 suppressStaleRender: true 482 }, 483 schain: { 484 complete: 1, 485 nodes: [{ 486 asi: location.hostname, 487 sid: "prebid", 488 hp: 1 489 }] 490 }, 491 currency: { 492 adServerCurrency: "EUR", 493 defaultRates: { 494 EUR: { USD: 1.15 }, 495 USD: { EUR: 0.87 } 496 } 497 }, 498 priceGranularity: { 499 buckets: [{ 500 precision: 2, 501 min: 0, 502 max: 20, 503 increment: 0.01 504 }] 505 }, 506 floors: buildFloorsConfig(environment), 507 consentManagement: { 508 gdpr: { 509 cmpApi: "iab", 510 timeout: 8000 511 }, 512 usp: { 513 cmpApi: "iab", 514 timeout: 8000 515 } 516 }, 517 userSync: { 518 userIds: [ 519 { 520 name: "id5Id", 521 params: { 522 partner: "1839" 523 }, 524 storage: { 525 type: "cookie", 526 name: "id5id", 527 expires: 365 528 } 529 }, 530 { 531 name: "ttlClientId", 532 params: { partner: "efb2xcd" }, 533 storage: { type: "cookie", name: "ttl_client_id", expires: 365 } 534 } 535 ] 536 }, 537 targetingControls: { 538 bidderKeys: false, 539 alwaysIncludeDeals: false, 540 allBids: false 541 }, 542 analytics: [ 543 { 544 provider: "liveramp-ats", 545 options: { 546 endpoint: "https://analytics.liveramp.com/ats" 547 } 548 } 549 ] 550 }); 551} 552function mapRubiconSizes(pixelSizes) { 553 // Map of sizes to Rubicon IDs, defined inside the function 554 var RUBICON_SIZE_MAP = { 555 "468x60": 1, 556 "728x90": 2, 557 "120x600": 8, 558 "160x600": 9, 559 "300x600": 10, 560 "300x250": 15, 561 "336x280": 16, 562 "320x50": 43, 563 "300x50": 44, 564 "970x90": 55, 565 "970x250": 57, 566 "320x100": 117 567 }; 568 return pixelSizes 569 .filter(function (size) { 570 return Array.isArray(size) && 571 size.length === 2 &&
572 typeof size[0] === "number" && 573 typeof size[1] === "number"; 574 }) 575 .map(function (_a) { 576 var _b; 577 var w = _a[0], h = _a[1]; 578 var key = w + "x" + h; 579 return (_b = RUBICON_SIZE_MAP[key]) !== null && _b !== void 0 ? _b : null; 580 }) 581 .filter(function (id) { return id !== null; }); 582} 583 584// declare var window: Window & { iol?: { onUserLoggedIn?: () => void } & {} }; 585var IOLComercialPlatform = /** @class */ (function () { 586 function IOLComercialPlatform(AMUnit) { 587 this.hasPreloaded = false; 588 this.AMUnit = AMUnit; 589 this.AMGoogleTag = {}; 590 this.pbjs = window.pbjs = window.pbjs || { cmd: [] }; 591 setPrebidBidderSettings(this.pbjs); 592 this.prebidConfigured = false; 593 this.prebidListenersAttached = false; 594 this.slotQueue = []; 595 this.slotsIndex = {}; 596 this.refreshableSlotsIndex = []; 597 this.noPubProducts = [7, 8, 9, 12, 13, 14]; 598 this.noPubPremiumProducts = [13, 14]; 599 this.correlator = Date.now(); 600 this.location = document.querySelector("meta[property='og:site_name']") 601 ? document 602 .querySelector("meta[property='og:site_name']") 603 .getAttribute("content") 604 : ""; 605 this.tags = this.getArticleTags(); 606 this.section = this.getSectionTags(); 607 this.ctags = this.getControlTags(); 608 this.pubTag = this.getPubTag(); 609 this.projTag = this.getProjTag(); 610 } 611 IOLComercialPlatform.prototype.loadDependencies = function (action) { 612 var _this = this; 613 var scriptLoader = new IOLScriptLoaderModule(); 614 scriptLoader.addScript("https://www.googletagservices.com/tag/js/gpt.js"); 615 scriptLoader.addScript("https://cdn.iol.pt/js/utils/Modules/IOLComercial/prebid/prebid.js"); 616 // scriptLoader.addScript("http://localhost:8080/js/prebid10.15.0.js"); 617 scriptLoader.onLoaded(function () { return __awaiter(_this, void 0, void 0, function () { 618 var _a; 619 return __generator(this, function (_b) { 620 switch (_b.label) { 621 case 0: 622 this.AMGoogleTag = window["googletag"] || {}; 623 console.info("IOLCOMERCIAL: Dependencies successufly loaded"); 624 action(); 625 _b.label = 1; 626 case 1: 627 _b.trys.push([1, 3, , 4]); 628 _a = this; 629 return [4 /*yield*/, this.getIOLAnalyticsCookieValue()]; 630 case 2: 631 _a.ppID = _b.sent(); 632 return [3 /*break*/, 4]; 633 case 3: 634 _b.sent(); 635 return [3 /*break*/, 4]; 636 case 4: return [2 /*return*/]; 637 } 638 }); 639 }); }, function () { 640 console.error("IOLCOMERCIAL: Cannot load dependencies"); 641 }); 642 }; 643 IOLComercialPlatform.prototype.getIOLAnalyticsCookieValue = function () { 644 var cookie = document.cookie.split(";"); 645 var iola = cookie.find(function (el) { 646 if (el.includes("_iola")) { 647 return true; 648 } 649 }); 650 if (iola) { 651 var ids = iola.split("_iola="); 652 var id = ids[1]; 653 return id || undefined; 654 } 655 }; 656 IOLComercialPlatform.prototype.getArticleTags = function () { 657 var _this = this; 658 var _a, _b, _c, _d; 659 var ioltags = document.querySelector("meta[property='iol:tags']"); 660 var iolprogramme = document.querySelector("meta[property='iol:programme_name']"); 661 var metatags = (_b = (_a = ioltags === null || ioltags === void 0 ? void 0 : ioltags.getAttribute("content")) === null || _a === void 0 ? void 0 : _a.split(", ")) !== null && _b !== void 0 ? _b : []; 662 var programmetags = (_d = (_c = iolprogramme === null || iolprogramme === void 0 ? void 0 : iolprogramme.getAttribute("content")) === null || _c === void 0 ? void 0 : _c.split(", ")) !== null && _d !== void 0 ? _d : []; 663 var tags = metatags.concat(programmetags).filter(function (n) { return n; }); 664 var originURL = window.location.origin; 665 var homepage = originURL + '/'; 666 if (window.location.href === homepage) { 667 tags.push("homepage"); 668 console.log("tags: ", tags); 669 } 670 var tagList = []; 671 if (tags.length > 0) { 672 tagList = Array.from(new Set(tags.map(function (element) { return _this.tagConverter(element); }))); 673 } 674 // Add "homepage" if we are on the homepage 675 return tagList; 676 }; 677 IOLComercialPlatform.prototype.tagConverter = function (s) { 678 var lower = s.toLowerCase(); 679 var normal = lower.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); 680 return normal.replace(/ /g, ""); 681 }; 682 IOLComercialPlatform.prototype.getPubTag = function () { 683 var metatag = document.querySelector("meta[property='iol:pub_tag']"); 684 var pubtag = (metatag === null || metatag === void 0 ? void 0 : metatag.getAttribute("content")) || ""; 685 if (pubtag) { 686 var sectionList = this.tagConverter(pubtag); 687 return sectionList; 688 } 689 }; 690 IOLComercialPlatform.prototype.getSectionTags = function () { 691 var metapsection = document.querySelector("meta[property='iol:parent_section']"); 692 var metasection = document.querySelector("meta[property='iol:section']"); 693 var psection = (metapsection === null || metapsection === void 0 ? void 0 : metapsection.getAttribute("content")) || ""; 694 var section = (metasection === null || metasection === void 0 ? void 0 : metasection.getAttribute("content")) || ""; 695 var sectionList = [ 696 this.tagConverter(psection), 697 this.tagConverter(section) 698 ]; 699 return sectionList; 700 }; 701 IOLComercialPlatform.prototype.getControlTags = function () { 702 var _this = this; 703 var metactag = document.querySelector("meta[property='iol:ctags']"); 704 var ctags = (metactag === null || metactag === void 0 ? void 0 : metactag.getAttribute("content")) || ""; 705 var ctagList = []; 706 if (ctags !== "") { 707 var arr = ctags.split(", "); 708 ctagList = arr.map(function (element) { 709 return _this.tagConverter(element); 710 }); 711 } 712 return ctagList; 713 }; 714 IOLComercialPlatform.prototype.getProjTag = function () { 715 var _a; 716 var projTag = ((_a = document.querySelector("meta[property='iol:project']")) === null || _a === void 0 ? void 0 : _a.getAttribute("content")) || ""; 717 return projTag ? this.tagConverter(projTag) : ""; 718 }; 719 IOLComercialPlatform.prototype.isPlatformLoadedCorrectly = function () { 720 return !(Object.keys(this.AMGoogleTag).length === 0 && 721 this.AMGoogleTag.constructor === Object); 722 }; 723 IOLComercialPlatform.prototype.preloadMainPlacements = function () { 724 var _this = this; 725 if (!this.isPlatformLoadedCorrectly()) { 726 console.error("IOLCOMERCIAL: No googletag available"); 727 return; 728 } 729 this.loadPlacements(false); 730 this.AMGoogleTag.cmd.push(function () { 731 var _a, _b, _c, _d; 732 _this.AMGoogleTag.pubads().enableSingleRequest(); 733 _this.AMGoogleTag.pubads().setSafeFrameConfig({ 734 allowOverlayExpansion: true, 735 allowPushExpansion: true, 736 sandbox: true, 737 }); 738 _this.AMGoogleTag.pubads().enableLazyLoad({ 739 // Fetch slots within 2 viewports. 740 fetchMarginPercent: 200, 741 // Render slots within 1 viewports. 742 renderMarginPercent: 100, 743 // Double the above values on mobile, where viewports are smaller 744 // and users tend to scroll faster. 745 mobileScaling: 1.5, 746 }); 747 _this.AMGoogleTag.pubads().collapseEmptyDivs(true); 748 _this.AMGoogleTag.pubads().setPublisherProvidedId(_this.ppID); 749 var isTVIPlayer = _this.location === "TVI Player"; 750 if (((_a = _this.tags) === null || _a === void 0 ? void 0 : _a.length) > 0) { 751 console.log('tags', _this.tags); 752 _this.AMGoogleTag.pubads().setTargeting("category", _this.tags); 753 } 754 else if (isTVIPlayer && ((_b = _this.tags) === null || _b === void 0 ? void 0 : _b[0]) !== "tviplayer") { 755 _this.AMGoogleTag.pubads().setTargeting("programa", _this.tags[0]); 756 } 757 // Set targeting based on live pubTag 758 if (_this.pubTag) { 759 _this.AMGoogleTag.pubads().setTargeting("lives", _this.pubTag); 760 } 761 // Set universal targeting if ctags exist 762 if (((_c = _this.ctags) === null || _c === void 0 ? void 0 : _c.length) > 0) { 763 _this.AMGoogleTag.pubads().setTargeting("universal", _this.ctags); 764 } 765 // Set targeting based on section 766 if (((_d = _this.section) === null || _d === void 0 ? void 0 : _d.length) > 0) { 767 var _e = _this.section, parentSection = _e[0], section = _e[1]; 768 if (parentSection) { 769 _this.AMGoogleTag.pubads().setTargeting("parentsection", parentSection); 770 } 771 if (section) { 772 _this.AMGoogleTag.pubads().setTargeting("section", section); 773 } 774 } 775 if (_this.projTag) { 776 _this.AMGoogleTag.pubads().setTargeting("project", _this.projTag); 777 } 778 _this.AMGoogleTag.pubads().disableInitialLoad(); 779 _this.AMGoogleTag.enableServices(); 780 console.info("IOLCOMERCIAL: Preloaded " + Object.keys(_this.slotsIndex).length); 781 _this.hasPreloaded = true; 782 }); 783 }; 784 IOLComercialPlatform.prototype.loadNewPlacements = function () { 785 if (this.hasPreloaded) { 786 var loaded = Object.keys(this.slotsIndex).length; 787 this.loadPlacements(true); 788 console.info("IOLCOMERCIAL: " + (Object.keys(this.slotsIndex).length - loaded) + " were loaded"); 789 } 790 else { 791 console.info("IOLCOMERCIAL: waiting for preloading."); 792 } 793 }; 794 IOLComercialPlatform.prototype.loadAllPlacementsIntoPage = function () { 795 var _this = this; 796 var adSlots = document.querySelectorAll('.iol-comercial-placement-loaded');
797 adSlots.forEach(function (slot) { 798 if (_this.isAboveFold(slot, 200)) { 799 _this.AMGoogleTag.cmd.push(function () { 800 _this._runPrebidForSlot(slot.id, function () { 801 _this.refresh(slot.id); 802 slot.classList.add("iol-comercial-placement-displayed"); 803 console.log("IO - display ad: " + slot.id); 804 }); 805 }); 806 } 807 else { 808 _this.lazyLoadAdSlot(slot); 809 } 810 }); 811 }; 812 IOLComercialPlatform.prototype.refresh = function (slotName) { 813 var _this = this; 814 if (!this.isPlatformLoadedCorrectly()) { 815 console.error("IOLCOMERCIAL: No googletag available"); 816 return; 817 } 818 var refreshSlots = this.refreshableSlotsIndex; 819 if (slotName) { 820 var slot = this.slotsIndex[slotName]; 821 refreshSlots = slot ? [slot["AMslot"]] : undefined; 822 } 823 if (refreshSlots) { 824 this.AMGoogleTag.cmd.push(function () { 825 _this.AMGoogleTag.pubads().refresh(refreshSlots, { 826 changeCorrelator: false 827 }); 828 }); 829 console.info("IOLCOMERCIAL: Refreshed with sucess (" + (slotName ? slotName : "all") + ")"); 830 } 831 else { 832 console.error("\"IOLCOMERCIAL: Couldn't refresh (" + slotName + " doesn't exists)"); 833 } 834 }; 835 IOLComercialPlatform.prototype.refreshDisplayedSlots = function () { 836 var _this = this; 837 var adSlotsDisplayed = document.querySelectorAll('.iol-comercial-placement-displayed'); 838 var refreshSlots = []; 839 adSlotsDisplayed.forEach(function (slot) { 840 if (_this.slotsIndex[slot.id] && _this.slotsIndex[slot.id].isRefreshable) { 841 refreshSlots.push(_this.slotsIndex[slot.id]["AMslot"]); 842 } 843 }); 844 this.AMGoogleTag.cmd.push(function () { 845 _this.AMGoogleTag.pubads().refresh(refreshSlots, { 846 changeCorrelator: false 847 }); 848 }); 849 }; 850 IOLComercialPlatform.prototype.createNewPlacement = function (divID) { 851 var element = document.getElementById(divID); 852 var slotId = element.id; 853 var slotFormat = element["dataset"]["iolComercialFormat"]; 854 var slotPositionStr = element["dataset"]["iolComercialFormatPosition"]; 855 var slotPosition; 856 try { 857 slotPosition = slotPositionStr ? parseInt(slotPositionStr) : undefined; 858 } 859 catch (_a) { 860 slotPosition = undefined; 861 } 862 if (this.checkRestrictions(element)) { 863 var slot = IOLComercialFormatCreator.createSlotModel(slotId, slotFormat, slotPosition); 864 this.addNewPlacement(slot); 865 } 866 else { 867 element.remove(); 868 } 869 }; 870 IOLComercialPlatform.prototype.createSlot = function (slot) { 871 var _this = this; 872 this.AMGoogleTag.cmd.push(function () { 873 var AMslot = undefined; 874 //begin of anchor 875 if (slot.formatName == "ANCHOR") { 876 AMslot = _this.AMGoogleTag.defineOutOfPageSlot(_this.AMUnit + "/" + slot.formatName, _this.AMGoogleTag.enums.OutOfPageFormat.BOTTOM_ANCHOR); 877 } 878 else { 879 AMslot = _this.AMGoogleTag.defineSlot(_this.AMUnit + "/" + slot.formatName, slot.sizes, slot.name); 880 } 881 //Defining Viewports 882 if (slot.viewports) { 883 var mapping_1 = _this.AMGoogleTag.sizeMapping(); 884 slot.viewports.forEach(function (vp) { 885 mapping_1.addSize(vp["viewport"], vp["sizes"]); 886 }); 887 AMslot = AMslot.defineSizeMapping(mapping_1.build()); 888 } 889 AMslot.addService(_this.AMGoogleTag.pubads()).setTargeting("sizes", slot.sizes); 890 //Define Targeting 891 if (slot.key_values) { 892 for (var _i = 0, _a = Object.entries(slot.key_values); _i < _a.length; _i++) { 893 var _b = _a[_i], key = _b[0], value = _b[1]; 894 AMslot = AMslot.setTargeting(key, value); 895 } 896 } 897 slot["AMslot"] = AMslot; 898 _this.slotsIndex[slot.name] = slot; 899 //this.AMGoogleTag.display(slot.name); 900 if (slot.isRefreshable) { 901 _this.refreshableSlotsIndex.push(AMslot); 902 } 903 }); 904 }; 905 IOLComercialPlatform.prototype.loadPlacements = function (shouldDisplay) { 906 var _this = this; 907 while (this.slotQueue.length > 0) 908 this.createSlot(this.slotQueue.pop()); 909 var placement = document.querySelectorAll(".iol-comercial-placement"); 910 placement.forEach(function (element) {
911 var slotId = element.id; 912 var slotFormat = element["dataset"]["iolComercialFormat"]; 913 var slotPositionStr = element["dataset"]["iolComercialFormatPosition"]; 914 var slotPosition; 915 try { 916 slotPosition = slotPositionStr ? parseInt(slotPositionStr) : undefined; 917 } 918 catch (_a) { 919 slotPosition = undefined; 920 } 921 if (_this.checkRestrictions(element)) { 922 var slot = IOLComercialFormatCreator.createSlotModel(slotId, slotFormat, slotPosition); 923 _this.addNewPlacement(slot); 924 element.classList.add("iol-comercial-placement-loaded"); 925 element.classList.remove("iol-comercial-placement"); 926 if (slot.extraCSS) 927 element.classList.add(slot.extraCSS); 928 if (shouldDisplay) 929 _this.refresh(slotId); 930 } 931 else { 932 element.remove(); 933 } 934 }); 935 }; 936 IOLComercialPlatform.prototype.addNewPlacement = function (slot) { 937 if (!slot) 938 return; 939 if (!this.isPlatformLoadedCorrectly()) { 940 this.slotQueue.push(slot); 941 console.error("IOLCOMERCIAL: Added to queue"); 942 return; 943 } 944 if (this.slotsIndex[slot.name]) { 945 console.error("IOLCOMERCIAL: Slot name already exists"); 946 return; 947 } 948 this.createSlot(slot); 949 }; 950 IOLComercialPlatform.prototype.checkRestrictions = function (element) { 951 return this.checkScreenRestriction(element); 952 }; 953 IOLComercialPlatform.prototype.checkScreenRestriction = function (element) { 954 var screenWidth = window.innerWidth; 955 var screenMinRestriction = element["dataset"]["iolComercialMinScreenWitdh"]; 956 var screenMaxRestriction = element["dataset"]["iolComercialMaxScreenWitdh"]; 957 if (!screenMinRestriction && !screenMaxRestriction) 958 return true; 959 try { 960 screenMinRestriction = screenMinRestriction 961 ? parseInt(screenMinRestriction) 962 : undefined; 963 screenMaxRestriction = screenMaxRestriction 964 ? parseInt(screenMaxRestriction) 965 : undefined; 966 if (screenMinRestriction && 967 !screenMaxRestriction && 968 screenWidth > screenMinRestriction) 969 return true; 970 if (screenMaxRestriction && 971 !screenMinRestriction && 972 screenWidth < screenMaxRestriction) 973 return true; 974 if (screenMinRestriction && 975 screenMaxRestriction && 976 screenWidth > screenMinRestriction && 977 screenWidth < screenMaxRestriction) 978 return true; 979 } 980 catch (error) { 981 console.error("IOLCOMERCIAL: Screen Restriction not valid."); 982 } 983 return false; 984 }; 985 IOLComercialPlatform.prototype.shouldAdsBeLoaded = function (project) { 986 var sluserx1 = localStorage.getItem("userx1"); 987 if (!sluserx1) 988 return true; 989 var user; 990 try { 991 user = JSON.parse(sluserx1); 992 } 993 catch (_a) { 994 return true; 995 } 996 var subscribedProducts = user === null || user === void 0 ? void 0 : user.subscribedProducts; 997 if (!(subscribedProducts === null || subscribedProducts === void 0 ? void 0 : subscribedProducts.length)) 998 return true; 999 var noAdsProducts = project === "tviplayer" 1000 ? this.noPubProducts 1001 : this.noPubPremiumProducts; 1002 var isSubbed = noAdsProducts.some(function (p) { 1003 return subscribedProducts.includes(p); 1004 }); 1005 return !isSubbed; 1006 }; 1007 IOLComercialPlatform.prototype.removeAllPlacements = function () { 1008 var placement = document.querySelectorAll(".iol-comercial-placement"); 1009 placement.forEach(function (element) { 1010 element.remove(); 1011 }); 1012 }; 1013 IOLComercialPlatform.prototype.removeAllPlacementWrappers = function () { 1014 console.info("IOLCOMERCIAL: removing ads wrappers"); 1015 var placement = document.querySelectorAll(".mcd-hidden-block"); 1016 placement.forEach(function (element) { 1017 element.remove(); 1018 }); 1019 }; 1020 IOLComercialPlatform.prototype.lazyLoadAdSlot = function (slot) { 1021 var _this = this; 1022 var observer = new IntersectionObserver(function (entries) {
1023 entries.forEach(function (entry) { 1024 if (entry.isIntersecting) { 1025 _this.AMGoogleTag.cmd.push(function () { 1026 _this._runPrebidForSlot(slot.id, function () { 1027 _this.refresh(slot.id); 1028 slot.classList.add("iol-comercial-placement-displayed"); 1029 console.log("IO - display ad: " + slot.id); 1030 }); 1031 }); 1032 observer.unobserve(slot); 1033 } 1034 }); 1035 }, { 1036 rootMargin: '250px' 1037 }); 1038 observer.observe(slot); 1039 }; 1040 IOLComercialPlatform.prototype.isAboveFold = function (element, threshold) { 1041 if (threshold === void 0) { threshold = 0; } 1042 var rect = element.getBoundingClientRect(); 1043 return rect.top < (window.innerHeight + threshold); 1044 }; 1045 IOLComercialPlatform.prototype.ensurePrebidConfigured = function (pbjs) { 1046 if (this.prebidConfigured) 1047 return; 1048 setPrebidConfig(pbjs); 1049 this.prebidConfigured = true; 1050 }; 1051 IOLComercialPlatform.prototype.attachPrebidListeners = function (pbjs) { 1052 if (this.prebidListenersAttached) 1053 return; 1054 this.prebidListenersAttached = true; 1055 var debugMode = localStorage.getItem("pbdebug") === "1"; 1056 pbjs.onEvent("bidResponse", function (bid) { 1057 if (debugMode) 1058 console.log("bidResponse:", bid); 1059 }); 1060 pbjs.onEvent("noBid", function (info) { 1061 if (debugMode) 1062 console.log("noBid:", info); 1063 }); 1064 pbjs.onEvent("auctionEnd", function (data) { 1065 if (debugMode) 1066 console.log("auctionEnd:", data); 1067 }); 1068 }; 1069 IOLComercialPlatform.prototype._runPrebidForSlot = function (slotId, done) { 1070 var _this = this; 1071 var pbjs = window["pbjs"]; 1072 if (!pbjs || !pbjs.que) { 1073 console.warn("Prebid not ready, skipping bids for slot:", slotId); 1074 done(); 1075 return; 1076 } 1077 var debugMode = localStorage.getItem("pbdebug") === "1"; 1078 pbjs.que.push(function () { 1079 var _a, _b, _c; 1080 // apply your global Prebid config 1081 _this.ensurePrebidConfigured(pbjs); 1082 var el = document.getElementById(slotId); 1083 if (!el) { 1084 // console.warn("Slot not found:", slotId); 1085 done(); 1086 return; 1087 } 1088 var format = el.getAttribute("data-iol-comercial-format") || "LEADERBOARD"; 1089 var adUnit = createPrebidAdUnit(slotId, format); 1090 if (adUnit == null) { 1091 done(); 1092 return; 1093 } 1094 if (!adUnit.bids || adUnit.bids.length === 0) { 1095 if (debugMode) { 1096 console.info("Skipping Prebid auction for " + slotId + " \u2014 no bidders configured."); 1097 } 1098 done(); 1099 return; 1100 } 1101 var hasValidSizes = ((_c = (_b = (_a = adUnit.mediaTypes) === null || _a === void 0 ? void 0 : _a.banner) === null || _b === void 0 ? void 0 : _b.sizes) === null || _c === void 0 ? void 0 : _c.length) && 1102 adUnit.mediaTypes.banner.sizes.every(function (s) { return Array.isArray(s) && s.length === 2 && s.every(Number.isFinite); }); 1103 if (!hasValidSizes) { 1104 console.info("Skipping Prebid auction for " + slotId + " \u2014 no valid sizes defined."); 1105 done(); 1106 return; 1107 } 1108 // register the adUnit 1109 pbjs.removeAdUnit(adUnit.code); 1110 pbjs.addAdUnits([adUnit]); 1111 if (debugMode) { 1112 console.group("Prebid Debug for " + slotId); 1113 console.log("All ad units currently registered:", pbjs.adUnits); 1114 } 1115 _this.attachPrebidListeners(pbjs); 1116 pbjs.requestBids({ 1117 adUnits: [adUnit], 1118 timeout: 3000, 1119 bidsBackHandler: function () { 1120 if (debugMode) { 1121 console.info("Prebid: Auction for " + adUnit.code); 1122 } 1123 var winningBids = pbjs.getHighestCpmBids(adUnit.code); 1124 var hasBids = winningBids.length > 0; 1125 if (hasBids) { 1126 if (debugMode) { 1127 console.info("Prebid: Bids found for " + adUnit.code + ", winning bid:", winningBids[0]); 1128 } 1129 } 1130 else { 1131 if (debugMode) { 1132 console.info("Prebid: No bids for " + adUnit.code); 1133 } 1134 } 1135 pbjs.setTargetingForGPTAsync([adUnit.code]); 1136 done(); 1137 } 1138 }); 1139 }); 1140 }; 1141 return IOLComercialPlatform; 1142}()); 1143 1144var IOLComercial = /** @class */ (function () { 1145 function IOLComercial(project, platform, section, contentType, quantcast) { 1146 var _this = this; 1147 //ADUNIT RULE: code/project/platform/section/contentType/format 1148 this.AMCode = "130294768"; 1149 this.project = project; 1150 this.platform = platform; 1151 this.pageSection = section; 1152 this.pageContentType = contentType;
1153 var AMUnit = "/" + this.AMCode + "/" + this.project + "/" + this.platform; 1154 if (this.pageSection) { 1155 AMUnit += "/" + this.pageSection; 1156 } 1157 if (this.pageContentType) { 1158 AMUnit += "/" + this.pageContentType; 1159 } 1160 this.iolComercialPlatform = new IOLComercialPlatform(AMUnit); 1161 if (this.iolComercialPlatform.shouldAdsBeLoaded(this.project)) { 1162 this.iolComercialPlatform.loadDependencies(function () { 1163 _this.loadStyle(); 1164 _this.iolComercialPlatform.preloadMainPlacements(); 1165 var development = document.location.host.includes("localhost") || document.location.host.includes("dev."); 1166 if (quantcast && !development) { 1167 _this.waitForQuantcast(); 1168 } 1169 else { 1170 if (development) 1171 console.info("IOLCOMERCIAL: DEV MODE"); 1172 _this.iolComercialPlatform.loadAllPlacementsIntoPage(); 1173 } 1174 }); 1175 } 1176 else { 1177 this.iolComercialPlatform.removeAllPlacements(); 1178 this.iolComercialPlatform.removeAllPlacementWrappers(); 1179 this.iolComercialPlatform.loadDependencies(function () { }); 1180 } 1181 } 1182 IOLComercial.prototype.refreshSlot = function (slotname) { 1183 this.iolComercialPlatform.refresh(slotname); 1184 }; 1185 IOLComercial.prototype.refreshAllSlots = function () { 1186 this.iolComercialPlatform.refreshDisplayedSlots(); 1187 }; 1188 IOLComercial.prototype.addNewPlacementByName = function (divID) { 1189 this.iolComercialPlatform.createNewPlacement(divID); 1190 }; 1191 IOLComercial.prototype.loadNewPlacements = function () { 1192 this.iolComercialPlatform.loadNewPlacements(); 1193 }; 1194 IOLComercial.prototype.loadStyle = function () { 1195 var head = document.head || document.getElementsByTagName("head")[0]; 1196 var style = document.createElement("style"); 1197 var css = ".iol-comercial-placement-label > div:before {\n content:'PUBLICIDADE';\n display:block;\n text-align: center;\n color:#808080;\n font-size: 9px;\n font-family: 'Arial';\n line-height: 16px;\n }\n [data-iol-comercial-format=\"MPU2\"], [data-iol-comercial-format=\"MPU_HALF\"] {\n > div{\n margin-top:16px;\n &:before {\n margin-top: -16px;\n }\n }\n }"; 1198 style.type = "text/css"; 1199 style.appendChild(document.createTextNode(css)); 1200 head.appendChild(style); 1201 }; 1202 IOLComercial.prototype.waitForQuantcast = function () { 1203 var _this = this; 1204 var count = 0; 1205 var consentCheckInterval = setInterval(function () { 1206 var _a; 1207 if (window["__tcfapi"] || count == 60) { 1208 try { 1209 (_a = window["__tcfapi"]) === null || _a === void 0 ? void 0 : _a.call(window, "addEventListener", 2, function (tcData, success) { 1210 if (success && tcData.tcString) { 1211 _this.iolComercialPlatform.loadAllPlacementsIntoPage(); 1212 window["__tcfapi"]("removeEventListener", 2, function (success) { 1213 if (success) 1214 console.info("IOLCOMERCIAL: Quantcast listener removed"); 1215 }, tcData.listenerId); 1216 } 1217 }); 1218 clearInterval(consentCheckInterval); 1219 } 1220 catch (error) { 1221 console.error(error); 1222 clearInterval(consentCheckInterval); 1223 console.error("IOLCOMERCIAL: CMP not loaded"); 1224 } 1225 } 1226 count++; 1227 }, 100); 1228 }; 1229 return IOLComercial; 1230}()); 1231 1232window.IOLComercial = IOLComercial;
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.