MediaWiki:Vector.js: Difference between revisions

From TwentyOneWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
$(document).ready(function() {
$(document).ready(function() {
     $('.copyable-text').on('click', function() {
     $('.copyable-text').on('click', function() {
         var textToCopy = $(this).text(); // Получаем текст элемента
         var textToCopy = $(this).text();
         navigator.clipboard.writeText(textToCopy).then(function() {
         navigator.clipboard.writeText(textToCopy).then(function() {
            // Добавляем класс .copied для запуска анимации
             $(this).addClass('copied');
             $(this).addClass('copied');
         }.bind(this), function(err) {
         }.bind(this), function(err) {
Line 11: Line 9:
     });
     });
});
});


document.addEventListener('DOMContentLoaded', function () {
document.addEventListener('DOMContentLoaded', function () {
     var elements = document.querySelectorAll('body *'); // Выбираем все элементы на странице
     var elements = document.querySelectorAll('body *');
      
      
     elements.forEach(function (el) {
     elements.forEach(function (el) {
         var bgColor = window.getComputedStyle(el).backgroundColor; // Получаем цвет фона элемента
         var bgColor = window.getComputedStyle(el).backgroundColor;
       
        // Проверяем, если цвет фона соответствует #D02019 (rgb(208, 32, 25))
         if (bgColor === 'rgb(208, 32, 25)') {
         if (bgColor === 'rgb(208, 32, 25)') {
             el.classList.add('custom-selection'); // Добавляем класс для изменения стилей
             el.classList.add('custom-selection');
         }
         }
     });
     });
});
});


$(document).ready(function() {
$(document).ready(function() {
     var newItem = $('<li class="personal-version" title="Version March 31 2025"><a href="/index.php?title=MediaWiki:Blog" style="text-decoration: none; color: inherit;">Version: Beta 5.2</a><hr style="display:inline-block; height: 20px; bottom: 2px; width: 1px; background: linear-gradient(to bottom, #DDD7CC, #702114); border: none; margin-left: 10px; vertical-align: middle;"></li>');
     var newItem = $('<li class="personal-version" title="Version March 31 2025"><a href="/index.php?title=MediaWiki:Blog" style="text-decoration: none; color: inherit;">Version: Beta 5.2</a><hr style="display:inline-block; height: 20px; bottom: 2px; width: 1px; background: linear-gradient(to bottom, #DDD7CC, #702114); border: none; margin-left: 10px; vertical-align: middle;"></li>');
     $('#p-personal > div > ul').prepend(newItem); // Добавляем элемент первым в списке навигации
     $('#p-personal > div > ul').prepend(newItem);
});
});


$(document).ready(function() {
$(document).ready(function() {
    // Найдем элемент Sidebar (в Vector skin это обычно div с id 'p-tb')
     var sidebar = $('#p-tb');
     var sidebar = $('#p-tb'); // Стандартный id для Sidebar в Vector skin


     if (sidebar.length) {
     if (sidebar.length) {
         // Создаем контейнер div
         // Existing help container
         var container = $('<div>')
         var container = $('<div>')
             .attr('id', 'help-container') // Присваиваем контейнеру id
             .attr('id', 'help-container')
             .addClass('help-container');     // Добавляем класс
             .addClass('help-container');


        // Создаем заголовок "Help" с ссылкой
         var helpHeader = $('<h3>')
         var helpHeader = $('<h3>')
             .addClass('help-header')   // Добавляем класс
             .addClass('help-header')
             .html('<a href="https://example.com/help" style="text-decoration: none; color: inherit;">Help</a>'); // Заголовок с ссылкой
             .html('<a href="https://example.com/help" style="text-decoration: none; color: inherit;">Help</a>');


        // Добавляем заголовок в контейнер
         container.append(helpHeader);
         container.append(helpHeader);


        // Массив с путями к изображениям
         var images = [
         var images = [
             { src: '/images/5/52/10.14.2009.jpg', link: 'https://twentyonewiki.info/index.php/11.14.2009' },
             { src: '/images/5/52/10.14.2009.jpg', link: 'https://twentyonewiki.info/index.php/11.14.2009' },
Line 68: Line 51:
         ];
         ];


        // Выбираем случайное изображение
         var randomImage = images[Math.floor(Math.random() * images.length)];
         var randomImage = images[Math.floor(Math.random() * images.length)];


        // Создаем элемент изображения с ссылкой
         var imageLink = $('<a>')
         var imageLink = $('<a>')
             .attr('href', randomImage.link) // Устанавливаем ссылку на изображение
             .attr('href', randomImage.link)
             .html('<img src="' + randomImage.src + '" class="help-image" alt="Help Image">'); // Создаем элемент изображения
             .html('<img src="' + randomImage.src + '" class="help-image" alt="Help Image">');


        // Добавляем изображение в контейнер
         container.append(imageLink);
         container.append(imageLink);


        // Добавляем текст снизу
         var helpText = $('<p>')
         var helpText = $('<p>')
             .addClass('help-text') // Добавляем класс для стилизации
             .addClass('help-text')
             .text("Here's pages that you can help us to get more information about them."); // Добавляем текст
             .text("Here's pages that you can help us to get more information about them.");
 
        container.append(helpText);
 
        // New Ukraine support container
        var ukraineContainer = $('<div>')
            .attr('id', 'ukraine-support')
            .addClass('ukraine-support')
            .css({
                'margin-top': '20px',
                'text-align': 'center'
            });
 
        var ukraineText = $('<p>')
            .text('Stand with Ukraine')
            .css({
                'margin': '0',
                'padding': '5px',
                'font-weight': 'bold'
            });
 
        var ukraineFlag = $('<img>')
            .attr({
                'src': 'https://upload.wikimedia.org/wikipedia/commons/4/49/Flag_of_Ukraine.svg',
                'alt': 'Ukrainian Flag',
                'width': '60'
            })
            .css({
                'margin-top': '5px'
            });


         // Добавляем текст в контейнер
         ukraineContainer.append(ukraineText);
         container.append(helpText); // Этот текст теперь будет под изображением
         ukraineContainer.append(ukraineFlag);


         // Вставляем контейнер после Sidebar
         // Insert both containers after sidebar
        sidebar.after(ukraineContainer);
         sidebar.after(container);
         sidebar.after(container);
     }
     }
});
});

Revision as of 03:27, 5 April 2025

$(document).ready(function() {
    $('.copyable-text').on('click', function() {
        var textToCopy = $(this).text();
        navigator.clipboard.writeText(textToCopy).then(function() {
            $(this).addClass('copied');
        }.bind(this), function(err) {
            console.error('Ошибка при копировании текста: ', err);
        });
    });
});

document.addEventListener('DOMContentLoaded', function () {
    var elements = document.querySelectorAll('body *');
    
    elements.forEach(function (el) {
        var bgColor = window.getComputedStyle(el).backgroundColor;
        if (bgColor === 'rgb(208, 32, 25)') {
            el.classList.add('custom-selection');
        }
    });
});

$(document).ready(function() {
    var newItem = $('<li class="personal-version" title="Version March 31 2025"><a href="/index.php?title=MediaWiki:Blog" style="text-decoration: none; color: inherit;">Version: Beta 5.2</a><hr style="display:inline-block; height: 20px; bottom: 2px; width: 1px; background: linear-gradient(to bottom, #DDD7CC, #702114); border: none; margin-left: 10px; vertical-align: middle;"></li>');
    $('#p-personal > div > ul').prepend(newItem);
});

$(document).ready(function() {
    var sidebar = $('#p-tb');

    if (sidebar.length) {
        // Existing help container
        var container = $('<div>')
            .attr('id', 'help-container')
            .addClass('help-container');

        var helpHeader = $('<h3>')
            .addClass('help-header')
            .html('<a href="https://example.com/help" style="text-decoration: none; color: inherit;">Help</a>');

        container.append(helpHeader);

        var images = [
            { src: '/images/5/52/10.14.2009.jpg', link: 'https://twentyonewiki.info/index.php/11.14.2009' },
            { src: '/images/6/66/Friends_from_FC_29_Dec_2009.jpg', link: 'https://twentyonewiki.info/index.php/12.29.2009' },
            { src: '/images/0/06/Skully%27s_2009_Newspaper.png', link: 'https://twentyonewiki.info/index.php/Skully%27s_Music_Diner_2009' },
            { src: '/images/0/00/Tyler_phone293729.png', link: 'https://twentyonewiki.info/index.php/October_2008' },
            { src: '/images/a/a0/Another_Tyler_photo_in_2008-2009.jpg', link: 'https://twentyonewiki.info/index.php/October_2008' },
            { src: '/images/6/62/Johnny_Boy_-_EP.png', link: 'https://twentyonewiki.info/index.php/Johnny_Boy_(EP)' },
            { src: '/images/5/5a/Location_Sessions.jpg', link: 'https://twentyonewiki.info/index.php/Trench_10%22_Triplet' }
        ];

        var randomImage = images[Math.floor(Math.random() * images.length)];

        var imageLink = $('<a>')
            .attr('href', randomImage.link)
            .html('<img src="' + randomImage.src + '" class="help-image" alt="Help Image">');

        container.append(imageLink);

        var helpText = $('<p>')
            .addClass('help-text')
            .text("Here's pages that you can help us to get more information about them.");

        container.append(helpText);

        // New Ukraine support container
        var ukraineContainer = $('<div>')
            .attr('id', 'ukraine-support')
            .addClass('ukraine-support')
            .css({
                'margin-top': '20px',
                'text-align': 'center'
            });

        var ukraineText = $('<p>')
            .text('Stand with Ukraine')
            .css({
                'margin': '0',
                'padding': '5px',
                'font-weight': 'bold'
            });

        var ukraineFlag = $('<img>')
            .attr({
                'src': 'https://upload.wikimedia.org/wikipedia/commons/4/49/Flag_of_Ukraine.svg',
                'alt': 'Ukrainian Flag',
                'width': '60'
            })
            .css({
                'margin-top': '5px'
            });

        ukraineContainer.append(ukraineText);
        ukraineContainer.append(ukraineFlag);

        // Insert both containers after sidebar
        sidebar.after(ukraineContainer);
        sidebar.after(container);
    }
});