MediaWiki:Vector.js

From TwentyOneWiki
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
$(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);
    }
});