MediaWiki:Common.js
Перейти к навигации
Перейти к поиску
Замечание: Возможно, после публикации вам придётся очистить кэш своего браузера, чтобы увидеть изменения.
- Firefox / Safari: Удерживая клавишу Shift, нажмите на панели инструментов Обновить либо нажмите Ctrl+F5 или Ctrl+R (⌘+R на Mac)
- Google Chrome: Нажмите Ctrl+Shift+R (⌘+Shift+R на Mac)
- Internet Explorer / Edge: Удерживая Ctrl, нажмите Обновить либо нажмите Ctrl+F5
- Opera: Нажмите Ctrl+F5.
/* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой странице */
function assembleBanner() {
/* let divBanner = document.createElement("div");
divBanner.textContent = "Banner"; */
let divBanner = null;
return divBanner;
}
function insertBeforeFirstH1(domElement) {
// Find the first <h1> element on the page
var firstH1 = document.querySelector('h1');
// Check if the <h1> element exists
if (firstH1) {
// Insert the given DOM element before the first <h1> element
firstH1.parentNode.insertBefore(domElement, firstH1);
} else {
// If there is no <h1> element, you could append it to the body or handle as needed
console.log('No <h1> element found on the page.');
}
}
insertBeforeFirstH1(null);