MediaWiki:Vector.js: Difference between revisions

From TwentyOneWiki
Jump to navigation Jump to search
No edit summary
Tag: Reverted
No edit summary
 
(25 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* MediaWiki:Common.js */
$(document).ready(function() {
    // Находим все ссылки с rel="discussion" и меняем атрибут title
    $('a[rel="discussion"]').attr('title', 'Comment the article [alt+shift t]');
});
$(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() {
$(document).ready(function() {
     var newItem = $('<li class="personal-version" title="Version October 2024"><a href="/index.php?title=MediaWiki:Blog" style="text-decoration: none; color: inherit;">Version: Beta 5.1</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');
 
        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({
             .css({
                 'background-color': '#DDD7CC', // Цвет фона
                 'margin': '0',
                 'padding': '10px',         // Внутренний отступ для контейнера
                 'padding': '5px',
                 'margin-top': '10px',       // Отступ сверху
                 'font-weight': 'bold',
                 'text-align': 'center',    // Центрирование содержимого
                 'color': 'white',
                'font-family': '\'MyCustomFont2\', sans-serif' // Применение пользовательского шрифта
             });
             });


        // Добавляем HTML-код
         var ukraineFlag = $('<img>')
         var customHTML = `
             .attr({
        <div style="text-align:center;">
                 'src': 'https://upload.wikimedia.org/wikipedia/commons/4/49/Flag_of_Ukraine.svg',
             <span style="padding:1.5em 1.5em; text-align:center;">
                'alt': 'Ukrainian Flag',
                 <choose uncached="">
                'width': '35'
                    <option>{{CSS image crop
            })
                    |Image = [[File:Tyler phone293729.png|link=October 2008]]
            .css({
                    |bSize = 100
                'margin-top': '5px'
                    |cWidth = 350
             });
                    |cHeight = 280
                    |oTop = 80
                    |oLeft = 60
                    }}<br>Only known performance in unknown vebue around October 2008. Photo of concrt was taken from [[Level of Concern/USB]] from [[Tyler Joseph|Tyler]] phone while ARG game.</option>
                    <option>[[File:Without_image.png|290x290px|center|link=October 2008]]<br>'''[[October 2008]]'''<br>Only known performance in unknown vebue around October 2008. Photo of concrt was taken from [[Level of Concern/USB]] from [[Tyler Joseph|Tyler]] phone while ARG game.</option>
                    <option>[[File:Without_image.png|270x270px|center|link=Spring 2008]]<br>'''[[Spring 2008]]'''</option>
                    <option>[[File:Without_image.png|270x270px|center|link=Kidd Coffee 2009]]<br>'''[[Kidd Coffee 2009]]'''</option>
                    <option><div style="margin-left: 120px;">{{CSS image crop
                    |Image = [[File:Twenty One Pilots Newspaper Jan 2010.jpg|center|link=Skully's Music Diner 2009]]
                    |bSize = 100
                    |cWidth = 200
                    |cHeight = 300
                    |oTop = 40
                    |oLeft = 410
                    }}</div><br>'''[[Skully's Music Diner 2009]]''' — Unknown 2009 band show that is mentioned in a January 2010 newspaper and by a bar employee on Reddit.</option>
                    <option>[[File:6 May 2011.png|300x300px|center|link=05.06.2011]]<br>'''[[05.06.2011|6 May 2011]]''' — The concert took place outside in a small pavilion in the late afternoon. The band started their performance at 11:30 and played the song Time to Say Goodbye after which people complained about a lot of noise and the police stopped the concert. Tyler was concerned because of the possibility of a negative citizenship rank.</option>
                    <option>[[File:Location Sessions.jpg|270x270px|center|link=Location Sessions]]<br>'''[[Location Sessions]]''' (stylized as «'''Løcatiøn Sessiøns'''») — This is a series of singles released <span class="plainlinks">[https://twentyonewiki.info/index.php/Category:2019 2019]</span> - <span class="plainlinks">[https://twentyonewiki.info/index.php/Category:2020 2020]</span> alternative reconstructed [[Twenty One Pilots]] songs recorded at several different sessions.</option>
                </choose>
             </span>
        </div>`;


         // Добавляем HTML-код в контейнер
         ukraineContainer.append(ukraineText);
         container.append(customHTML);
         ukraineContainer.append(ukraineFlag);


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

Latest revision as of 00:58, 8 May 2025

/* MediaWiki:Common.js */

$(document).ready(function() {
    // Находим все ссылки с rel="discussion" и меняем атрибут title
    $('a[rel="discussion"]').attr('title', 'Comment the article [alt+shift t]');
});


$(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',
                'color': 'white',
            });

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

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

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