8,554
edits
No edit summary |
No edit summary |
||
(13 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
document.addEventListener('DOMContentLoaded', () => { | $(document).ready(function() { | ||
document.querySelectorAll(' | $('.copyable-text').on('click', function() { | ||
var textToCopy = $(this).text(); // Получаем текст элемента | |||
navigator.clipboard.writeText(textToCopy).then(function() { | |||
// Добавляем класс .copied для показа уведомления | |||
$(this).addClass('copied'); | |||
}.bind(this), function(err) { | |||
console.error('Ошибка при копировании текста: ', err); | |||
}); | |||
}); | |||
}); | |||
/* MediaWiki:Common.js */ | |||
$(document).ready(function() { | |||
// Находим все ссылки с rel="discussion" и меняем атрибут title | |||
$('a[rel="discussion"]').attr('title', 'Comment the article [alt+shift t]'); | |||
}); | |||
document.addEventListener('DOMContentLoaded', function () { | |||
var elements = document.querySelectorAll('body *'); // Выбираем все элементы на странице | |||
elements.forEach(function (el) { | |||
var bgColor = window.getComputedStyle(el).backgroundColor; // Получаем цвет фона элемента | |||
// Проверяем, если цвет фона соответствует #D02019 (rgb(208, 32, 25)) | |||
if (bgColor === 'rgb(208, 32, 25)') { | |||
el.classList.add('custom-selection'); // Добавляем класс для изменения стилей | |||
} | |||
}); | |||
}); | |||
document.addEventListener('DOMContentLoaded', function() { | |||
var logoutLink = document.querySelector('#pt-logout a'); | |||
if (logoutLink) { | |||
logoutLink.setAttribute('title', 'Leave'); | |||
} | |||
}); | |||
function updateTimeCounter() { | |||
var counter = document.getElementById('time-counter'); | |||
if (!counter) return; | |||
var year = parseInt(counter.getAttribute('data-year'), 10); | |||
var month = parseInt(counter.getAttribute('data-month'), 10) - 1; // месяцы в JavaScript начинаются с 0 | |||
var day = parseInt(counter.getAttribute('data-day'), 10); | |||
var hour = parseInt(counter.getAttribute('data-hour'), 10); | |||
var minute = parseInt(counter.getAttribute('data-minute'), 10); | |||
var targetDate = new Date(year, month, day, hour, minute); | |||
var now = new Date(); | |||
var timeDiff = now - targetDate; | |||
if (timeDiff >= 0) { | |||
var seconds = Math.floor((timeDiff / 1000) % 60); | |||
var minutes = Math.floor((timeDiff / 1000 / 60) % 60); | |||
var hours = Math.floor((timeDiff / 1000 / 60 / 60) % 24); | |||
var days = Math.floor(timeDiff / 1000 / 60 / 60 / 24); | |||
document.getElementById('time-counter-days').innerText = days; | |||
document.getElementById('time-counter-hours').innerText = hours; | |||
document.getElementById('time-counter-minutes').innerText = minutes; | |||
document.getElementById('time-counter-seconds').innerText = seconds; | |||
} else { | |||
// Если целевая дата в будущем, можно добавить соответствующую обработку | |||
document.getElementById('time-counter').innerText = 'Счётчик запущен.'; | |||
} | |||
} | |||
setInterval(updateTimeCounter, 1000); // Обновляем каждую секунду | |||
document.addEventListener('DOMContentLoaded', updateTimeCounter); // Инициализируем при загрузке страницы | |||
document.addEventListener('DOMContentLoaded', function () { | |||
var tooltipContainers = document.querySelectorAll('.tooltip23-container'); | |||
tooltipContainers.forEach(function (container) { | |||
container.addEventListener('click', function () { | |||
// Скрыть все другие всплывающие окна | |||
tooltipContainers.forEach(function (otherContainer) { | |||
if (otherContainer !== container) { | |||
otherContainer.classList.remove('active'); | |||
} | |||
}); | |||
// Показать/скрыть текущее всплывающее окно | |||
container.classList.toggle('active'); | |||
}); | |||
}); | |||
// Скрыть всплывающее окно при клике вне элемента | |||
document.addEventListener('click', function (event) { | |||
tooltipContainers.forEach(function (container) { | |||
if (!container.contains(event.target)) { | |||
container.classList.remove('active'); | |||
} | |||
}); | |||
}); | |||
}); | |||
document.addEventListener('DOMContentLoaded', function() { | |||
var popup = document.getElementById('concert-list-popup'); | |||
var trigger = document.getElementById('concert-list-trigger'); | |||
var closeButton = document.querySelector('.close-button'); | |||
trigger.addEventListener('click', function() { | |||
popup.style.display = 'flex'; | |||
style. | }); | ||
closeButton.addEventListener('click', function() { | |||
popup.style.display = 'none'; | |||
}); | |||
window.addEventListener('click', function(event) { | |||
if (event.target == popup) { | |||
popup.style.display = 'none'; | |||
} | |||
}); | }); | ||
}); | }); | ||
document.addEventListener("DOMContentLoaded", function() { | |||
var trigger = document.getElementById("trigger"); | |||
var popup = document.getElementById("popup"); | |||
trigger.addEventListener("click", function() { | |||
if (popup.style.display === "none" || popup.style.display === "") { | |||
popup.style.display = "block"; | |||
popup.style.top = trigger.offsetTop + trigger.offsetHeight + "px"; | |||
popup.style.left = trigger.offsetLeft + "px"; | |||
} else { | |||
popup.style.display = "none"; | |||
} | |||
}); | |||
// Закрытие окна при клике вне его | |||
document.addEventListener("click", function(event) { | |||
if (!trigger.contains(event.target) && !popup.contains(event.target)) { | |||
popup.style.display = "none"; | |||
} | |||
}); | |||
}); | |||
// MediaWiki:Common.js | |||
$(document).ready(function() { | |||
var ctx = document.getElementById('myChart').getContext('2d'); | |||
var myChart = new Chart(ctx, { | |||
type: 'doughnut', | |||
data: { | |||
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'], | |||
datasets: [{ | |||
label: '# of Votes', | |||
data: [12, 19, 3, 5, 2, 3], | |||
backgroundColor: [ | |||
'rgba(255, 99, 132, 0.2)', | |||
'rgba(54, 162, 235, 0.2)', | |||
'rgba(255, 206, 86, 0.2)', | |||
'rgba(75, 192, 192, 0.2)', | |||
'rgba(153, 102, 255, 0.2)', | |||
'rgba(255, 159, 64, 0.2)' | |||
], | |||
borderColor: [ | |||
'rgba(255, 99, 132, 1)', | |||
'rgba(54, 162, 235, 1)', | |||
'rgba(255, 206, 86, 1)', | |||
'rgba(75, 192, 192, 1)', | |||
'rgba(153, 102, 255, 1)', | |||
'rgba(255, 159, 64, 1)' | |||
], | |||
borderWidth: 1 | |||
}] | |||
}, | |||
options: { | |||
responsive: true, | |||
maintainAspectRatio: false | |||
} | |||
}); | |||
}); | |||