Sponsorizzato
-->
`
};
// =============================
// تنسيق الإعلان
// =============================
const style = document.createElement("style");
style.innerHTML = `
.smart-ad {
background: #f9f9f9;
padding: 15px;
margin: 20px 0;
border: 1px dashed #ccc;
text-align: center;
font-size: 14px;
}
`;
document.head.appendChild(style);
// =============================
// إدخال الإعلانات بذكاء
// =============================
function insertSmartAds() {
const paragraphs = document.querySelectorAll(smartAdsSettings.selector);
if (paragraphs.length === 0) return;
let adsInserted = 0;
let lastAdIndex = -smartAdsSettings.minGap;
for (let i = 0; i < paragraphs.length && adsInserted < smartAdsSettings.maxAds; i++) {
let textLength = paragraphs[i].innerText.trim().length;
// شروط إدخال الإعلان
if (
textLength >= smartAdsSettings.minLength &&
(i - lastAdIndex) >= smartAdsSettings.minGap &&
Math.random() > 0.3 // عنصر العشوائية (30% احتمالية عدم وضع إعلان هنا)
) {
paragraphs[i].insertAdjacentHTML("afterend", smartAdsSettings.adCode);
lastAdIndex = i;
adsInserted++;
}
}
}
document.addEventListener("DOMContentLoaded", insertSmartAds);
Contact us and we will contact you back