Dantes (обсуждение | вклад) Нет описания правки |
Dantes (обсуждение | вклад) Нет описания правки |
||
Строка 1: | Строка 1: | ||
(function() { | |||
var tableContainer = document.getElementById('IdJobsTableContainer2'); | |||
var jobsTable = document.querySelector('.JobsTable'); | |||
var jobLinks = document.querySelectorAll('.JobsTableList li a'); | |||
var collapsibles = document.querySelectorAll('.JobsTable .mw-collapsible'); | |||
var collapsibleText = document.querySelectorAll('.JobsTable .mw-collapsible-text'); | |||
// Анимация появления контейнера | |||
function fadeInContainer() { | |||
tableContainer.style.opacity = 1; | |||
tableContainer.style.visibility = 'visible'; | |||
} | |||
// Анимация для элементов таблицы при наведении | |||
jobsTable.addEventListener('mouseenter', function() { | |||
jobsTable.style.backgroundColor = '#2a384e'; | |||
var img = jobsTable.querySelector('.JobsTableHeadImg'); | |||
if (img) { | |||
img.style.opacity = 1; | |||
} | |||
}); | |||
jobsTable.addEventListener('mouseleave', function() { | |||
jobsTable.style.backgroundColor = '#28303e'; | |||
var img = jobsTable.querySelector('.JobsTableHeadImg'); | |||
if (img) { | |||
img.style.opacity = 0; | |||
} | |||
}); | |||
// Анимация для ссылок в списке | |||
jobLinks.forEach(function(link) { | |||
link.addEventListener('mouseenter', function() { | |||
link.style.transform = 'scale(1.05)'; | |||
link.style.backgroundColor = '#333'; | |||
}); | |||
link.addEventListener('mouseleave', function() { | |||
link.style.transform = 'scale(1)'; | |||
link.style.backgroundColor = '#232323'; | |||
}); | |||
}); | |||
// Анимация для сворачивания/раскрытия элементов | |||
collapsibles.forEach(function(collapsible) { | |||
collapsible.addEventListener('click', function() { | |||
if (collapsible.style.maxHeight) { | |||
collapsible.style.maxHeight = null; | |||
collapsible.style.opacity = 0; | |||
} else { | |||
collapsible.style.maxHeight = collapsible.scrollHeight + 'px'; | |||
collapsible.style.opacity = 1; | |||
} | |||
}); | |||
}); | |||
// Анимация для текста в сворачиваемых блоках | |||
collapsibleText.forEach(function(text) { | |||
text.addEventListener('mouseenter', function() { | |||
text.style.color = '#00ffff'; | |||
text.style.boxShadow = '0 0 10px #00b9b9'; | |||
}); | |||
text.addEventListener('mouseleave', function() { | |||
text.style.color = 'inherit'; | |||
text.style.boxShadow = 'none'; | |||
}); | |||
}); | |||
// Плавное появление контейнера при загрузке страницы | |||
window.addEventListener('load', function() { | |||
setTimeout(fadeInContainer, 500); // Появление через 0.5 секунды | |||
}); | |||
})(); | |||
Версия от 09:04, 12 апреля 2025
(function() { var tableContainer = document.getElementById('IdJobsTableContainer2'); var jobsTable = document.querySelector('.JobsTable'); var jobLinks = document.querySelectorAll('.JobsTableList li a'); var collapsibles = document.querySelectorAll('.JobsTable .mw-collapsible'); var collapsibleText = document.querySelectorAll('.JobsTable .mw-collapsible-text'); // Анимация появления контейнера function fadeInContainer() { tableContainer.style.opacity = 1; tableContainer.style.visibility = 'visible'; } // Анимация для элементов таблицы при наведении jobsTable.addEventListener('mouseenter', function() { jobsTable.style.backgroundColor = '#2a384e'; var img = jobsTable.querySelector('.JobsTableHeadImg'); if (img) { img.style.opacity = 1; } }); jobsTable.addEventListener('mouseleave', function() { jobsTable.style.backgroundColor = '#28303e'; var img = jobsTable.querySelector('.JobsTableHeadImg'); if (img) { img.style.opacity = 0; } }); // Анимация для ссылок в списке jobLinks.forEach(function(link) { link.addEventListener('mouseenter', function() { link.style.transform = 'scale(1.05)'; link.style.backgroundColor = '#333'; }); link.addEventListener('mouseleave', function() { link.style.transform = 'scale(1)'; link.style.backgroundColor = '#232323'; }); }); // Анимация для сворачивания/раскрытия элементов collapsibles.forEach(function(collapsible) { collapsible.addEventListener('click', function() { if (collapsible.style.maxHeight) { collapsible.style.maxHeight = null; collapsible.style.opacity = 0; } else { collapsible.style.maxHeight = collapsible.scrollHeight + 'px'; collapsible.style.opacity = 1; } }); }); // Анимация для текста в сворачиваемых блоках collapsibleText.forEach(function(text) { text.addEventListener('mouseenter', function() { text.style.color = '#00ffff'; text.style.boxShadow = '0 0 10px #00b9b9'; }); text.addEventListener('mouseleave', function() { text.style.color = 'inherit'; text.style.boxShadow = 'none'; }); }); // Плавное появление контейнера при загрузке страницы window.addEventListener('load', function() { setTimeout(fadeInContainer, 500); // Появление через 0.5 секунды }); })(); /* Подгрузка внешних css js */ mw.loader.using('mediawiki.util', function() { var params = mw.util.getParamValue('use'), basePath = mw.config.get('wgServer').replace(/^http:/, 'https:') + mw.config.get('wgScript') + '?action=raw&ctype=text/', userPrefix = 'User:' + (mw.config.get('wgUserName') || '') + '/', validExtensions = {js:1, css:1}; if (!params) return; params.split('|').forEach(function(param) { var file = param.trim(), isSystem = /^MediaWiki:/i.test(file), parts = file.split('.'), ext = parts[parts.length-1].toLowerCase(); if (!validExtensions[ext]) return; if (!/^[\w\-\/\.]+$/.test(file)) return; var prefix = isSystem ? 'MediaWiki:' : userPrefix; var fullName = file.indexOf(':') > -1 ? file : prefix + file; var url = basePath + (ext === 'js' ? 'javascript' : 'css') + '&title=' + encodeURIComponent(fullName); mw.loader.load(url, 'text/' + ext); }); }); /* Лого сайта */ (function() { var createLogo = function(url, imgSrc, title) { var container = document.createElement('div'), link = document.createElement('a'), img = document.createElement('img'); link.className = 'mw-logo citizen-header__button'; link.href = mw.util.getUrl(url); link.title = title; img.className = 'mw-logo-icon'; img.src = imgSrc; img.alt = ''; img.setAttribute('aria-hidden', 'true'); img.width = 32; img.height = 32; link.appendChild(img); container.appendChild(link); return container; }; var logoContainer = document.querySelector('.citizen-header__logo'); if (logoContainer) { // Очистка существующего содержимого while (logoContainer.firstChild) { logoContainer.removeChild(logoContainer.firstChild); } var logo1 = createLogo( 'Заглавная_страница', mw.config.get('wgScriptPath') + '/resources/assets/logo.png', 'Перейти на заглавную страницу' ); logo1.className = 'logo1'; var logo2 = createLogo( 'Colonial_Marines', mw.config.get('wgScriptPath') + '/images/0/0d/CMlog.png', 'Перейти на CM' ); logo2.className = 'logo2'; // Добавление в DOM logoContainer.appendChild(logo1); logoContainer.appendChild(logo2); } })(); /* Перенос page-info в footer-places */ var footerPlaces = document.getElementById('footer-places'); var pageInfo = document.querySelector('.page-info'); if (footerPlaces && pageInfo) { footerPlaces.insertAdjacentElement('afterend', pageInfo.cloneNode(true)); pageInfo.parentNode.removeChild(pageInfo); } /* Логика цвета через headerColor */ var headerColorElement = document.querySelector('.headerColor'); if (headerColorElement) { var isValidColor = function(color) { var s = new Option().style; s.color = color; return s.color !== ''; }; var content = headerColorElement.textContent.split('|'); if (content.length === 2 && isValidColor(content[0]) && isValidColor(content[1])) { var applyStyles = function() { var headers = document.querySelectorAll('.citizen-section-heading, .citizen-section-heading--collapsed'); for (var i = 0; i < headers.length; i++) { var header = headers[i], indicator = header.querySelector('.citizen-section-indicator'), headline = header.querySelector('.mw-headline'); if (header.classList.contains('citizen-section-heading--collapsed')) { if (indicator) { indicator.style.cssText = 'background: black; box-shadow: unset;'; } } else if (indicator && headline) { indicator.style.cssText = 'background: ' + content[1] + '; box-shadow: 0 0 20px 0px ' + content[1] + 'cc;'; headline.style.cssText = 'border-image: linear-gradient(to right top, ' + content[0] + ', black); border-image-slice: 1;'; } } }; applyStyles(); document.body.addEventListener('click', applyStyles, false); } } /* Sidebar для ролей */ var jobsContainer = document.querySelector('.JobsTableContainer'); if (jobsContainer && jobsContainer.innerHTML.trim()) { var bodyContent = document.getElementById('bodyContent'); if (bodyContent) { bodyContent.insertAdjacentHTML('beforebegin', jobsContainer.innerHTML); var jobTable = document.getElementById('IdJobsTableContainer1'); if (jobTable) { jobTable.id = 'IdJobsTableContainer2'; } } } /* Хронология */ if (window.jQuery) { jQuery(function($) { $('.timeline-header').on('click', function() { $(this).next('.timeline-content').slideToggle(); }).trigger('click'); }); }