|
|
| (не показаны 3 промежуточные версии этого же участника) |
| Строка 2: |
Строка 2: |
|
| |
|
| // console.log("Привет"); | | // console.log("Привет"); |
| /*_____________________*/
| |
| // Проверяем загрузку jQuery
| |
| mw.loader.using('jquery').then(function() {
| |
| $(function() {
| |
| // Создаем контейнер, если его нет
| |
| var $customContainer = $('.citizen-header__custom-bottom');
| |
| if ($customContainer.length === 0) {
| |
| $customContainer = $('<div>')
| |
| .addClass('citizen-header__custom-bottom')
| |
| .appendTo('.citizen-header');
| |
| }
| |
|
| |
| // Пример данных (замените на свои!)
| |
| var 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();
| |
|
| |
| // Добавляем элементы
| |
| items.forEach(function(item) {
| |
| var $element;
| |
| if (item.type === 'image') {
| |
| $element = $('<img>')
| |
| .attr('src', item.src)
| |
| .css('width', item.width);
| |
| } else {
| |
| $element = $('<span>').text(item.text);
| |
| }
| |
|
| |
| var $link = $('<a>')
| |
| .attr('href', item.link)
| |
| .append($element)
| |
| .css({
| |
| display: 'grid',
| |
| margin: '0 10px'
| |
| });
| |
|
| |
| $customContainer.append($link);
| |
| });
| |
|
| |
| // Принудительно показываем контейнер
| |
| $customContainer.css('display', 'flex');
| |
| });
| |
| });
| |
/* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой странице */
// console.log("Привет");