// ATM Build: 8NGgCxbqlq
"use strict";
var adnMeta = adnMeta || {};
var adn = adn || {};
adn.calls = adn.calls || [];
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
window.atm = window.atm || {};
atm.queue = atm.queue || [];
atm.events = atm.events || {};
atm.data = atm.data || {};
atm.transitData;
atm.browser = atm.browser || {};
atm.ads = atm.ads || {};
atm.ortb2 = atm.ortb2 || {};
atm.containers = atm.containers || {};
atm.containerFunctions = atm.containerFunctions || {};
atm.GLOBALS = atm.GLOBALS || {};
atm.haltedTags = atm.haltedTags || [];
atm.adUnits = atm.adUnits || [];
atm.adUnitAliases = atm.adUnitAliases || [];
atm.prebid = atm.prebid || {
units: [],
mappedUnits: {},
aliases: [],
map: {}
};
atm.eventList = ['consent.change', 'consent.saved', 'event',];
try {
(function (atm, adn, doc, win) {
var CONTAINER_ID = 'h3p_-bMq_';
atm.containerFunctions[CONTAINER_ID] = atm.containerFunctions[CONTAINER_ID] || {}
"use strict";
atm.cookie = (function () {
var pairs = document.cookie.split(";");
var cookies = {};
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i].split("=");
cookies[(pair[0] + '').trim()] = unescape(pair.slice(1).join('='));
}
return cookies;
})();
atm.localStorage = (function () {
var values = {};
var keys = Object.keys(localStorage);
for (var i = 0; i < keys.length; i++) {
try {
values[keys[i]] = JSON.parse(localStorage[keys[i]]);
}
catch (e) {
values[keys[i]] = localStorage[keys[i]];
}
}
return values;
})();
atm.browser = window.location;
atm.browser.consent = (localStorage.getItem('adn-consent') || localStorage.getItem('atm-consent'))
? JSON.parse(localStorage.getItem('adn-consent') || localStorage.getItem('atm-consent'))
: {
time: new Date().getTime(),
tc: false,
given: false,
purposes: [],
specialFeatures: [],
vendors: [],
legIntPurposes: [],
adnuntiusPurposes: [],
stack: false,
};
atm.browser.consent.timeSinceConsent = new Date().getTime() - atm.browser.consent.time;
atm.page = atm.page || {};
atm.page.meta = (function () {
var metaObject = {};
var metaData = document.getElementsByTagName("meta");
var metaDataArray = [].slice.call(metaData);
metaDataArray.forEach(meta => {
var name = meta.name || meta.getAttribute('property') || meta.getAttribute('http-equiv');
if (name)
metaObject[name] = meta.content;
});
return metaObject;
})();
atm.containers[CONTAINER_ID] = {
"id": "h3p_-bMq_",
"data": {
"geo": false,
"gdpr": false,
"cssAdd": true,
"position": "overlay",
"cssOverride": true,
"gdprChoiceButton": true
},
"prebid": {
"loadPrebidJs": false,
"units": {},
"map": {},
"analytics": false,
"requester": {
"system": "adnuntius"
},
"aliases": []
},
"tagType": "legacy",
"cmp": false,
"templates": false,
"variables": [],
"variableMap": {},
"tags": {
"R7pSwNHI7": {
"purposes": [],
"type": "html",
"content": {
"script": "",
"target": "head"
}
},
"SS4rQxh46": {
"purposes": [],
"type": "html",
"content": {
"script": "\n\n",
"target": "head"
}
}
}
}
try {
} catch (e) {
throw new Error('Custom variables are not valid')
}
"use strict";
atm.log = function (type, message, ctx) {
var makeBlock = function (color) {
return 'background: ' + color + '; padding: 2px 10px; border-radius: 2px; color: rgba(0,0,0,.7); border-bottom: 1px solid rgba(0,0,0,.3);border-top: 1px solid rgba(255,255,255,.6);margin-left: 5px;';
};
var logType = 'log';
var eventType = '';
var color = '#79e1ec';
if (type == 'warn' || type == 'error') {
logType = type;
}
else {
eventType = '%c' + type;
}
switch (type) {
case 'event':
color = "#0aff82";
break;
case 'tag':
color = "#ee49d1";
break;
case 'consent':
color = "#af83ff";
break;
}
console[logType]('%cATM' + eventType, makeBlock("#00e6ff"), (eventType != '') ? makeBlock(color) : '', message || '', ctx || '');
};
atm.debug = function (type, message, ctx) {
if (win.location.search.indexOf('atm_debug') > -1) {
atm.log(type, message, ctx);
}
};
"use strict";
atm.utils = {
createUuid: function () {
var dt = new Date().getTime();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (dt + Math.random() * 16) % 16 | 0;
dt = Math.floor(dt / 16);
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
return uuid;
},
getCookie: function (cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
},
replaceTags: function (str, tags) {
var tagNames = Object.keys(tags);
for (var i = 0; i < tagNames.length; i++) {
var tag = tagNames[i];
var pattern = "{{" + tag + "}}";
str = str.replace(new RegExp(pattern, "g"), tags[tag]);
}
return str;
},
replaceTag: function (str, search, replace) {
return str.replace(new RegExp(search, 'g'), replace);
},
remove: function (target) {
var removeElement = target || 'adn-overlay';
atm.utils.forEachClass(removeElement, function (el) {
el.remove();
});
},
addScript: function (src, targetId, fn, options) {
var script = doc.createElement("script");
script.type = "text/javascript";
script.src = src;
if (options && options.async)
script.async = true;
if (options && options.defer)
script.defer = true;
if (options && options.type)
script.type = options.type;
if (options && options.nomodule)
script.noModule = true;
if (script.readyState) { // only required for IE <9
script.onreadystatechange = function () {
if (script.readyState === "loaded" || script.readyState === "complete") {
script.onreadystatechange = null;
fn();
}
};
}
else { //Others
script.onload = function () {
if (fn)
fn();
};
}
if (targetId)
doc.getElementById(targetId).appendChild(script);
else
doc.getElementsByTagName("head")[0].appendChild(script);
},
addImage: function (src, width, height) {
var img = doc.createElement('img');
img.src = src;
if (width)
img.width = width;
if (height)
img.height = height;
doc.getElementsByTagName('body')[0].appendChild(img);
},
addContent: function (content, targetId) {
var node = doc.createElement("DIV");
node.innerHTML = content;
if (targetId) {
var target = doc.getElementById(targetId);
target.innerHTML = '';
target.appendChild(node);
}
else
doc.getElementsByTagName("body")[0].appendChild(node);
},
addCss: function (url) {
var link = doc.createElement("link");
link.href = url;
link.type = "text/css";
link.rel = "stylesheet";
doc.getElementsByTagName("head")[0].appendChild(link);
},
addCssString: function (string) {
var css = string, head = doc.head || doc.getElementsByTagName('head')[0], style = doc.createElement('style');
head.appendChild(style);
style.type = 'text/css';
if (style.styleSheet) {
style.styleSheet.cssText = css;
}
else {
style.appendChild(doc.createTextNode(css));
}
},
forEachClass: function (classname, func) {
var els = doc.getElementsByClassName(classname);
for (var i = 0; i < els.length; i++) {
func(els[i]);
}
},
forEachTag: function (tagName, func) {
var els = doc.getElementsByTagName(tagName);
for (var i = 0; i < els.length; i++) {
func(els[i]);
}
},
merge: function (obj, src) {
for (var key in src) {
if (src.hasOwnProperty(key))
obj[key] = src[key];
}
return obj;
},
isObject: function (item) {
return (item && typeof item === 'object' && !Array.isArray(item));
},
mergeDeep: function (target, source) {
if (atm.utils.isObject(target) && atm.utils.isObject(source)) {
for (const key in source) {
if (atm.utils.isObject(source[key])) {
if (!target[key])
Object.assign(target, {
[key]: {}
});
atm.utils.mergeDeep(target[key], source[key]);
}
else {
Object.assign(target, {
[key]: source[key]
});
}
}
}
return target;
},
flatten: function (obj) {
var returnObj = [];
for (var key in obj) {
returnObj.push(obj[key]);
}
return returnObj;
},
findInArray: function (src, arr) {
return arr.some(function (v) {
return src.indexOf(v) >= 0;
});
},
requestGAM: function (arr) {
window.googletag.cmd.push(function () {
for (let i = 0; i < arr.length; i++) {
if (atm.prebidGoogle && atm.prebidGoogle[arr[i]]) {
atm.prebidGoogle[arr[i]]();
}
}
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
},
runTags: function (localContainerId, tagArray) {
if (tagArray != undefined) {
for (var i = 0; i < tagArray.length; i++) {
try {
var tagId = tagArray[i];
var tag = atm.containers[localContainerId].tags[tagId];
var runable = true;
if (atm.GLOBALS.haltTriggers && tag.purposes) {
if (tag.purposes.length > 0 && !atm.utils.findInArray(atm.GLOBALS.forcedPurposes, tag.purposes)) {
runable = false;
atm.haltedTags.push(tagId);
}
}
else {
if (tag.purposes && tag.purposes.length > 0 && !atm.utils.findInArray(atm.browser.consent.adnuntiusPurposes, tag.purposes)) {
runable = false;
}
}
if (runable) {
atm.debug('tag', 'Running tag: ' + tagId + ' in container: ' + localContainerId);
atm.containerFunctions[localContainerId][tag.type](tag.content);
if (atm.eventList.indexOf('tags.' + tagId) != -1)
atm.dispatch('tags.' + tagId);
}
}
catch (e) {
atm.log('error', e, ': Tag: ' + tag);
}
}
}
},
runTriggers: function (container, type) {
atm.containers[container].triggers[type].forEach(function (fn) {
fn();
});
},
clickElement: function (data) {
if (atm.triggers.click)
atm.triggers.click(data);
},
toggleClass: function (element, className) {
if (element.classList) {
element.classList.toggle(className);
}
else {
var classes = element.className.split(" ");
var i = classes.indexOf(className);
if (i >= 0)
classes.splice(i, 1);
else
classes.push(className);
element.className = classes.join(" ");
}
},
newAjax: function (method, url, func) {
if (win.XDomainRequest) {
// if XDomainRequest is defined and not IE10
if (win.navigator.appVersion.indexOf("MSIE 10") === -1) {
var ajaxIe = new win.XDomainRequest();
ajaxIe.open(method, url);
ajaxIe.contentType = "text/plain";
ajaxIe.onerror = function () { };
ajaxIe.ontimeout = function () { };
ajaxIe.onprogress = function () { };
ajaxIe.timeout = function () { };
ajaxIe.onload = function () { };
ajaxIe.onload = func;
return ajaxIe;
}
}
var ajax = new XMLHttpRequest();
ajax.open(method, url);
ajax.setRequestHeader("Content-Type", "text/plain");
if (func && typeof func === "function") {
ajax.onreadystatechange = func;
}
ajax.onerror = function (e) {
console.log(e);
};
return ajax;
},
ajax: function (method, url, func) {
var ajax = atm.utils.newAjax(method, url, function () {
if (ajax.readyState && ajax.readyState !== 4) {
return false;
}
if (!ajax.status || ajax.status === 200) {
if (func && typeof func === "function") {
func(JSON.parse(ajax.response));
}
else {
atm.log('error', 'Ajax function is not a function');
}
}
else {
atm.log('error', 'Request to URL: ' + url + ' got status ' + ajax.status);
}
});
ajax.send();
},
};
atm.privacy = atm.privacy || undefined;
"use strict";
atm.createPrebidRequest = function (request) {
var prebidUnits = [];
request.adUnits.forEach(function (adUnit) {
var prebidMappedKey = Object.keys(atm.prebid.map).find(auId => auId.includes(adUnit.auId));
var prebidId = atm.prebid.map[prebidMappedKey];
if (prebidId && atm.prebid.mappedUnits[prebidId]) {
prebidUnits.push(atm.prebid.mappedUnits[prebidId]);
}
});
return prebidUnits;
};
atm.requestAds = function (request) {
if (atm.prebid.aliases.length > 0) {
for (let i = 0; i < atm.prebid.aliases.length; i++) {
const element = atm.prebid.aliases[i];
window.pbjs.que.push(function () {
pbjs.aliasBidder(element[1], [element[0]]);
});
}
}
if (atm.prebid.map) {
if (request.adUnits) {
for (let i = 0; i < request.adUnits.length; i++) {
var adUnit = request.adUnits[i];
if (adUnit.refresh) {
adUnit = atm.ads.setPrebidRefresh(adUnit, request);
}
}
}
adn.calls.push(function () {
adn.chbRequest(atm.createPrebidRequest(request), request);
});
}
else {
adn.calls.push(function () {
adn.request(request);
});
}
};
atm.request = atm.request || {};
atm.request.adnuntius = function (callback) {
adn.calls.push(function () {
adn.request({
adUnits: atm.ads.setAdnuntius(atm.adUnits, callback),
});
});
};
atm.request.prebid = function (callback) {
pbjs.que.push(function () {
pbjs.addAdUnits(atm.adUnits);
pbjs.requestBids({
ortb2: atm.ortb2,
bidsBackHandler: function (data) { if (callback) {
callback(data);
}
else
atm.ads.renderPrebidWinners(); },
timeout: 3000
});
});
};
atm.request.refresh = function (auId) {
};
adn.requestAds = atm.requestAds;
"use strict";
atm.ads.adUnitMeta = atm.ads.adUnitMeta || {};
atm.addAdUnits = function (adUnitList) {
atm.utils.merge(atm.adUnits, adUnitList);
};
atm.clearAdUnits = function () {
atm.adUnits = [];
};
atm.removeAdUnitByCodeArray = function (codeArray) {
for (let i = 0; i < codeArray.length; i++) {
atm.removeAdUnitByCode(codeArray[i]);
}
};
atm.removeAdUnitByCode = function (code) {
for (let i = 0; i < atm.adUnits.length; i++) {
if (atm.adUnits[i].code == code) {
atm.adUnits.splice(i, 1);
break;
}
}
};
atm.addOrtb = function (ortbData) {
atm.ortb2 = atm.utils.mergeDeep(atm.ortb2, ortbData);
};
atm.addAlias = function (aliasList) {
atm.adUnitAliases = atm.adUnitAliases.concat(aliasList);
};
atm.prebid.mappedUnits = atm.utils.merge(atm.prebid.mappedUnits, atm.containers[CONTAINER_ID].prebid.units);
atm.prebid.units = atm.utils.merge(atm.prebid.units, atm.utils.flatten(atm.containers[CONTAINER_ID].prebid.units));
atm.prebid.aliases = atm.prebid.aliases.concat(atm.containers[CONTAINER_ID].prebid.aliases);
atm.prebid.map = atm.utils.merge(atm.prebid.map, atm.containers[CONTAINER_ID].prebid.map);
atm.ads.onCallDone = function (matched, callback) {
atm.removeAdUnitByCodeArray(matched);
if (callback)
callback();
};
atm.ads.renderPrebidWinners = function () {
var bids = pbjs.getHighestCpmBids();
var output = [];
for (var i = 0; i < bids.length; i++) {
var b = bids[i];
var iframe = document.createElement('iframe');
iframe.id = b.adId;
iframe.width = b.width;
iframe.height = b.height;
iframe.frameBorder = 'no';
var target = document.getElementById(b.adUnitCode);
target.style.display = 'block';
output.push({
'adunit': b.adUnitCode, 'adId': b.adId, 'bidder': b.bidder,
'time': b.timeToRespond, 'cpm': b.cpm
});
var tag = {
adServerDomain: "",
pubUrl: window.location.href,
targetingMap: {},
hbPb: "adnuntius",
adId: b.adId
};
target.appendChild(iframe);
ucTag.renderAd(iframe.contentWindow.document, tag);
}
if (output.length) {
if (console.table) {
console.table(output);
}
else {
for (var j = 0; j < output.length; j++) {
console.log(output[j]);
}
}
}
else {
console.warn('No prebid winners');
}
};
atm.ads.setAdnuntius = function (adUnits, callback) {
var mappedAliases = {};
var adnAdUnitArray = [];
var matchedAds = [];
var totalAds = [];
var removefromTotal = function (adUnit) {
var position = totalAds.indexOf(adUnit.targetId);
totalAds.splice(position, 1);
if (totalAds.length == 0) {
atm.ads.onCallDone(matchedAds, callback);
}
};
atm.adUnitAliases.forEach(function (aliasItem) {
mappedAliases[aliasItem.alias] = aliasItem.bidder;
});
adUnits.forEach((adUnit) => {
totalAds.push(adUnit.code);
adUnit.bids.forEach(function (bid) {
if (bid.bidder == "adnuntius" || mappedAliases[bid.bidder] == "adnuntius") {
var adnAdunit = {
auId: bid.params.auId,
targetId: adUnit.code,
onNoMatchedAds: function (data) { removefromTotal(data); },
onImpressionResponse: function (data) { matchedAds.push(data.targetId); removefromTotal(data); },
};
if (adUnit.mediaTypes && adUnit.mediaTypes.banner && adUnit.mediaTypes.banner.sizes)
adnAdunit.dimensions = adUnit.mediaTypes.banner.sizes;
if (bid.params.targeting) {
console.log(bid.params.targeting);
}
adnAdUnitArray.push(adnAdunit);
}
});
});
return adnAdUnitArray;
};
atm.ads.setInterval = function (auId, request) {
if (!atm.ads.adUnitMeta[auId].interval) {
atm.ads.adUnitMeta[auId].interval = setInterval(function () {
if (atm.ads.adUnitMeta[auId].refresh.count != 0) {
adn.calls.push(function () {
adn.chbRequest(atm.createPrebidRequest(request), request);
});
atm.ads.adUnitMeta[auId].refresh.count--;
}
else {
clearInterval(atm.ads.adUnitMeta[auId].interval);
}
}, atm.ads.adUnitMeta[auId].refresh.delay * 1000);
}
};
atm.ads.setPrebidRefresh = function (adUnit, request) {
var singleAdUnitRequest = Object.assign({}, request);
delete singleAdUnitRequest.headerBids;
var targetId = (adUnit.targetId) ? ':' + adUnit.targetId : '';
var auId = adUnit.auId + targetId;
var refresh = adUnit.refresh;
if (refresh.count)
refresh.count = refresh.count || 999;
else {
refresh = {
delay: adUnit.refresh,
count: 999,
};
}
var event = refresh.event || 'onViewable';
if (event != 'onViewable' && event != "onVisible")
throw new Error('refresh event needs to be "onViewable" or "onVisible"');
delete adUnit.refresh;
adUnit.clearTarget = true;
atm.ads.adUnitMeta[auId] = atm.ads.adUnitMeta[auId] || {};
atm.ads.adUnitMeta[auId].refresh = refresh;
atm.ads.adUnitMeta[auId].refreshFunction = function () {
singleAdUnitRequest.adUnits = [adUnit];
atm.ads.setInterval(auId, singleAdUnitRequest);
};
adUnit[event] = atm.ads.adUnitMeta[auId].refreshFunction;
return adUnit;
};
"use strict";
atm.addListener = function (name, callback) {
if (atm.eventList.indexOf(name) == -1) {
atm.eventList.push(name);
atm.events[name] = new CustomEvent(name, { bubbles: true });
}
document.addEventListener(name, function () { if (callback)
callback(atm.transitData); });
};
atm.dispatch = function (name, data) {
atm.debug(name, data);
atm.transitData = data;
document.dispatchEvent(atm.events[name]);
};
"use strict";
atm.containerFunctions[CONTAINER_ID].html = function (data) {
try {
var target = (data.target || data.target != '')
? document.querySelector(data.target)
: document.body;
var range = document.createRange();
range.selectNode(document.getElementsByTagName("body").item(0));
var documentFragment = range.createContextualFragment(data.script);
if (target)
target.appendChild(documentFragment);
}
catch (e) {
atm.log('error', 'Custom html ' + e.message);
}
};
atm.addListener("pageview.h3p_-bMq_", function(eventData){
if( (true) ) atm.utils.runTags('h3p_-bMq_', [])
});
atm.addListener("pageload.h3p_-bMq_", function(eventData){
if( (true) ) atm.utils.runTags('h3p_-bMq_', ["R7pSwNHI7","SS4rQxh46"])
});
atm.utils.addScript("https://cdn.adnuntius.com/adn.js",false,false,{async:true});
if(atm.containers[CONTAINER_ID].prebid){
if(atm.containers[CONTAINER_ID].prebid.config && atm.containers[CONTAINER_ID].prebid.config.custom){
try {
new Function(atm.containers[CONTAINER_ID].prebid.config.custom)();
} catch (e) {
atm.log('error', 'Custom prebid script malformed: ' + e.message, 'Custom Prebid')
}
}
if(atm.containers[CONTAINER_ID].prebid.loadPrebidJs){atm.utils.addScript("https://tags.adnuntius.com/pb/prebid.js")}
}
"use strict";
(function () {
var executeQueue = function () {
try {
var queItem;
while (queItem = atm.queue.shift()) {
if (typeof queItem == 'function')
queItem();
}
}
catch (e) {
atm.log('error', e, 'queue handler');
}
};
win.setTimeout(executeQueue, 25);
atm.queue.push = function () {
Array.prototype.push.apply(this, arguments);
win.setTimeout(executeQueue, 1);
return this.length;
};
executeQueue();
})();
if(document.onreadystatechange) {
document.onreadystatechange = () => {
if( atm.eventList.indexOf('pageload.' + CONTAINER_ID) != -1){
atm.dispatch('pageload.' + CONTAINER_ID)
}
}
}else {
if (document.readyState === "complete") {
if( atm.eventList.indexOf('pageload.' + CONTAINER_ID) != -1){
atm.dispatch('pageload.' + CONTAINER_ID)
}
} else {
window.addEventListener("load", function () {
if( atm.eventList.indexOf('pageload.' + CONTAINER_ID) != -1){
atm.dispatch('pageload.' + CONTAINER_ID)
}
});
}
};
if (atm.eventList.indexOf('pageview.' + CONTAINER_ID) > -1) atm.dispatch('pageview.' + CONTAINER_ID);
})(atm, adn, document, window);
} catch (e) {
console.log('error', e);
}