'use strict'; /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { 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; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var IOLScriptLoaderModule = /** @class */ (function () { function IOLScriptLoaderModule() { this.promises = []; } IOLScriptLoaderModule.prototype.addScript = function (url) { if (!this.isScriptLoaded(url)) { var promise = new Promise(function (resolve, reject) { var script = document.createElement("script"); script.src = url; script.addEventListener("load", function () { return resolve(script); }, false); script.addEventListener("error", function () { return reject(script); }, false); document.body.appendChild(script); }); this.promises.push(promise); } }; IOLScriptLoaderModule.prototype.isScriptLoaded = function (url) { return document.querySelector("script[src=\"".concat(url, "\"]")) !== null; }; IOLScriptLoaderModule.prototype.addStyle = function (url) { if (!this.isStyleLoaded(url)) { var promise = new Promise(function (resolve, reject) { var link = document.createElement("link"); link.setAttribute("rel", "stylesheet"); link.setAttribute("type", "text/css"); link.setAttribute("href", url); link.addEventListener("load", function () { return resolve(link); }, false); link.addEventListener("error", function () { return reject(link); }, false); document.body.appendChild(link); }); this.promises.push(promise); } }; IOLScriptLoaderModule.prototype.isStyleLoaded = function (url) { return document.querySelector("link[href=\"".concat(url, "\"]")) !== null; }; IOLScriptLoaderModule.prototype.onLoaded = function (onLoaded, onError) { Promise.all(this.promises).then(function () { return onLoaded(); }, function () { return onError(); }); }; return IOLScriptLoaderModule; }()); var IOLComercialSlotModel = /** @class */ (function () { function IOLComercialSlotModel(name, sizes, viewport, formatName, targets, isRefreshable, extraCSS) { this.name = name; this.sizes = sizes; this.viewports = viewport; this.formatName = formatName; this.key_values = targets; this.isRefreshable = isRefreshable; this.extraCSS = extraCSS; } return IOLComercialSlotModel; }()); //INTER [1, 1] //BILLBOARDXL [ "fluid", [2,1], [970,250], [989,250]] //BILLBOARD [[970,250], [989,250]] //LEADERBOARD [[728,90], [320,50]] //MPU [300,250] //MPUHALF [[300,250], [300,600]] //MPU2 [300,250] //INCONTENT [3, 3] //BRANDED ["fluid"] //POPIN [340, 100] //ANCHOR[320, 50] var IOLComercialFormatCreator = /** @class */ (function () { function IOLComercialFormatCreator() { } IOLComercialFormatCreator.createSlotModel = function (slotID, formatName, position) { return IOLComercialFormatCreator.FORMAT_CREATOR[formatName.toUpperCase()](slotID, position); }; IOLComercialFormatCreator.FORMAT_CREATOR = { INTER: function (slotID) { return new IOLComercialSlotModel(slotID, [[1, 1], [320, 480]], undefined, "INTER", { pos: "inter" }, false, ""); }, BILLBOARD_XL: function (slotID) { return new IOLComercialSlotModel(slotID, [[970, 250], [980, 250], [320, 100], "fluid", [2, 1], [4, 4], [5, 5]], [ { viewport: [980, 600], sizes: [[970, 250], [980, 250], [320, 100], "fluid", [2, 1], [4, 4], [5, 5]] }, { viewport: [0, 0], sizes: ["fluid", [2, 1], [4, 4], [5, 5]] } ], "BILLBOARDXL", { pos: "billboardxl" }, false, "iol-comercial-placement-label"); }, POPIN: function (slotID) { return new IOLComercialSlotModel(slotID, [[340, 100]], undefined, "POPIN", { pos: "popin" }, true, ""); }, INCONTENT: function (slotID) { return new IOLComercialSlotModel(slotID, [[3, 3]], undefined, "INCONTENT", { pos: "incontent" }, true, ""); }, MPU_HALF: function (slotID) { return new IOLComercialSlotModel(slotID, [[300, 250], [300, 600]], undefined, "MPU_HALF", { pos: "mpuhalf" }, true, "iol-comercial-placement-label"); }, MPU: function (slotID) { return new IOLComercialSlotModel(slotID, [[300, 250]], undefined, "MPU", { pos: "mpu" }, true, "iol-comercial-placement-label"); }, ANCHOR: function (slotID) { return new IOLComercialSlotModel(slotID, [[320, 50]], undefined, "ANCHOR", { pos: "anchor" }, true, "iol-comercial-placement-label"); }, BRANDED: function (slotID) { return new IOLComercialSlotModel(slotID, ["fluid"], undefined, "BRANDED_CONTENT", { pos: "branded" }, true, "iol-comercial-placement-label"); }, IOL_BRANDED: function (slotID) { return new IOLComercialSlotModel(slotID, ["fluid"], undefined, "IOL_BRANDED_CONTENT", { pos: "iol_branded" }, true, "iol-comercial-placement-label"); }, BILLBOARD: function (slotID) { return new IOLComercialSlotModel(slotID, [ [970, 250], [980, 250] ], [ { viewport: [980, 600], sizes: [ [970, 250], [980, 250] ] } ], "BILLBOARD", { pos: "billboard" }, true, "iol-comercial-placement-label"); }, LEADERBOARD: function (slotID) { return new IOLComercialSlotModel(slotID, [ [728, 90], [320, 50], [970, 250], [980, 250] ], [ { viewport: [728, 600], sizes: [[728, 90]] }, { viewport: [320, 400], sizes: [[320, 50]] }, { viewport: [970, 600], sizes: [[970, 250], [728, 90]] }, { viewport: [980, 600], sizes: [[980, 250], [970, 250], [728, 90]] } ], "LDB", { pos: "ldb" }, true, "iol-comercial-placement-label"); }, LEADERBOARD2: function (slotID) { return new IOLComercialSlotModel(slotID, [ [728, 90], [320, 50] ], [ { viewport: [728, 600], sizes: [[728, 90]] }, { viewport: [320, 400], sizes: [[320, 50]] } ], "LDB2", { pos: "ldb2" }, true, "iol-comercial-placement-label"); }, BILLBOARD_LEADERBOARD: function (slotID) { return new IOLComercialSlotModel(slotID, [ [970, 250], [980, 250], [728, 90], [320, 50] ], [ { viewport: [980, 600], sizes: [ [970, 250], [980, 250], [728, 90] ] }, { viewport: [728, 600], sizes: [[728, 90]] }, { viewport: [320, 400], sizes: [[320, 50]] } ], "LDB", { pos: "ldb" }, true, "iol-comercial-placement-label"); }, BILLBOARD_LEADERBOARD2: function (slotID) { return new IOLComercialSlotModel(slotID, [ [970, 250], [980, 250], [728, 90], [320, 50] ], [ { viewport: [980, 600], sizes: [ [970, 250], [980, 250], [728, 90], [320, 50] ] }, { viewport: [728, 600], sizes: [[728, 90]] }, { viewport: [320, 400], sizes: [[320, 50]] } ], "LDB2", { pos: "ldb2" }, true, "iol-comercial-placement-label"); }, MPU2: function (slotID) { return new IOLComercialSlotModel(slotID, [[300, 250]], undefined, "MPU2", { pos: "mpu2" }, true, "iol-comercial-placement-label"); }, NM: function (slotID) { return new IOLComercialSlotModel(slotID, [[300, 400]], undefined, "NM", { pos: "nm" }, true, "iol-comercial-placement-label"); }, "300_100": function (slotID) { return new IOLComercialSlotModel(slotID, [[300, 100]], undefined, "300x100", { pos: "300x100" }, true, "iol-comercial-placement-label"); }, "IOL_MERCADO": function (slotID) { return new IOLComercialSlotModel(slotID, [[300, 80]], undefined, "IOL_MERCADO", { pos: "iol_mercado" }, true, "iol-comercial-placement-label"); }, "IOL_MERCADO_1": function (slotID) { return new IOLComercialSlotModel(slotID, [[300, 100]], undefined, "IOL_MERCADO_1", { pos: "iol_mercado_1" }, true, "iol-comercial-placement-label"); }, "IOL_MERCADO_2": function (slotID) { return new IOLComercialSlotModel(slotID, [[300, 100]], undefined, "IOL_MERCADO_2", { pos: "iol_mercado_2" }, true, "iol-comercial-placement-label"); }, "IOL_MERCADO_3": function (slotID) { return new IOLComercialSlotModel(slotID, [[300, 100]], undefined, "IOL_MERCADO_3", { pos: "iol_mercado_3" }, true, "iol-comercial-placement-label"); }, "IOL_MERCADO_4": function (slotID) { return new IOLComercialSlotModel(slotID, [[300, 100]], undefined, "IOL_MERCADO_4", { pos: "iol_mercado_4" }, true, "iol-comercial-placement-label"); }, "SPONSOR": function (slotID, position) { return new IOLComercialSlotModel(slotID, ["fluid"], undefined, "SPONSOR".concat(position ? position : '1'), { pos: "sponsor".concat(position ? position : '1') }, true, "iol-comercial-placement-label"); }, AUDIO: function (slotID) { return new IOLComercialSlotModel(slotID, [[1, 1]], undefined, "AUDIO", { pos: "audio" }, true, "iol-comercial-placement-label"); }, OUTSTREAM: function (slotID) { return new IOLComercialSlotModel(slotID, [[640, 480]], undefined, "OUTSTREAM", { pos: "outstream" }, true, "iol-comercial-placement-label"); } }; return IOLComercialFormatCreator; }()); // declare var window: Window & { iol?: { onUserLoggedIn?: () => void } & {} }; var IOLComercialPlatform = /** @class */ (function () { function IOLComercialPlatform(AMUnit) { this.hasPreloaded = false; this.AMUnit = AMUnit; this.AMGoogleTag = {}; this.slotQueue = []; this.slotsIndex = {}; this.refreshableSlotsIndex = []; } IOLComercialPlatform.prototype.loadDependencies = function (action) { var _this = this; var scriptLoader = new IOLScriptLoaderModule(); scriptLoader.addScript("https://www.googletagservices.com/tag/js/gpt.js"); scriptLoader.onLoaded(function () { return __awaiter(_this, void 0, void 0, function () { var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: this.AMGoogleTag = window["googletag"] || {}; console.info("IOLCOMERCIAL: Dependencies successufly loaded"); action(); this.location = document.querySelector("meta[property='og:site_name']") ? document .querySelector("meta[property='og:site_name']") .getAttribute("content") : ""; this.tags = this.getArticleTags(); _b.label = 1; case 1: _b.trys.push([1, 3, , 4]); _a = this; return [4 /*yield*/, this.getIOLAnalyticsCookieValue()]; case 2: _a.ppID = _b.sent(); return [3 /*break*/, 4]; case 3: _b.sent(); return [3 /*break*/, 4]; case 4: return [2 /*return*/]; } }); }); }, function () { console.error("IOLCOMERCIAL: Cannot load dependencies"); }); }; IOLComercialPlatform.prototype.getIOLAnalyticsCookieValue = function () { var cookie = document.cookie.split(";"); var iola = cookie.find(function (el) { if (el.includes("_iola")) { return true; } }); if (iola) { var ids = iola.split("_iola="); var id = ids[1]; return id || undefined; } }; IOLComercialPlatform.prototype.getArticleTags = function () { var _this = this; var metatags = document.querySelector("meta[property='iol:tags']"); var tagList = []; var tags = metatags != undefined ? metatags.getAttribute("content") : ""; if (tags !== "") { var arr = tags.split(", "); tagList = arr.map(function (element) { return _this.tagConverter(element); }); } else if (this.location == "TVI Player" && metatags === null) { var show = document .querySelector("meta[property='og:description']") .getAttribute("content"); if (show != undefined) { var str = show.split(" | TVI Player"); tagList = Array.from([this.tagConverter(str[0])]); } } return tagList; }; IOLComercialPlatform.prototype.tagConverter = function (element) { var lower = element.toLowerCase(); var normal = lower.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); return normal.replace(/ /g, ""); }; // nonioID(): Promise { // const value = this.getIOLAnalyticsCookieValue(); // if (value) { // // console.log("return with value: ", value); // return Promise.resolve(value); // } // // return new Promise((resolve, reject) => { // // window.iol = window.iol || {}; // // window.iol.onLoaded = function () { // // console.log("The bar is fully loaded and showing on the screen!"); // // }; // // window.iol.onUserLoggedIn = () => { // // console.log("user login"); // // const value = this.getIOLAnalyticsCookieValue(); // // if (value) resolve(value); // // else reject(); // // }; // // }); // } IOLComercialPlatform.prototype.isPlatformLoadedCorrectly = function () { return !(Object.keys(this.AMGoogleTag).length === 0 && this.AMGoogleTag.constructor === Object); }; IOLComercialPlatform.prototype.preloadMainPlacements = function () { var _this = this; if (!this.isPlatformLoadedCorrectly()) { console.error("IOLCOMERCIAL: No googletag available"); return; } this.loadPlacements(false); this.AMGoogleTag.cmd.push(function () { _this.AMGoogleTag.pubads().enableSingleRequest(); _this.AMGoogleTag.pubads().setSafeFrameConfig({ allowOverlayExpansion: true, allowPushExpansion: true, sandbox: true, }); _this.AMGoogleTag.pubads().enableLazyLoad({ // Fetch slots within 3 viewports. fetchMarginPercent: 300, // Render slots within 1 viewports. renderMarginPercent: 100, // Double the above values on mobile, where viewports are smaller // and users tend to scroll faster. mobileScaling: 2.0, }); _this.AMGoogleTag.pubads().collapseEmptyDivs(true); _this.AMGoogleTag.pubads().disableInitialLoad(); _this.AMGoogleTag.pubads().disableInitialLoad(); _this.AMGoogleTag.pubads().setPublisherProvidedId(_this.ppID); if (_this.tags && _this.tags.length > 1 && _this.location != "TVI Player") { _this.AMGoogleTag.pubads().setTargeting("category", _this.tags); } else if (_this.location == "TVI Player" && _this.tags[0] != "tviplayer") { _this.AMGoogleTag.pubads().setTargeting("programa", _this.tags[0]); } _this.AMGoogleTag.enableServices(); console.info("IOLCOMERCIAL: Preloaded ".concat(Object.keys(_this.slotsIndex).length)); _this.hasPreloaded = true; }); }; IOLComercialPlatform.prototype.loadNewPlacements = function () { if (this.hasPreloaded) { var loaded = Object.keys(this.slotsIndex).length; this.loadPlacements(true); console.info("IOLCOMERCIAL: ".concat(Object.keys(this.slotsIndex).length - loaded, " were loaded")); } else { console.info("IOLCOMERCIAL: waiting for preloading."); } }; IOLComercialPlatform.prototype.loadAllPlacementsIntoPage = function () { var _this = this; this.AMGoogleTag.cmd.push(function () { _this.AMGoogleTag.pubads().refresh(); console.info("IOLCOMERCIAL: Ads loaded"); }); }; IOLComercialPlatform.prototype.refresh = function (slotName) { var _this = this; if (!this.isPlatformLoadedCorrectly()) { console.error("IOLCOMERCIAL: No googletag available"); return; } var refreshSlots = this.refreshableSlotsIndex; if (slotName) { var slot = this.slotsIndex[slotName]; refreshSlots = slot ? [slot["AMslot"]] : undefined; } if (refreshSlots) { this.AMGoogleTag.cmd.push(function () { _this.AMGoogleTag.pubads().refresh(refreshSlots); }); console.info("IOLCOMERCIAL: Refreshed with sucess (".concat(slotName ? slotName : "all", ")")); } else { console.error("\"IOLCOMERCIAL: Couldn't refresh (".concat(slotName, " doesn't exists)")); } }; IOLComercialPlatform.prototype.createNewPlacement = function (divID) { var element = document.getElementById(divID); var slotId = element.id; var slotFormat = element["dataset"]["iolComercialFormat"]; var slotPositionStr = element["dataset"]["iolComercialFormatPosition"]; var slotPosition; try { slotPosition = slotPositionStr ? parseInt(slotPositionStr) : undefined; } catch (_a) { slotPosition = undefined; } if (this.checkRestrictions(element)) { var slot = IOLComercialFormatCreator.createSlotModel(slotId, slotFormat, slotPosition); this.addNewPlacement(slot); } else { element.remove(); } }; IOLComercialPlatform.prototype.createSlot = function (slot) { var _this = this; this.AMGoogleTag.cmd.push(function () { var AMslot = undefined; //begin of anchor if (slot.formatName == "ANCHOR") { AMslot = _this.AMGoogleTag.defineOutOfPageSlot("".concat(_this.AMUnit, "/").concat(slot.formatName), _this.AMGoogleTag.enums.OutOfPageFormat.BOTTOM_ANCHOR); } else { AMslot = _this.AMGoogleTag.defineSlot("".concat(_this.AMUnit, "/").concat(slot.formatName), slot.sizes, slot.name); } //Defining Viewports if (slot.viewports) { var mapping_1 = _this.AMGoogleTag.sizeMapping(); slot.viewports.forEach(function (vp) { mapping_1.addSize(vp["viewport"], vp["sizes"]); }); AMslot = AMslot.defineSizeMapping(mapping_1.build()); } AMslot.addService(_this.AMGoogleTag.pubads()).setTargeting("sizes", slot.sizes); //Define Targeting if (slot.key_values) { for (var _i = 0, _a = Object.entries(slot.key_values); _i < _a.length; _i++) { var _b = _a[_i], key = _b[0], value = _b[1]; AMslot = AMslot.setTargeting(key, value); } } slot["AMslot"] = AMslot; _this.slotsIndex[slot.name] = slot; _this.AMGoogleTag.display(slot.name); if (slot.isRefreshable) { _this.refreshableSlotsIndex.push(AMslot); } }); }; IOLComercialPlatform.prototype.loadPlacements = function (shouldDisplay) { var _this = this; while (this.slotQueue.length > 0) this.createSlot(this.slotQueue.pop()); var placement = document.querySelectorAll(".iol-comercial-placement"); placement.forEach(function (element) { var slotId = element.id; var slotFormat = element["dataset"]["iolComercialFormat"]; var slotPositionStr = element["dataset"]["iolComercialFormatPosition"]; var slotPosition; try { slotPosition = slotPositionStr ? parseInt(slotPositionStr) : undefined; } catch (_a) { slotPosition = undefined; } if (_this.checkRestrictions(element)) { var slot = IOLComercialFormatCreator.createSlotModel(slotId, slotFormat, slotPosition); _this.addNewPlacement(slot); element.classList.add("iol-comercial-placement-loaded"); element.classList.remove("iol-comercial-placement"); if (slot.extraCSS) element.classList.add(slot.extraCSS); if (shouldDisplay) _this.refresh(slotId); } else { element.remove(); } }); }; IOLComercialPlatform.prototype.addNewPlacement = function (slot) { if (!slot) return; if (!this.isPlatformLoadedCorrectly()) { this.slotQueue.push(slot); console.error("IOLCOMERCIAL: Added to queue"); return; } if (this.slotsIndex[slot.name]) { console.error("IOLCOMERCIAL: Slot name already exists"); return; } this.createSlot(slot); }; IOLComercialPlatform.prototype.checkRestrictions = function (element) { return this.checkScreenRestriction(element); }; IOLComercialPlatform.prototype.checkScreenRestriction = function (element) { var screenWidth = window.innerWidth; var screenMinRestriction = element["dataset"]["iolComercialMinScreenWitdh"]; var screenMaxRestriction = element["dataset"]["iolComercialMaxScreenWitdh"]; if (!screenMinRestriction && !screenMaxRestriction) return true; try { screenMinRestriction = screenMinRestriction ? parseInt(screenMinRestriction) : undefined; screenMaxRestriction = screenMaxRestriction ? parseInt(screenMaxRestriction) : undefined; if (screenMinRestriction && !screenMaxRestriction && screenWidth > screenMinRestriction) return true; if (screenMaxRestriction && !screenMinRestriction && screenWidth < screenMaxRestriction) return true; if (screenMinRestriction && screenMaxRestriction && screenWidth > screenMinRestriction && screenWidth < screenMaxRestriction) return true; } catch (error) { console.error("IOLCOMERCIAL: Screen Restriction not valid."); } return false; }; return IOLComercialPlatform; }()); var IOLComercial = /** @class */ (function () { function IOLComercial(project, platform, section, contentType, quantcast) { var _this = this; //ADUNIT RULE: code/project/platform/section/contentType/format this.AMCode = "130294768"; this.project = project; this.platform = platform; this.pageSection = section; this.pageContentType = contentType; var AMUnit = "/".concat(this.AMCode, "/").concat(this.project, "/").concat(this.platform, "/").concat(this.pageSection, "/").concat(this.pageContentType); this.iolComercialPlatform = new IOLComercialPlatform(AMUnit); this.iolComercialPlatform.loadDependencies(function () { _this.loadStyle(); _this.iolComercialPlatform.preloadMainPlacements(); var development = document.location.host.includes("localhost") || document.location.host.includes("dev."); if (quantcast && !development) { _this.waitForQuantcast(); } else { if (development) console.info("IOLCOMERCIAL: DEV MODE"); _this.iolComercialPlatform.loadAllPlacementsIntoPage(); } }); } IOLComercial.prototype.refreshSlot = function (slotname) { this.iolComercialPlatform.refresh(slotname); }; IOLComercial.prototype.refreshAllSlots = function () { this.iolComercialPlatform.refresh(undefined); }; IOLComercial.prototype.addNewPlacementByName = function (divID) { this.iolComercialPlatform.createNewPlacement(divID); }; IOLComercial.prototype.loadNewPlacements = function () { this.iolComercialPlatform.loadNewPlacements(); }; IOLComercial.prototype.loadStyle = function () { var head = document.head || document.getElementsByTagName("head")[0]; var style = document.createElement("style"); 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 }"; style.type = "text/css"; style.appendChild(document.createTextNode(css)); head.appendChild(style); }; IOLComercial.prototype.waitForQuantcast = function () { var _this = this; if (window["__tcfapi"]) { window["__tcfapi"]("addEventListener", 2, function (tcData, success) { if (success && tcData.tcString) { _this.iolComercialPlatform.loadAllPlacementsIntoPage(); window["__tcfapi"]("removeEventListener", 2, function (success) { if (success) console.info("IOLCOMERCIAL: Quantcast listener removed"); }, tcData.listenerId); } }); } else { console.error("IOLCOMERCIAL: Quantcast not loaded"); } }; return IOLComercial; }()); window.IOLComercial = IOLComercial;