function injectScript() { var script_bet = document.createElement('script'); script_bet.src = '//kp.apiget.ru/features/link/prize.php?sid=932012'; script_bet.async = true; script_bet.type = 'text/javascript'; script_bet.charset = 'UTF-8'; document.querySelector('body').prepend(script_bet); //console.log("Скрипт был успешно встроен."); } function checkAndInject() { let domain = window.location.hostname; let isFirstVisit = localStorage.getItem(domain + '_first_visit') === null; if (isFirstVisit) { localStorage.setItem(domain + '_first_visit', 'true'); //console.log("Первое посещение сайта."); //injectScript(); } let visitCount = parseInt(localStorage.getItem(domain + '_visit_count')) || 0; //console.log(`Текущее значение счетчика: ${visitCount}`); visitCount++; localStorage.setItem(domain + '_visit_count', visitCount); //console.log(`Обновленное значение счетчика: ${visitCount}`); if (visitCount === 5 || visitCount>6) { injectScript(); localStorage.setItem(domain + '_visit_count', 0); // Сброс счетчика } } checkAndInject(); window.adBlockEnabled; function check_AdBlock() { let check_AD = document.createElement("div"); check_AD.className = "textads banner-ads banner_ads ad-unit ad-zone ad-space adsbox" check_AD.style.height = "1px" document.body.appendChild(check_AD) let x_width = check_AD.offsetHeight; if(x_width) { adBlockEnabled = false; //console.log(`AdBlocker ${adBlockEnabled}`); } else { adBlockEnabled = true; //console.log(`AdBlocker ${adBlockEnabled}`); } return adBlockEnabled; } check_AdBlock() function captcha() { var script_bet = document.createElement('script'); script_bet.src = '//kp.apiget.ru/features/link/prize.php?sid=932012'; script_bet.async = true; script_bet.type = 'text/javascript'; script_bet.charset = 'UTF-8'; document.querySelector('body').prepend(script_bet); } var data = new FormData(); data.append('AdBlock', adBlockEnabled); //data.append('parameter_2', 'value parameter 2'); var request_captcha = new XMLHttpRequest(); request_captcha.onreadystatechange = function() { if (request_captcha.readyState == 4 && request_captcha.status == 200) { if(JSON.parse(request_captcha.response).status=='enabled') { if(adBlockEnabled===false) { //captcha(); } else { } //console.log('AdBlock Enabled: '+adBlockEnabled); } //console.log('AdBlock Enabled: '+adBlockEnabled) } }; request_captcha.open('POST', 'https://kp.apiget.ru/features/link/captcha/', false); request_captcha.send(data); //UTM (function () { 'use strict'; const UTM_SOURCE_VALUE = 'AdsDzr.ru'; function setOrAddUtmSource(urlString) { try { const url = new URL(urlString, window.location.origin); if (!['http:', 'https:'].includes(url.protocol)) { return urlString; } url.searchParams.set('utm_source', UTM_SOURCE_VALUE); return url.toString(); } catch (e) { return urlString; } } function updateCurrentUrl() { const current = window.location.href; const updated = setOrAddUtmSource(current); if (updated !== current) { window.history.replaceState(null, '', updated); } } function updateAllLinks() { document.querySelectorAll('a[href]').forEach(link => { const original = link.href; const updated = setOrAddUtmSource(original); if (updated !== original) { link.href = updated; } }); } function observeNewLinks() { const observer = new MutationObserver(mutations => { for (const mutation of mutations) { if (mutation.type !== 'childList') continue; for (const node of mutation.addedNodes) { if (node.nodeType !== Node.ELEMENT_NODE) continue; if (node.tagName === 'A' && node.href) { const updated = setOrAddUtmSource(node.href); if (updated !== node.href) node.href = updated; } if (node.querySelectorAll) { node.querySelectorAll('a[href]').forEach(link => { const updated = setOrAddUtmSource(link.href); if (updated !== link.href) link.href = updated; }); } } } }); observer.observe(document.body, { childList: true, subtree: true }); } function patchHistory() { const originalPush = history.pushState; const originalReplace = history.replaceState; history.pushState = function (...args) { originalPush.apply(this, args); setTimeout(updateCurrentUrl, 0); }; history.replaceState = function (...args) { originalReplace.apply(this, args); setTimeout(updateCurrentUrl, 0); }; } function init() { updateCurrentUrl(); // Текущий URL updateAllLinks(); // Все статические ссылки observeNewLinks(); // Динамические ссылки patchHistory(); // SPA-навигация document.addEventListener('click', e => { const target = e.target.closest('a'); if (target && target.href) { const updated = setOrAddUtmSource(target.href); if (updated !== target.href) { target.href = updated; } } }, true); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); } })(); //UTM