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

Матеріал з WikiLegalAid
Немає опису редагування
Мітка: Скасовано
Немає опису редагування
Мітка: Ручний відкіт
Рядок 69: Рядок 69:
         document.getElementById("consent-banner").style.display = "none";
         document.getElementById("consent-banner").style.display = "none";
     }
     }
});
console.log("Mobile.js script loaded");
mw.loader.using('mobile.startup', function () {
    mw.hook('wikipage.content').add(function ($content) {
        // HTML вміст рекламного блоку (заміни на свій код)
        const adHtml = '<div class="ad-block" style="margin: 20px 0; text-align: center;">' +
                      '<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-9946719691242357" data-ad-format="auto"></ins>' +
                      '<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>' +
                      '</div>';
        $content.find('section').each(function () {
      const $section = $(this);
      const $heading = $section.find('h2, h3').first();
      const $contentBlock = $section.find('.content').first();
      $section.removeClass('collapsed');
      $section.addClass('expanded');
      $contentBlock.show();
      $section.after(adHtml);
        });
    });
});
});