let lijuArr = document.querySelectorAll('.liju') || [];
for (let i = 0; i < lijuArr.length; i++) {
let advDiv = document.createElement('div');
advDiv.classList.add('advDiv');
advDiv.innerHTML = `<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"><\/script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-111"
data-ad-slot="1212"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
<\/script>`
lijuArr[i].after(advDiv);
}
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
вырезаем и вставляем перед закрывающим тегом head<script>
let lijuArr = document.querySelectorAll('.liju') || [];
// Вставляем дивы с классом advDiv после дивов с классом liju
for (let i = 0; i < lijuArr.length; i++) {
let advDiv = document.createElement('div');
advDiv.classList.add('advDiv');
lijuArr[i].after(advDiv);
}
// После загрузки страницы в дивы с классом advDiv вставляем <ins class... , и после каждого дива вставляем (adsbygoogle = window.adsbygoogle || []).push({});
document.addEventListener('DOMContentLoaded', function(){
let advArr = document.querySelectorAll('.advDiv') || [];
advArr.forEach(element => {
element.innerHTML='<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-2272238036927" data-ad-slot="43425234" data-ad-format="auto" data-full-width-responsive="true"></ins>';
(adsbygoogle = window.adsbygoogle || []).push({});
});
});
</script>
$(document).ready(function(){
$(".liju").html('<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"><\/script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-111" data-ad-slot="1212" data-ad-format="auto" data-full-width-responsive="true"></ins><script> (adsbygoogle = window.adsbygoogle || []).push({});<\/script>');
});
<script async src="https://pagead2....