MediaWiki:Vector.js: Difference between revisions
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() { | ||
$(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; | ||
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() { | ||
var sidebar = $('#p-tb'); | |||
var sidebar = $('#p-tb'); | |||
if (sidebar.length) { | if (sidebar.length) { | ||
// | // Existing help container | ||
var container = $('<div>') | var container = $('<div>') | ||
.attr('id', 'help-container') | .attr('id', 'help-container') | ||
.addClass('help-container'); | .addClass('help-container'); | ||
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); | |||
ukraineContainer.append(ukraineFlag); | |||
// | // 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);
}
});