(function () { const M_ID = "9903938"; const sdkFnName = "show_" + M_ID; const SDK_SRC = "//libtl.com/sdk.js"; function loadScriptOnce(src) { return new Promise((res, rej) => { if (!src) return rej(new Error("No SDK src")); const s = document.createElement("script"); s.src = src; s.setAttribute("data-zone", M_ID); s.setAttribute("data-sdk", sdkFnName); s.async = true; s.onload = () => res(); s.onerror = () => rej(new Error("Failed to load SDK")); document.head.appendChild(s); }); } loadScriptOnce(SDK_SRC); window._callMonetag = function () { return new Promise((resolve, reject) => { if (typeof window[sdkFnName] === "function") { try { return window[sdkFnName]().then(resolve).catch(reject); } catch (e) { return reject(e); } } let attempts = 0; const iv = setInterval(() => { attempts++; if (typeof window[sdkFnName] === "function") { clearInterval(iv); try { window[sdkFnName]().then(resolve).catch(reject); } catch (e) { reject(e); } } else if (attempts >= 50) { clearInterval(iv); reject(new Error("Monetag SDK load timeout")); } }, 100); }); }; })(); (function () { const WID = "74c50a46-afa8-4731-9bc6-0c5787bca7d7"; const SDK_SRC = "https://cdn.tgads.space/assets/js/adexium-widget.min.js"; function loadAdexiumSDK() { if (window.__adexiumSDK) return window.__adexiumSDK; window.__adexiumSDK = new Promise((resolve, reject) => { if (document.querySelector(`script[src="${SDK_SRC}"]`)) return resolve(); const s = document.createElement("script"); s.src = SDK_SRC; s.async = true; s.onload = resolve; s.onerror = () => reject(new Error("Failed to load Adexium SDK")); document.head.appendChild(s); }); return window.__adexiumSDK; } loadAdexiumSDK(); window.showAdexiumAd = function () { return new Promise((resolve, reject) => { if (typeof AdexiumWidget === "function") { showAd(); return; } let attempts = 0; const iv = setInterval(() => { attempts++; if (typeof AdexiumWidget === "function") { clearInterval(iv); showAd(); } else if (attempts >= 50) { clearInterval(iv); reject(new Error("AdexiumWidget load timeout")); } }, 100); function showAd() { const adexiumAds = new AdexiumWidget({ wid: WID, adFormat: "interstitial" }); let resolved = false; adexiumAds.on("adReceived", ad => adexiumAds.displayAd(ad)); adexiumAds.on("noAdFound", () => { if (!resolved) { resolved = true; reject(new Error("No ad found")); } }); adexiumAds.on("adClosed", () => { if (!resolved) { resolved = true; resolve({ network: "adexium", event: "closed" }); } }); adexiumAds.on("adRedirected", () => { if (!resolved) { resolved = true; resolve({ network: "adexium", event: "redirected" }); } }); adexiumAds.on("adPlaybackCompleted", () => {}); try { adexiumAds.requestAd("interstitial"); } catch (err) { if (!resolved) { resolved = true; reject(err); } } } }); }; })(); /* ======================== Adexora Manager ======================== */ window._adexoraProviders = window._adexoraProviders || []; window._adexoraProviders.push(window._callMonetag); window.showAdexora = function () { return new Promise((resolve, reject) => { const providers = (window._adexoraProviders || []).slice(); if (!providers.length) return reject(new Error("No ad networks available")); const onclickaFn = window.showOnClickaAd; const otherProviders = providers.filter(fn => fn !== onclickaFn); const shuffled = otherProviders.sort(() => Math.random() - 0.5); let idx = 0; function tryNext() { if (idx >= shuffled.length) return showOnClickaIfEnabled(); const fn = shuffled[idx++]; if (typeof fn !== "function") return tryNext(); // Wrap provider call with a timeout fallback const providerPromise = fn(); const timeout = new Promise(res => setTimeout(() => res({ error: "Timeout" }), 15000)); // 15s fallback Promise.race([providerPromise, timeout]) .then(result => showOnClickaIfEnabled(result)) .catch(() => tryNext()); } function showOnClickaIfEnabled(prevResult) { if (typeof onclickaFn !== "function") return resolve(prevResult); // Wrap OnClicka call with a timeout fallback const onclickaPromise = onclickaFn(); const timeout = new Promise(res => setTimeout(() => res({ error: "OnClicka Timeout" }), 15000)); Promise.race([onclickaPromise, timeout]) .then(res => resolve([prevResult, res])) .catch(err => resolve([prevResult, { error: err }])); } tryNext(); }); };