Шаблон:Ads recomended — различия между версиями

Материал из Enduro.team
Перейти к: навигация, поиск
м
м
 
(не показаны 33 промежуточные версии этого же участника)
Строка 2: Строка 2:
 
<html>
 
<html>
 
<body>
 
<body>
<div class="adsrecomended">
+
<div class="adsrecomended" id="adsrecomended">
 
<script>
 
<script>
var externalScript  = document.createElement("script");
+
if (window.matchMedia) {
externalScript.type  = "text/javascript";
+
  if(window.matchMedia('(prefers-color-scheme: dark)').matches){
externalScript.setAttribute('async','async');
+
    var d1 = document.getElementById('adsrecomended');
externalScript.src = "//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9226951475373251";
+
    d1.insertAdjacentHTML('beforeend', '<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-9226951475373251" data-ad-slot="3158273233"></ins>');
document.getElementsByTagName('body')[0].appendChild(externalScript);
+
  } else {
 
+
    var d1 = document.getElementById('adsrecomended');
var ins  = document.createElement("ins");
+
    d1.insertAdjacentHTML('beforeend', '<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-9226951475373251" data-ad-slot="3159268773"></ins>');
ins.setAttribute('class','adsbygoogle');
+
  }
ins.setAttribute('style','display:block;');/*add other styles if required*/
+
} else {
ins.setAttribute('data-ad-client','9226951475373251');
+
    var d1 = document.getElementById('adsrecomended');
ins.setAttribute('data-ad-slot','3159268773');
+
    d1.insertAdjacentHTML('beforeend', '<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-9226951475373251" data-ad-slot="3159268773"></ins>');
ins.setAttribute('data-ad-format','autorelaxed');
+
}
document.getElementsByTagName('body')[0].appendChild(ins);
+
</script>
 
+
<script>
var inlineScript  = document.createElement("script");
+
    (adsbygoogle = window.adsbygoogle || []).push({});
inlineScript.type  = "text/javascript";
 
inlineScript.text  = '(adsbygoogle = window.adsbygoogle || []).push({});'
 
document.getElementsByTagName('body')[0].appendChild(inlineScript);
 
 
</script>
 
</script>
 
</div>
 
</div>

Текущая версия на 16:18, 16 августа 2022