MediaWiki:Common.js: відмінності між версіями

Матеріал з WikiLegalAid
мНемає опису редагування
мНемає опису редагування
Рядок 1: Рядок 1:
/* Розміщений тут код JavaScript буде завантажений всім користувачам при зверненні до будь-якої сторінки */
/* Розміщений тут код JavaScript буде завантажений всім користувачам при зверненні до будь-якої сторінки */
mw.loader.using('mediawiki.util').then(function () {
mw.loader.using('mediawiki.util').then(function () {
   var ad = document.createElement('div');
  // Створюємо контейнер
   ad.setAttribute('align', 'center');
   var adContainer = document.createElement('div');
   ad.innerHTML = `
   adContainer.setAttribute('align', 'center');
    <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9946719691242357" crossorigin="anonymous"></script>
   var adIns = document.createElement('ins');
    <ins class="adsbygoogle"
  adIns.className = 'adsbygoogle';
        style="display:inline-block;width:728px;height:90px"
  adIns.style.cssText = 'display:inline-block;width:728px;height:90px';
        data-ad-client="ca-pub-9946719691242357"
  adIns.setAttribute('data-ad-client', 'ca-pub-9946719691242357');
        data-ad-slot="1234567890"></ins>
  adIns.setAttribute('data-ad-slot', '1234567890');
    <script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
  adContainer.appendChild(adIns);
  `;
 
  var adScript1 = document.createElement('script');
  adScript1.async = true;
  adScript1.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9946719691242357';
  adScript1.crossOrigin = 'anonymous';
 
  var adScript2 = document.createElement('script');
  adScript2.text = '(adsbygoogle = window.adsbygoogle || []).push({});';


  // Додаємо перед основним контентом
   var content = document.getElementById('content');
   var content = document.getElementById('content');
   if (content) {
   if (content) {
     content.parentNode.insertBefore(ad, content);
     content.parentNode.insertBefore(adScript1, content);
    content.parentNode.insertBefore(adContainer, content);
    content.parentNode.insertBefore(adScript2, content);
   }
   }
});
});