MediaWiki:Common.js

Revision as of 02:20, 14 April 2025 by Paulsadleir (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
$(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({});
});