MediaWiki:Common.js: відмінності між версіями
Матеріал з WikiLegalAid
Alexb (обговорення | внесок) мНемає опису редагування |
Alexb (обговорення | внесок) мНемає опису редагування |
||
| Рядок 1: | Рядок 1: | ||
/* Розміщений тут код JavaScript буде завантажений всім користувачам при зверненні до будь-якої сторінки */ | /* Розміщений тут код JavaScript буде завантажений всім користувачам при зверненні до будь-якої сторінки */ | ||
mw.loader.using('mediawiki.util').then(function () { | mw.loader.using('mediawiki.util').then(function () { | ||
var | // Створюємо контейнер | ||
var adContainer = document.createElement('div'); | |||
adContainer.setAttribute('align', 'center'); | |||
var adIns = document.createElement('ins'); | |||
adIns.className = 'adsbygoogle'; | |||
adIns.style.cssText = 'display:inline-block;width:728px;height:90px'; | |||
adIns.setAttribute('data-ad-client', 'ca-pub-9946719691242357'); | |||
adIns.setAttribute('data-ad-slot', '1234567890'); | |||
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( | content.parentNode.insertBefore(adScript1, content); | ||
content.parentNode.insertBefore(adContainer, content); | |||
content.parentNode.insertBefore(adScript2, content); | |||
} | } | ||
}); | }); | ||
