|
|
| (не показаны 2 промежуточные версии этого же участника) |
| Строка 2: |
Строка 2: |
|
| |
|
| // console.log("Привет"); | | // console.log("Привет"); |
| /*_____________________*/
| |
| // Проверяем загрузку jQuery
| |
| mw.loader.using('jquery').then(function() {
| |
| $(function() {
| |
| // Инициализация кастомной панели
| |
| const $header = $('.citizen-header');
| |
| const $customContainer = $('.citizen-header__custom-bottom').length ?
| |
| $('.citizen-header__custom-bottom') :
| |
| $('<div>').addClass('citizen-header__custom-bottom').appendTo($header);
| |
|
| |
| // Добавление оверлея
| |
| const $overlay = $('<div>').addClass('citizen-overlay');
| |
| $('body').append($overlay);
| |
|
| |
| // Закрытие элементов при клике на оверлей
| |
| $overlay.on('click', function() {
| |
| $header.removeClass('menu-open');
| |
| $overlay.hide();
| |
| });
| |
|
| |
| // Инициализация элементов управления
| |
| $('[data-citizen-toggle]').on('click', function() {
| |
| $header.toggleClass('menu-open');
| |
| $overlay.toggle();
| |
| });
| |
|
| |
| // Ваши кастомные элементы
| |
| const items = [
| |
| {
| |
| type: 'image',
| |
| src: 'https://wiki.ss220.club/resources/assets/logo.png',
| |
| link: 'https://wiki.ss220.club',
| |
| width: '20px'
| |
| },
| |
| {
| |
| type: 'image',
| |
| src: 'https://bs.ss220.club/resources/assets/logo.png',
| |
| link: 'https://bs.ss220.club',
| |
| width: '20px'
| |
| }
| |
| ];
| |
|
| |
| $customContainer.empty().append(
| |
| items.map(item =>
| |
| $('<a>')
| |
| .attr('href', item.link)
| |
| .append(
| |
| $('<img>')
| |
| .attr('src', item.src)
| |
| .css('width', item.width)
| |
| )
| |
| .css({
| |
| display: 'flex',
| |
| alignItems: 'center',
| |
| padding: '4px'
| |
| })
| |
| )
| |
| );
| |
| });
| |
| });
| |
/* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой странице */
// console.log("Привет");