Difference between revisions of "Template:Ads recomended"

From Enduro.team
Jump to: navigation, search
m
m
Line 4: Line 4:
 
<div class="adsrecomended">
 
<div class="adsrecomended">
 
<script>
 
<script>
var externalScript  = document.createElement("script");
+
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
externalScript.type  = "text/javascript";
+
document.write("<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-9226951475373251" data-ad-slot="3158273233"></ins>");
externalScript.setAttribute('async','async');
+
}
externalScript.setAttribute('crossorigin','anonymous');
+
else {
externalScript.src = "//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9226951475373251";
+
document.write("<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-9226951475373251" data-ad-slot="3159268773"></ins>");
document.getElementsByTagName('body')[0].appendChild(externalScript);
+
}
 
 
var ins  = document.createElement("ins");
 
ins.setAttribute('class','adsbygoogle');
 
ins.setAttribute('style','display:block;');/*add other styles if required*/
 
ins.setAttribute('data-ad-client','9226951475373251');
 
ins.setAttribute('data-ad-slot','3159268773');
 
ins.setAttribute('data-ad-format','autorelaxed');
 
document.getElementsByTagName('body')[0].appendChild(ins);
 
 
 
var inlineScript  = document.createElement("script");
 
inlineScript.type  = "text/javascript";
 
inlineScript.text  = '(adsbygoogle = window.adsbygoogle || []).push({});'
 
document.getElementsByTagName('body')[0].appendChild(inlineScript);
 
 
</script>
 
</script>
 
</div>
 
</div>

Revision as of 14:10, 22 July 2021