|
|
Line 1: |
Line 1: |
| 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';
| |
| });
| |
|
| |
| 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
| |
| }
| |
| });
| |
| });
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
| document.addEventListener("DOMContentLoaded", function() {
| |
| var zoomBtn = document.getElementById('zoom-btn');
| |
| var image = document.getElementById('zoomable-image');
| |
| var zoomLevels = [1, 1.1, 1.2, 1.5, 1.8]; // Уровни зума
| |
| var currentZoomLevel = 0;
| |
|
| |
| if (zoomBtn && image) {
| |
| zoomBtn.addEventListener('click', function() {
| |
| currentZoomLevel = (currentZoomLevel + 1) % zoomLevels.length;
| |
| image.style.transform = 'scale(' + zoomLevels[currentZoomLevel] + ')';
| |
| zoomBtn.textContent = 'Zoom ' + Math.round((zoomLevels[currentZoomLevel] - 1) * 100) + '%';
| |
| });
| |
| }
| |
| });
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
| document.addEventListener("DOMContentLoaded", function() {
| |
| // Найдите элементы меню тем
| |
| var themeLinks = document.querySelectorAll('body #p-personal li#p-themes ul li a');
| |
|
| |
| // Измените названия тем
| |
| themeLinks.forEach(function(link) {
| |
| if (link.textContent.includes('⧼theme-sai⧽')) {
| |
| link.textContent = 'SaI';
| |
| }
| |
| // Добавьте дополнительные условия для других тем
| |
| });
| |
| });
| |
|
| |
|
| |
| /* Any JavaScript here will be loaded for all users on every page load. */
| |
|
| |
| mw.loader.using(['mediawiki.util'], function() {
| |
| var theme = mw.config.get('theme'); // Получить активную тему
| |
| if (theme === 'light') {
| |
| mw.util.addCSS('@import url("/extensions/ThemeToggle/modules/dropdownSwitcher/dark.css");');
| |
| } else if (theme === 'dark') {
| |
| mw.util.addCSS('@import url("/extensions/ThemeToggle/modules/dropdownSwitcher/dark.css");');
| |
| }
| |
| });
| |
|
| |
| document.addEventListener('DOMContentLoaded', function() {
| |
| const toggle = document.querySelector('.mw-customtoggle-myDivision23');
| |
| const collapsible = document.getElementById('mw-customcollapsible-myDivision23');
| |
|
| |
| toggle.addEventListener('click', function() {
| |
| collapsible.classList.toggle('open');
| |
| });
| |
| });
| |
|
| |
|
| |
|
| |
| document.addEventListener('DOMContentLoaded', function() {
| |
| const tooltipTriggers = document.querySelectorAll('.underline-hover');
| |
|
| |
| tooltipTriggers.forEach(trigger => {
| |
| trigger.addEventListener('click', function() {
| |
| const tooltip = this.querySelector('.tooltip-text');
| |
| tooltip.classList.toggle('show-tooltip');
| |
| });
| |
| });
| |
| });
| |
|
| |
|
| |
|
| |
| // Получаем кнопку Themetoggle
| |
| const themeToggleBtn = document.querySelector('.theme-toggle-btn');
| |
|
| |
| const infoboxElements = document.querySelectorAll('.infobox');
| |
|
| |
| themeToggleBtn.addEventListener('click', () => {
| |
| // Проверяем, какая тема выбрана, и соответственно применяем стили к infobox
| |
| if (themeToggleBtn.classList.contains('dark-theme')) {
| |
| infoboxElements.forEach(element => {
| |
| element.style.backgroundColor = '#333';
| |
| element.style.color = '#fff';
| |
| });
| |
| } else {
| |
| infoboxElements.forEach(element => {
| |
| element.style.backgroundColor = '#fff';
| |
| element.style.color = '#000';
| |
| });
| |
| }
| |
| });
| |
|
| |
| // Функция для генерации случайной страницы
| |
| function redirectToRandomPage() {
| |
| var pages = ['Page1', 'Page2', 'Page3']; // Замените на ваши страницы
| |
| var randomPage = pages[Math.floor(Math.random() * pages.length)];
| |
| window.location.href = mw.config.get('wgScript') + '?title=' + encodeURIComponent(randomPage);
| |
| }
| |
|
| |
| // Добавляем обработчик к ссылке
| |
| $(document).ready(function() {
| |
| $('#random-link').click(function(event) {
| |
| event.preventDefault(); // Предотвращаем стандартное действие ссылки
| |
| redirectToRandomPage();
| |
| });
| |
| });
| |
|
| |
| // Добавляем таблицу в нижний левый угол на всех страницах
| |
| $(document).ready(function() {
| |
| $('body').append('<div id="corner-table" class="wikitable" style="position: absolute; bottom: 0; left: 0; z-index: 1000;"><table><tr><td>Тест</td></tr></table></div>');
| |
| });
| |
|
| |
|
| |
| document.addEventListener("DOMContentLoaded", function() {
| |
| var themeElement = document.querySelector("body #p-personal li#p-themes");
| |
|
| |
| if (themeElement) {
| |
| themeElement.style.borderRight = "1px solid #333";
| |
| themeElement.style.padding = "0 .5em";
| |
| themeElement.style.marginRight = "0";
| |
| themeElement.style.position = "relative";
| |
| themeElement.style.listStyle = "none";
| |
| themeElement.style.color = "black"; // Черный цвет текста
| |
| }
| |
| })
| |