MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
Paulsadleir (talk | contribs) (Created page with "$(document).ready(function() { var adsenseScript = document.createElement('script'); adsenseScript.async = true; adsenseScript.src = "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7150368137838805"; adsenseScript.crossOrigin = "anonymous"; document.head.appendChild(adsenseScript); });") |
Paulsadleir (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
$(document).ready(function() { | $(document).ready(function() { | ||
// Create ad container div at bottom | |||
var adHTML = ` | |||
<div style="width:100%; margin:20px auto; text-align:center;"> | |||
<ins class="adsbygoogle" | |||
style="display:block" | |||
data-ad-client="ca-pub-7150368137838805" | |||
data-ad-slot="7587569721" | |||
data-ad-format="auto" | |||
data-full-width-responsive="true"></ins> | |||
</div> | |||
`; | |||
// Append the ad HTML at bottom of wiki content | |||
$('#content').append(adHTML); | |||
// Load Adsense script | |||
var adsenseScript = document.createElement('script'); | var adsenseScript = document.createElement('script'); | ||
adsenseScript.async = true; | adsenseScript.async = true; | ||
Line 5: | Line 21: | ||
adsenseScript.crossOrigin = "anonymous"; | adsenseScript.crossOrigin = "anonymous"; | ||
document.head.appendChild(adsenseScript); | document.head.appendChild(adsenseScript); | ||
// Activate Adsense ads | |||
(adsbygoogle = window.adsbygoogle || []).push({}); | |||
}); | }); |
Latest revision as of 02:20, 14 April 2025
$(document).ready(function() {
// Create ad container div at bottom
var adHTML = `
<div style="width:100%; margin:20px auto; text-align:center;">
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-7150368137838805"
data-ad-slot="7587569721"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
</div>
`;
// Append the ad HTML at bottom of wiki content
$('#content').append(adHTML);
// Load Adsense script
var adsenseScript = document.createElement('script');
adsenseScript.async = true;
adsenseScript.src = "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7150368137838805";
adsenseScript.crossOrigin = "anonymous";
document.head.appendChild(adsenseScript);
// Activate Adsense ads
(adsbygoogle = window.adsbygoogle || []).push({});
});