Dantes (обсуждение | вклад) Нет описания правки |
Dantes (обсуждение | вклад) Нет описания правки |
||
Строка 91: | Строка 91: | ||
})(); | })(); | ||
/* | /* --------------------------------------------------------------------------------------------------------------------- */ | ||
function | |||
window.addEventListener('scroll', function() { | |||
const events = document.querySelectorAll('.event'); | |||
const offset = window.scrollY + window.innerHeight; | |||
events.forEach(event => { | |||
const eventPos = event.offsetTop; | |||
if (eventPos - offset < 100 && eventPos > 0) { | |||
event.classList.add('visible'); | |||
} else { | |||
event.classList.remove('visible'); | |||
} | } | ||
} | }); | ||
}); |
Версия от 04:25, 17 ноября 2024
/* Лого сайта Shegare */ (function() { var logo = document.getElementsByClassName('citizen-header__logo')[0]; if (logo) { logo.innerHTML = '<div class="logo1">' + '<a href="https://spacestories.club/index.php?title=Заглавная страница" class="mw-logo citizen-header__button" title="Перейти на заглавную страницу">' + '<img class="mw-logo-icon" src="/resources/assets/logo.png" alt="" aria-hidden="true" height="32" width="32"/>' + '</a>' + '</div>' + '<div class="logo2">' + '<a href="https://spacestories.club/index.php?title=Colonial_Marines" class="mw-logo citizen-header__button" title="Перейти на заглавную страницу CM">' + '<img class="mw-logo-icon" src="/images/0/0d/CMlog.png" alt="" aria-hidden="true" height="32" width="32"/>' + '</a>' + '</div>'; } })(); /* Перенос page-info в конец footer-places Shegare */ (function() { var footerPlaces = document.getElementById('footer-places'); var pageInfo = document.getElementsByClassName('page-info')[0]; if (footerPlaces && pageInfo) { footerPlaces.insertAdjacentHTML('afterEnd', pageInfo.innerHTML); pageInfo.innerHTML = ''; // Очистка содержимого } })(); /* Логика цвета через headerColor Shegare */ (function() { if (document.getElementsByClassName('headerColor').length >= 1) { var isValidColor = function(color) { var el = document.createElement('div'); el.style.backgroundColor = color; return el.style.backgroundColor ? true : false; }; var header = document.getElementsByClassName('headerColor')[0]; var colorParts = header.innerHTML.split('|'); var colorBorder = colorParts[0] || ''; var colorBtn = colorParts[1] || ''; if (isValidColor(colorBorder) && isValidColor(colorBtn) && header.innerHTML.length > 0) { headerRender(colorBorder, colorBtn); document.body.addEventListener('click', function() { headerRender(colorBorder, colorBtn); }); } else { throw "Invalid headerColor values"; } } })(); function headerRender(colorBorder, colorBtn) { var array = document.querySelectorAll('h1, h2, h3 , h4, h5'); for (var i = 0; i < array.length; i++) { if (array[i].classList.contains('citizen-section-heading')) { var sectionIndicator = array[i].querySelector('.citizen-sections-enabled,.citizen-section-indicator'); if (sectionIndicator) { sectionIndicator.style.background = colorBtn; sectionIndicator.style.boxShadow = '0 0 20px 0px ' + colorBtn + 'cc'; } var headline = array[i].querySelector('.mw-headline'); if (headline) { headline.style.borderImage = 'linear-gradient(to right top, ' + colorBorder + ', black)'; headline.style.borderImageSlice = '1'; } } else if (array[i].classList.contains('citizen-section-heading--collapsed')) { var collapsedIndicator = array[i].querySelector('.citizen-sections-enabled,.citizen-section-heading--collapsed,.citizen-section-indicator'); if (collapsedIndicator) { collapsedIndicator.style.background = 'black'; collapsedIndicator.style.boxShadow = 'unset'; } } } } /* Sidebar для ролей Shegare */ (function() { var jobsTableContainer = document.getElementsByClassName('JobsTableContainer')[0]; if (jobsTableContainer) { document.getElementById('content').insertAdjacentHTML('afterbegin', jobsTableContainer.innerHTML); var jobTable = document.getElementById('IdJobsTableContainer1'); if (jobTable) { jobTable.id = 'IdJobsTableContainer2'; } document.getElementById('content').style.display = 'flex'; document.getElementById('bodyContent').style.minHeight = '1350px'; } })(); /* --------------------------------------------------------------------------------------------------------------------- */ window.addEventListener('scroll', function() { const events = document.querySelectorAll('.event'); const offset = window.scrollY + window.innerHeight; events.forEach(event => { const eventPos = event.offsetTop; if (eventPos - offset < 100 && eventPos > 0) { event.classList.add('visible'); } else { event.classList.remove('visible'); } }); });