This commit is contained in:
SukkaBot
2023-12-19 14:59:27 +00:00
parent 399ac39a20
commit 89958bd640
8 changed files with 843 additions and 474 deletions

View File

@@ -1,89 +1,124 @@
(function () {
'use strict';
// https://developers.google.com/analytics/devguides/collection/analyticsjs/
const noopfn = function () {
};
//
const Tracker = function () {
};
const p = Tracker.prototype;
p.get = noopfn;
p.set = noopfn;
p.send = noopfn;
//
const w = window;
const gaName = w.GoogleAnalyticsObject || 'ga';
const gaQueue = w[gaName];
const ga = function (...args) {
const len = args.length;
if (len === 0) { return; }
let fn;
const a = args[len - 1];
if (typeof a === 'object' && typeof a.hitCallback === 'function') {
fn = a.hitCallback;
} else if (typeof a === 'function') {
fn = () => { a(ga.create()); };
} else {
const pos = args.indexOf('hitCallback');
if (pos !== -1 && typeof args[pos + 1] === 'function') {
fn = args[pos + 1];
}
(function(source, args) {
function GoogleAnalytics(source) {
var Tracker = function Tracker() {};
var proto = Tracker.prototype;
proto.get = noopFunc;
proto.set = noopFunc;
proto.send = noopFunc;
var googleAnalyticsName = window.GoogleAnalyticsObject || "ga";
function ga(a) {
var len = arguments.length;
if (len === 0) {
return;
}
var lastArg = arguments[len - 1];
var replacer;
if (lastArg instanceof Object && lastArg !== null && typeof lastArg.hitCallback === "function") {
replacer = lastArg.hitCallback;
} else if (typeof lastArg === "function") {
replacer = function replacer() {
lastArg(ga.create());
};
}
try {
setTimeout(replacer, 1);
} catch (ex) {}
}
ga.create = function() {
return new Tracker;
};
ga.getByName = function() {
return new Tracker;
};
ga.getAll = function() {
return [ new Tracker ];
};
ga.remove = noopFunc;
ga.loaded = true;
window[googleAnalyticsName] = ga;
var _window = window, dataLayer = _window.dataLayer, google_optimize = _window.google_optimize;
if (dataLayer instanceof Object === false) {
return;
}
if (dataLayer.hide instanceof Object && typeof dataLayer.hide.end === "function") {
dataLayer.hide.end();
}
var handleCallback = function handleCallback(dataObj, funcName) {
if (dataObj && typeof dataObj[funcName] === "function") {
setTimeout(dataObj[funcName]);
}
};
if (typeof dataLayer.push === "function") {
dataLayer.push = function(data) {
if (data instanceof Object) {
handleCallback(data, "eventCallback");
for (var key in data) {
handleCallback(data[key], "event_callback");
}
if (!data.hasOwnProperty("eventCallback") && !data.hasOwnProperty("eventCallback")) {
[].push.call(window.dataLayer, data);
}
}
if (Array.isArray(data)) {
data.forEach((function(arg) {
handleCallback(arg, "callback");
}));
}
return noopFunc;
};
}
if (google_optimize instanceof Object && typeof google_optimize.get === "function") {
var googleOptimizeWrapper = {
get: noopFunc
};
window.google_optimize = googleOptimizeWrapper;
}
hit(source);
}
if (typeof fn !== 'function') { return; }
function hit(source) {
if (source.verbose !== true) {
return;
}
try {
var log = console.log.bind(console);
var trace = console.trace.bind(console);
var prefix = source.ruleText || "";
if (source.domainName) {
var AG_SCRIPTLET_MARKER = "#%#//";
var UBO_SCRIPTLET_MARKER = "##+js";
var ruleStartIndex;
if (source.ruleText.includes(AG_SCRIPTLET_MARKER)) {
ruleStartIndex = source.ruleText.indexOf(AG_SCRIPTLET_MARKER);
} else if (source.ruleText.includes(UBO_SCRIPTLET_MARKER)) {
ruleStartIndex = source.ruleText.indexOf(UBO_SCRIPTLET_MARKER);
}
var rulePart = source.ruleText.slice(ruleStartIndex);
prefix = "".concat(source.domainName).concat(rulePart);
}
log("".concat(prefix, " trace start"));
if (trace) {
trace();
}
log("".concat(prefix, " trace end"));
} catch (e) {}
if (typeof window.__debug === "function") {
window.__debug(source);
}
}
function noopFunc() {}
function noopNull() {
return null;
}
function noopArray() {
return [];
}
const updatedArgs = args ? [].concat(source).concat(args) : [ source ];
try {
fn();
} catch {
GoogleAnalytics.apply(this, updatedArgs);
} catch (e) {
console.log(e);
}
};
ga.create = function () {
return new Tracker();
};
ga.getByName = function () {
return new Tracker();
};
ga.getAll = function () {
return [new Tracker()];
};
ga.remove = noopfn;
// https://github.com/uBlockOrigin/uAssets/issues/2107
ga.loaded = true;
w[gaName] = ga;
// https://github.com/gorhill/uBlock/issues/3075
const dl = w.dataLayer;
if (typeof dl === 'object') {
if (typeof dl.hide === 'object' && typeof dl.hide.end === 'function') {
dl.hide.end();
dl.hide.end = () => { };
}
if (typeof dl.push === 'function') {
const doCallback = function (item) {
if (typeof item === 'object' === false) { return; }
if (typeof item.eventCallback !== 'function') { return; }
// eslint-disable-next-line sukka/prefer-timer-id -- deliberate use of setTimeout
setTimeout(item.eventCallback, 1);
item.eventCallback = () => { };
};
dl.push = new Proxy(dl.push, {
apply(target, thisArg, args) {
doCallback(args[0]);
return Reflect.apply(target, thisArg, args);
}
});
if (Array.isArray(dl)) {
const q = dl.slice();
for (const item of q) {
doCallback(item);
}
}
}
}
// empty ga queue
if (typeof gaQueue === 'function' && Array.isArray(gaQueue.q)) {
const q = gaQueue.q.slice();
gaQueue.q.length = 0;
for (const entry of q) {
ga(...entry);
}
}
}());
})({
name: "google-analytics",
args: []
}, []);

View File

@@ -1,109 +1,130 @@
(function () {
'use strict';
const noopfn = function () {
};
//
const Gaq = function () {
};
Gaq.prototype.Na = noopfn;
Gaq.prototype.O = noopfn;
Gaq.prototype.Sa = noopfn;
Gaq.prototype.Ta = noopfn;
Gaq.prototype.Va = noopfn;
Gaq.prototype._createAsyncTracker = noopfn;
Gaq.prototype._getAsyncTracker = noopfn;
Gaq.prototype._getPlugin = noopfn;
Gaq.prototype.push = function (a) {
if (typeof a === 'function') {
a(); return;
(function(source, args) {
function GoogleAnalyticsGa(source) {
function Gaq() {}
Gaq.prototype.Na = noopFunc;
Gaq.prototype.O = noopFunc;
Gaq.prototype.Sa = noopFunc;
Gaq.prototype.Ta = noopFunc;
Gaq.prototype.Va = noopFunc;
Gaq.prototype._createAsyncTracker = noopFunc;
Gaq.prototype._getAsyncTracker = noopFunc;
Gaq.prototype._getPlugin = noopFunc;
Gaq.prototype.push = function(data) {
if (typeof data === "function") {
data();
return;
}
if (Array.isArray(data) === false) {
return;
}
if (typeof data[0] === "string" && /(^|\.)_link$/.test(data[0]) && typeof data[1] === "string") {
window.location.assign(data[1]);
}
if (data[0] === "_set" && data[1] === "hitCallback" && typeof data[2] === "function") {
data[2]();
}
};
var gaq = new Gaq;
var asyncTrackers = window._gaq || [];
if (Array.isArray(asyncTrackers)) {
while (asyncTrackers[0]) {
gaq.push(asyncTrackers.shift());
}
}
window._gaq = gaq.qf = gaq;
function Gat() {}
var api = [ "_addIgnoredOrganic", "_addIgnoredRef", "_addItem", "_addOrganic", "_addTrans", "_clearIgnoredOrganic", "_clearIgnoredRef", "_clearOrganic", "_cookiePathCopy", "_deleteCustomVar", "_getName", "_setAccount", "_getAccount", "_getClientInfo", "_getDetectFlash", "_getDetectTitle", "_getLinkerUrl", "_getLocalGifPath", "_getServiceMode", "_getVersion", "_getVisitorCustomVar", "_initData", "_link", "_linkByPost", "_setAllowAnchor", "_setAllowHash", "_setAllowLinker", "_setCampContentKey", "_setCampMediumKey", "_setCampNameKey", "_setCampNOKey", "_setCampSourceKey", "_setCampTermKey", "_setCampaignCookieTimeout", "_setCampaignTrack", "_setClientInfo", "_setCookiePath", "_setCookiePersistence", "_setCookieTimeout", "_setCustomVar", "_setDetectFlash", "_setDetectTitle", "_setDomainName", "_setLocalGifPath", "_setLocalRemoteServerMode", "_setLocalServerMode", "_setReferrerOverride", "_setRemoteServerMode", "_setSampleRate", "_setSessionTimeout", "_setSiteSpeedSampleRate", "_setSessionCookieTimeout", "_setVar", "_setVisitorCookieTimeout", "_trackEvent", "_trackPageLoadTime", "_trackPageview", "_trackSocial", "_trackTiming", "_trackTrans", "_visitCode" ];
var tracker = api.reduce((function(res, funcName) {
res[funcName] = noopFunc;
return res;
}), {});
tracker._getLinkerUrl = function(a) {
return a;
};
tracker._link = function(url) {
if (typeof url !== "string") {
return;
}
try {
window.location.assign(url);
} catch (e) {
logMessage(source, e);
}
};
Gat.prototype._anonymizeIP = noopFunc;
Gat.prototype._createTracker = noopFunc;
Gat.prototype._forceSSL = noopFunc;
Gat.prototype._getPlugin = noopFunc;
Gat.prototype._getTracker = function() {
return tracker;
};
Gat.prototype._getTrackerByName = function() {
return tracker;
};
Gat.prototype._getTrackers = noopFunc;
Gat.prototype.aa = noopFunc;
Gat.prototype.ab = noopFunc;
Gat.prototype.hb = noopFunc;
Gat.prototype.la = noopFunc;
Gat.prototype.oa = noopFunc;
Gat.prototype.pa = noopFunc;
Gat.prototype.u = noopFunc;
var gat = new Gat;
window._gat = gat;
hit(source);
}
if (Array.isArray(a) === false) { return; }
// https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory#_gat.GA_Tracker_._link
if (
typeof a[0] === 'string'
&& /(^|\.)_link$/.test(a[0])
&& typeof a[1] === 'string'
) {
try {
window.location.assign(a[1]);
} catch {
}
function hit(source) {
if (source.verbose !== true) {
return;
}
try {
var log = console.log.bind(console);
var trace = console.trace.bind(console);
var prefix = source.ruleText || "";
if (source.domainName) {
var AG_SCRIPTLET_MARKER = "#%#//";
var UBO_SCRIPTLET_MARKER = "##+js";
var ruleStartIndex;
if (source.ruleText.includes(AG_SCRIPTLET_MARKER)) {
ruleStartIndex = source.ruleText.indexOf(AG_SCRIPTLET_MARKER);
} else if (source.ruleText.includes(UBO_SCRIPTLET_MARKER)) {
ruleStartIndex = source.ruleText.indexOf(UBO_SCRIPTLET_MARKER);
}
var rulePart = source.ruleText.slice(ruleStartIndex);
prefix = "".concat(source.domainName).concat(rulePart);
}
log("".concat(prefix, " trace start"));
if (trace) {
trace();
}
log("".concat(prefix, " trace end"));
} catch (e) {}
if (typeof window.__debug === "function") {
window.__debug(source);
}
}
if (a[0] === '_set' && a[1] === 'hitCallback' && typeof a[2] === 'function') {
a[2]();
function noopFunc() {}
function logMessage(source, message) {
var forced = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var convertMessageToString = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
var name = source.name, verbose = source.verbose;
if (!forced && !verbose) {
return;
}
var nativeConsole = console.log;
if (!convertMessageToString) {
nativeConsole("".concat(name, ":"), message);
return;
}
nativeConsole("".concat(name, ": ").concat(message));
}
};
//
const tracker = (function () {
const out = {};
const api = [
'_addIgnoredOrganic _addIgnoredRef _addItem _addOrganic',
'_addTrans _clearIgnoredOrganic _clearIgnoredRef _clearOrganic',
'_cookiePathCopy _deleteCustomVar _getName _setAccount',
'_getAccount _getClientInfo _getDetectFlash _getDetectTitle',
'_getLinkerUrl _getLocalGifPath _getServiceMode _getVersion',
'_getVisitorCustomVar _initData _linkByPost',
'_setAllowAnchor _setAllowHash _setAllowLinker _setCampContentKey',
'_setCampMediumKey _setCampNameKey _setCampNOKey _setCampSourceKey',
'_setCampTermKey _setCampaignCookieTimeout _setCampaignTrack _setClientInfo',
'_setCookiePath _setCookiePersistence _setCookieTimeout _setCustomVar',
'_setDetectFlash _setDetectTitle _setDomainName _setLocalGifPath',
'_setLocalRemoteServerMode _setLocalServerMode _setReferrerOverride _setRemoteServerMode',
'_setSampleRate _setSessionTimeout _setSiteSpeedSampleRate _setSessionCookieTimeout',
'_setVar _setVisitorCookieTimeout _trackEvent _trackPageLoadTime',
'_trackPageview _trackSocial _trackTiming _trackTrans',
'_visitCode'
].join(' ').split(/\s+/);
for (const method of api) {
out[method] = noopfn;
const updatedArgs = args ? [].concat(source).concat(args) : [ source ];
try {
GoogleAnalyticsGa.apply(this, updatedArgs);
} catch (e) {
console.log(e);
}
out._getLinkerUrl = function (a) {
return a;
};
// https://github.com/AdguardTeam/Scriptlets/issues/154
out._link = function (a) {
if (typeof a !== 'string') { return; }
try {
window.location.assign(a);
} catch {
}
};
return out;
}());
//
const Gat = function () {
};
Gat.prototype._anonymizeIP = noopfn;
Gat.prototype._createTracker = noopfn;
Gat.prototype._forceSSL = noopfn;
Gat.prototype._getPlugin = noopfn;
Gat.prototype._getTracker = function () {
return tracker;
};
Gat.prototype._getTrackerByName = function () {
return tracker;
};
Gat.prototype._getTrackers = noopfn;
Gat.prototype.aa = noopfn;
Gat.prototype.ab = noopfn;
Gat.prototype.hb = noopfn;
Gat.prototype.la = noopfn;
Gat.prototype.oa = noopfn;
Gat.prototype.pa = noopfn;
Gat.prototype.u = noopfn;
const gat = new Gat();
window._gat = gat;
//
const gaq = new Gaq();
(function () {
const aa = window._gaq || [];
if (Array.isArray(aa)) {
while (aa[0]) {
gaq.push(aa.shift());
}
}
}());
gaq.qf = gaq;
window._gaq = gaq;
}());
})({
name: "google-analytics-ga",
args: []
}, []);

View File

@@ -1,32 +1,95 @@
(function () {
'use strict';
const init = () => {
window.adsbygoogle = {
loaded: true,
push() {
}
};
const phs = document.querySelectorAll('.adsbygoogle');
const css = 'height:1px!important;max-height:1px!important;max-width:1px!important;width:1px!important;';
for (let i = 0; i < phs.length; i++) {
const id = `aswift_${i}`;
if (document.querySelector(`iframe#${id}`) !== null) { continue; }
const fr = document.createElement('iframe');
fr.id = id;
fr.style = css;
const cfr = document.createElement('iframe');
cfr.id = `google_ads_frame${i}`;
fr.appendChild(cfr);
phs[i].appendChild(fr);
(function(source, args) {
function GoogleSyndicationAdsByGoogle(source) {
window.adsbygoogle = {
loaded: true,
push(arg) {
if (typeof this.length === "undefined") {
this.length = 0;
this.length += 1;
}
if (arg !== null && arg instanceof Object && arg.constructor.name === "Object") {
for (var _i = 0, _Object$keys = Object.keys(arg); _i < _Object$keys.length; _i++) {
var key = _Object$keys[_i];
if (typeof arg[key] === "function") {
try {
arg[key].call(this, {});
} catch (_unused) {}
}
}
}
}
};
var adElems = document.querySelectorAll(".adsbygoogle");
var css = "height:1px!important;max-height:1px!important;max-width:1px!important;width:1px!important;";
var statusAttrName = "data-adsbygoogle-status";
var ASWIFT_IFRAME_MARKER = "aswift_";
var GOOGLE_ADS_IFRAME_MARKER = "google_ads_iframe_";
var executed = false;
for (var i = 0; i < adElems.length; i += 1) {
var adElemChildNodes = adElems[i].childNodes;
var childNodesQuantity = adElemChildNodes.length;
var areIframesDefined = false;
if (childNodesQuantity > 0) {
areIframesDefined = childNodesQuantity === 2 && adElemChildNodes[0].nodeName.toLowerCase() === "iframe" && adElemChildNodes[0].id.includes(ASWIFT_IFRAME_MARKER) && adElemChildNodes[1].nodeName.toLowerCase() === "iframe" && adElemChildNodes[1].id.includes(GOOGLE_ADS_IFRAME_MARKER);
}
if (!areIframesDefined) {
adElems[i].setAttribute(statusAttrName, "done");
var aswiftIframe = document.createElement("iframe");
aswiftIframe.id = "".concat(ASWIFT_IFRAME_MARKER).concat(i);
aswiftIframe.style = css;
adElems[i].appendChild(aswiftIframe);
var innerAswiftIframe = document.createElement("iframe");
aswiftIframe.contentWindow.document.body.appendChild(innerAswiftIframe);
var googleadsIframe = document.createElement("iframe");
googleadsIframe.id = "".concat(GOOGLE_ADS_IFRAME_MARKER).concat(i);
googleadsIframe.style = css;
adElems[i].appendChild(googleadsIframe);
var innerGoogleadsIframe = document.createElement("iframe");
googleadsIframe.contentWindow.document.body.appendChild(innerGoogleadsIframe);
executed = true;
}
}
if (executed) {
hit(source);
}
}
};
if (
document.querySelectorAll('.adsbygoogle').length === 0
&& document.readyState === 'loading'
) {
window.addEventListener('DOMContentLoaded', init, { once: true });
} else {
init();
}
}());
function hit(source) {
if (source.verbose !== true) {
return;
}
try {
var log = console.log.bind(console);
var trace = console.trace.bind(console);
var prefix = source.ruleText || "";
if (source.domainName) {
var AG_SCRIPTLET_MARKER = "#%#//";
var UBO_SCRIPTLET_MARKER = "##+js";
var ruleStartIndex;
if (source.ruleText.includes(AG_SCRIPTLET_MARKER)) {
ruleStartIndex = source.ruleText.indexOf(AG_SCRIPTLET_MARKER);
} else if (source.ruleText.includes(UBO_SCRIPTLET_MARKER)) {
ruleStartIndex = source.ruleText.indexOf(UBO_SCRIPTLET_MARKER);
}
var rulePart = source.ruleText.slice(ruleStartIndex);
prefix = "".concat(source.domainName).concat(rulePart);
}
log("".concat(prefix, " trace start"));
if (trace) {
trace();
}
log("".concat(prefix, " trace end"));
} catch (e) {}
if (typeof window.__debug === "function") {
window.__debug(source);
}
}
const updatedArgs = args ? [].concat(source).concat(args) : [ source ];
try {
GoogleSyndicationAdsByGoogle.apply(this, updatedArgs);
} catch (e) {
console.log(e);
}
})({
name: "googlesyndication-adsbygoogle",
args: []
}, []);

View File

@@ -1,133 +1,429 @@
(function () {
'use strict';
// https://developers.google.com/doubleclick-gpt/reference
const noopfn = function () {
}.bind();
const noopthisfn = function () {
return this;
};
const noopnullfn = function () {
return null;
};
const nooparrayfn = function () {
return [];
};
const noopstrfn = function () {
return '';
};
//
const companionAdsService = {
addEventListener: noopthisfn,
enableSyncLoading: noopfn,
setRefreshUnfilledSlots: noopfn
};
const contentService = {
addEventListener: noopthisfn,
setContent: noopfn
};
const PassbackSlot = function () {
};
let p = PassbackSlot.prototype;
p.display = noopfn;
p.get = noopnullfn;
p.set = noopthisfn;
p.setClickUrl = noopthisfn;
p.setTagForChildDirectedTreatment = noopthisfn;
p.setTargeting = noopthisfn;
p.updateTargetingFromMap = noopthisfn;
const pubAdsService = {
addEventListener: noopthisfn,
clear: noopfn,
clearCategoryExclusions: noopthisfn,
clearTagForChildDirectedTreatment: noopthisfn,
clearTargeting: noopthisfn,
collapseEmptyDivs: noopfn,
defineOutOfPagePassback() { return new PassbackSlot(); },
definePassback() { return new PassbackSlot(); },
disableInitialLoad: noopfn,
display: noopfn,
enableAsyncRendering: noopfn,
enableSingleRequest: noopfn,
enableSyncRendering: noopfn,
enableVideoAds: noopfn,
get: noopnullfn,
getAttributeKeys: nooparrayfn,
getTargeting: noopfn,
getTargetingKeys: nooparrayfn,
getSlots: nooparrayfn,
refresh: noopfn,
removeEventListener: noopfn,
set: noopthisfn,
setCategoryExclusion: noopthisfn,
setCentering: noopfn,
setCookieOptions: noopthisfn,
setForceSafeFrame: noopthisfn,
setLocation: noopthisfn,
setPublisherProvidedId: noopthisfn,
setPrivacySettings: noopthisfn,
setRequestNonPersonalizedAds: noopthisfn,
setSafeFrameConfig: noopthisfn,
setTagForChildDirectedTreatment: noopthisfn,
setTargeting: noopthisfn,
setVideoContent: noopthisfn,
updateCorrelator: noopfn
};
const SizeMappingBuilder = function () {
};
p = SizeMappingBuilder.prototype;
p.addSize = noopthisfn;
p.build = noopnullfn;
const Slot = function () {
};
p = Slot.prototype;
p.addService = noopthisfn;
p.clearCategoryExclusions = noopthisfn;
p.clearTargeting = noopthisfn;
p.defineSizeMapping = noopthisfn;
p.get = noopnullfn;
p.getAdUnitPath = nooparrayfn;
p.getAttributeKeys = nooparrayfn;
p.getCategoryExclusions = nooparrayfn;
p.getDomId = noopstrfn;
p.getResponseInformation = noopnullfn;
p.getSlotElementId = noopstrfn;
p.getSlotId = noopthisfn;
p.getTargeting = nooparrayfn;
p.getTargetingKeys = nooparrayfn;
p.set = noopthisfn;
p.setCategoryExclusion = noopthisfn;
p.setClickUrl = noopthisfn;
p.setCollapseEmptyDiv = noopthisfn;
p.setTargeting = noopthisfn;
p.updateTargetingFromMap = noopthisfn;
//
const gpt = window.googletag || {};
const cmd = gpt.cmd || [];
gpt.apiReady = true;
gpt.cmd = [];
gpt.cmd.push = function (a) {
try {
a();
} catch {
(function(source, args) {
function GoogleTagServicesGpt(source) {
var slots = new Map;
var slotsById = new Map;
var slotsPerPath = new Map;
var slotCreatives = new Map;
var eventCallbacks = new Map;
var gTargeting = new Map;
var addEventListener = function addEventListener(name, listener) {
if (!eventCallbacks.has(name)) {
eventCallbacks.set(name, new Set);
}
eventCallbacks.get(name).add(listener);
return this;
};
var removeEventListener = function removeEventListener(name, listener) {
if (eventCallbacks.has(name)) {
return eventCallbacks.get(name).delete(listener);
}
return false;
};
var fireSlotEvent = function fireSlotEvent(name, slot) {
return new Promise((function(resolve) {
requestAnimationFrame((function() {
var size = [ 0, 0 ];
var callbacksSet = eventCallbacks.get(name) || [];
var callbackArray = Array.from(callbacksSet);
for (var i = 0; i < callbackArray.length; i += 1) {
callbackArray[i]({
isEmpty: true,
size: size,
slot: slot
});
}
resolve();
}));
}));
};
var emptySlotElement = function emptySlotElement(slot) {
var node = document.getElementById(slot.getSlotElementId());
while (node !== null && node !== void 0 && node.lastChild) {
node.lastChild.remove();
}
};
var recreateIframeForSlot = function recreateIframeForSlot(slot) {
var _document$getElementB;
var eid = "google_ads_iframe_".concat(slot.getId());
(_document$getElementB = document.getElementById(eid)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove();
var node = document.getElementById(slot.getSlotElementId());
if (node) {
var f = document.createElement("iframe");
f.id = eid;
f.srcdoc = "<body></body>";
f.style = "position:absolute; width:0; height:0; left:0; right:0; z-index:-1; border:0";
f.setAttribute("width", 0);
f.setAttribute("height", 0);
f.setAttribute("data-load-complete", true);
f.setAttribute("data-google-container-id", true);
f.setAttribute("sandbox", "");
node.appendChild(f);
}
};
var displaySlot = function displaySlot(slot) {
if (!slot) {
return;
}
var id = slot.getSlotElementId();
if (!document.getElementById(id)) {
return;
}
var parent = document.getElementById(id);
if (parent) {
parent.appendChild(document.createElement("div"));
}
emptySlotElement(slot);
recreateIframeForSlot(slot);
fireSlotEvent("slotRenderEnded", slot);
fireSlotEvent("slotRequested", slot);
fireSlotEvent("slotResponseReceived", slot);
fireSlotEvent("slotOnload", slot);
fireSlotEvent("impressionViewable", slot);
};
var companionAdsService = {
addEventListener: addEventListener,
removeEventListener: removeEventListener,
enableSyncLoading: noopFunc,
setRefreshUnfilledSlots: noopFunc,
getSlots: noopArray
};
var contentService = {
addEventListener: addEventListener,
removeEventListener: removeEventListener,
setContent: noopFunc
};
function PassbackSlot() {}
PassbackSlot.prototype.display = noopFunc;
PassbackSlot.prototype.get = noopNull;
PassbackSlot.prototype.set = noopThis;
PassbackSlot.prototype.setClickUrl = noopThis;
PassbackSlot.prototype.setTagForChildDirectedTreatment = noopThis;
PassbackSlot.prototype.setTargeting = noopThis;
PassbackSlot.prototype.updateTargetingFromMap = noopThis;
function SizeMappingBuilder() {}
SizeMappingBuilder.prototype.addSize = noopThis;
SizeMappingBuilder.prototype.build = noopNull;
var getTargetingValue = function getTargetingValue(v) {
if (typeof v === "string") {
return [ v ];
}
try {
return Array.prototype.flat.call(v);
} catch (_unused) {}
return [];
};
var updateTargeting = function updateTargeting(targeting, map) {
if (typeof map === "object") {
for (var key in map) {
if (Object.prototype.hasOwnProperty.call(map, key)) {
targeting.set(key, getTargetingValue(map[key]));
}
}
}
};
var defineSlot = function defineSlot(adUnitPath, creatives, optDiv) {
if (slotsById.has(optDiv)) {
var _document$getElementB2;
(_document$getElementB2 = document.getElementById(optDiv)) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.remove();
return slotsById.get(optDiv);
}
var attributes = new Map;
var targeting = new Map;
var exclusions = new Set;
var response = {
advertiserId: undefined,
campaignId: undefined,
creativeId: undefined,
creativeTemplateId: undefined,
lineItemId: undefined
};
var sizes = [ {
getHeight: function getHeight() {
return 2;
},
getWidth: function getWidth() {
return 2;
}
} ];
var num = (slotsPerPath.get(adUnitPath) || 0) + 1;
slotsPerPath.set(adUnitPath, num);
var id = "".concat(adUnitPath, "_").concat(num);
var clickUrl = "";
var collapseEmptyDiv = null;
var services = new Set;
var slot = {
addService(e) {
services.add(e);
return slot;
},
clearCategoryExclusions: noopThis,
clearTargeting(k) {
if (k === undefined) {
targeting.clear();
} else {
targeting.delete(k);
}
},
defineSizeMapping(mapping) {
slotCreatives.set(optDiv, mapping);
return this;
},
get: function get(k) {
return attributes.get(k);
},
getAdUnitPath: function getAdUnitPath() {
return adUnitPath;
},
getAttributeKeys: function getAttributeKeys() {
return Array.from(attributes.keys());
},
getCategoryExclusions: function getCategoryExclusions() {
return Array.from(exclusions);
},
getClickUrl: function getClickUrl() {
return clickUrl;
},
getCollapseEmptyDiv: function getCollapseEmptyDiv() {
return collapseEmptyDiv;
},
getContentUrl: function getContentUrl() {
return "";
},
getDivStartsCollapsed: function getDivStartsCollapsed() {
return null;
},
getDomId: function getDomId() {
return optDiv;
},
getEscapedQemQueryId: function getEscapedQemQueryId() {
return "";
},
getFirstLook: function getFirstLook() {
return 0;
},
getId: function getId() {
return id;
},
getHtml: function getHtml() {
return "";
},
getName: function getName() {
return id;
},
getOutOfPage: function getOutOfPage() {
return false;
},
getResponseInformation: function getResponseInformation() {
return response;
},
getServices: function getServices() {
return Array.from(services);
},
getSizes: function getSizes() {
return sizes;
},
getSlotElementId: function getSlotElementId() {
return optDiv;
},
getSlotId: function getSlotId() {
return slot;
},
getTargeting: function getTargeting(k) {
return targeting.get(k) || gTargeting.get(k) || [];
},
getTargetingKeys: function getTargetingKeys() {
return Array.from(new Set(Array.of(...gTargeting.keys(), ...targeting.keys())));
},
getTargetingMap: function getTargetingMap() {
return Object.assign(Object.fromEntries(gTargeting.entries()), Object.fromEntries(targeting.entries()));
},
set(k, v) {
attributes.set(k, v);
return slot;
},
setCategoryExclusion(e) {
exclusions.add(e);
return slot;
},
setClickUrl(u) {
clickUrl = u;
return slot;
},
setCollapseEmptyDiv(v) {
collapseEmptyDiv = !!v;
return slot;
},
setSafeFrameConfig: noopThis,
setTagForChildDirectedTreatment: noopThis,
setTargeting(k, v) {
targeting.set(k, getTargetingValue(v));
return slot;
},
toString: function toString() {
return id;
},
updateTargetingFromMap(map) {
updateTargeting(targeting, map);
return slot;
}
};
slots.set(adUnitPath, slot);
slotsById.set(optDiv, slot);
slotCreatives.set(optDiv, creatives);
return slot;
};
var pubAdsService = {
addEventListener: addEventListener,
removeEventListener: removeEventListener,
clear: noopFunc,
clearCategoryExclusions: noopThis,
clearTagForChildDirectedTreatment: noopThis,
clearTargeting(k) {
if (k === undefined) {
gTargeting.clear();
} else {
gTargeting.delete(k);
}
},
collapseEmptyDivs: noopFunc,
defineOutOfPagePassback() {
return new PassbackSlot;
},
definePassback() {
return new PassbackSlot;
},
disableInitialLoad: noopFunc,
display: noopFunc,
enableAsyncRendering: noopFunc,
enableLazyLoad: noopFunc,
enableSingleRequest: noopFunc,
enableSyncRendering: noopFunc,
enableVideoAds: noopFunc,
get: noopNull,
getAttributeKeys: noopArray,
getTargeting: noopArray,
getTargetingKeys: noopArray,
getSlots: noopArray,
isInitialLoadDisabled: trueFunc,
refresh: noopFunc,
set: noopThis,
setCategoryExclusion: noopThis,
setCentering: noopFunc,
setCookieOptions: noopThis,
setForceSafeFrame: noopThis,
setLocation: noopThis,
setPrivacySettings: noopThis,
setPublisherProvidedId: noopThis,
setRequestNonPersonalizedAds: noopThis,
setSafeFrameConfig: noopThis,
setTagForChildDirectedTreatment: noopThis,
setTargeting: noopThis,
setVideoContent: noopThis,
updateCorrelator: noopFunc
};
var _window = window, _window$googletag = _window.googletag, googletag = _window$googletag === void 0 ? {} : _window$googletag;
var _googletag$cmd = googletag.cmd, cmd = _googletag$cmd === void 0 ? [] : _googletag$cmd;
googletag.apiReady = true;
googletag.cmd = [];
googletag.cmd.push = function(a) {
try {
a();
} catch (ex) {}
return 1;
};
googletag.companionAds = function() {
return companionAdsService;
};
googletag.content = function() {
return contentService;
};
googletag.defineOutOfPageSlot = defineSlot;
googletag.defineSlot = defineSlot;
googletag.destroySlots = function() {
slots.clear();
slotsById.clear();
};
googletag.disablePublisherConsole = noopFunc;
googletag.display = function(arg) {
var id;
if (arg !== null && arg !== void 0 && arg.getSlotElementId) {
id = arg.getSlotElementId();
} else if (arg !== null && arg !== void 0 && arg.nodeType) {
id = arg.id;
} else {
id = String(arg);
}
displaySlot(slotsById.get(id));
};
googletag.enableServices = noopFunc;
googletag.getVersion = noopStr;
googletag.pubads = function() {
return pubAdsService;
};
googletag.pubadsReady = true;
googletag.setAdIframeTitle = noopFunc;
googletag.sizeMapping = function() {
return new SizeMappingBuilder;
};
window.googletag = googletag;
while (cmd.length !== 0) {
googletag.cmd.push(cmd.shift());
}
hit(source);
}
return 1;
};
gpt.companionAds = function () { return companionAdsService; };
gpt.content = function () { return contentService; };
gpt.defineOutOfPageSlot = function () { return new Slot(); };
gpt.defineSlot = function () { return new Slot(); };
gpt.destroySlots = noopfn;
gpt.disablePublisherConsole = noopfn;
gpt.display = noopfn;
gpt.enableServices = noopfn;
gpt.getVersion = noopstrfn;
gpt.pubads = function () { return pubAdsService; };
gpt.pubadsReady = true;
gpt.setAdIframeTitle = noopfn;
gpt.sizeMapping = function () { return new SizeMappingBuilder(); };
window.googletag = gpt;
while (cmd.length !== 0) {
gpt.cmd.push(cmd.shift());
}
}());
function hit(source) {
if (source.verbose !== true) {
return;
}
try {
var log = console.log.bind(console);
var trace = console.trace.bind(console);
var prefix = source.ruleText || "";
if (source.domainName) {
var AG_SCRIPTLET_MARKER = "#%#//";
var UBO_SCRIPTLET_MARKER = "##+js";
var ruleStartIndex;
if (source.ruleText.includes(AG_SCRIPTLET_MARKER)) {
ruleStartIndex = source.ruleText.indexOf(AG_SCRIPTLET_MARKER);
} else if (source.ruleText.includes(UBO_SCRIPTLET_MARKER)) {
ruleStartIndex = source.ruleText.indexOf(UBO_SCRIPTLET_MARKER);
}
var rulePart = source.ruleText.slice(ruleStartIndex);
prefix = "".concat(source.domainName).concat(rulePart);
}
log("".concat(prefix, " trace start"));
if (trace) {
trace();
}
log("".concat(prefix, " trace end"));
} catch (e) {}
if (typeof window.__debug === "function") {
window.__debug(source);
}
}
function noopFunc() {}
function noopThis() {
return this;
}
function noopNull() {
return null;
}
function noopArray() {
return [];
}
function noopStr() {
return "";
}
function trueFunc() {
return true;
}
const updatedArgs = args ? [].concat(source).concat(args) : [ source ];
try {
GoogleTagServicesGpt.apply(this, updatedArgs);
} catch (e) {
console.log(e);
}
})({
name: "googletagservices-gpt",
args: []
}, []);