Dantes (обсуждение | вклад) Нет описания правки |
Dantes (обсуждение | вклад) Нет описания правки |
||
| Строка 55: | Строка 55: | ||
function headerRender(colorBorder, colorBtn) { | function headerRender(colorBorder, colorBtn) { | ||
var array = document.querySelectorAll('h1, h2, h3 , h4, h5'); | var array = document.querySelectorAll('h1, h2, h3 , h4, h5'); | ||
array. | for (var i = 0; i < array.length; i++) { | ||
if ( | if (array[i].classList.contains('citizen-section-heading')) { | ||
var sectionIndicator = | var sectionIndicator = array[i].querySelector('.citizen-sections-enabled,.citizen-section-indicator'); | ||
if (sectionIndicator) { | if (sectionIndicator) { | ||
sectionIndicator.style.background = colorBtn; | sectionIndicator.style.background = colorBtn; | ||
sectionIndicator.style.boxShadow = '0 0 20px 0px ' + colorBtn + 'cc'; | sectionIndicator.style.boxShadow = '0 0 20px 0px ' + colorBtn + 'cc'; | ||
} | } | ||
var headline = | var headline = array[i].querySelector('.mw-headline'); | ||
if (headline) { | if (headline) { | ||
headline.style.borderImage = 'linear-gradient(to right top, ' + colorBorder + ', black)'; | headline.style.borderImage = 'linear-gradient(to right top, ' + colorBorder + ', black)'; | ||
headline.style.borderImageSlice = '1'; | headline.style.borderImageSlice = '1'; | ||
} | } | ||
} else if ( | } else if (array[i].classList.contains('citizen-section-heading--collapsed')) { | ||
var collapsedIndicator = | var collapsedIndicator = array[i].querySelector('.citizen-sections-enabled,.citizen-section-heading--collapsed,.citizen-section-indicator'); | ||
if (collapsedIndicator) { | if (collapsedIndicator) { | ||
collapsedIndicator.style.background = 'black'; | collapsedIndicator.style.background = 'black'; | ||
| Строка 74: | Строка 74: | ||
} | } | ||
} | } | ||
} | } | ||
} | } | ||
| Строка 94: | Строка 94: | ||
function filterEvents(category) { | function filterEvents(category) { | ||
var events = document.querySelectorAll('.event'); | var events = document.querySelectorAll('.event'); | ||
events. | for (var i = 0; i < events.length; i++) { | ||
if ( | if (events[i].dataset.category === category) { | ||
events[i].style.display = 'block'; | |||
} else { | } else { | ||
events[i].style.display = 'none'; | |||
} | } | ||
} | } | ||
} | } | ||
Версия от 04:16, 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';
}
})();
/* Фильтрация событий по категории */
function filterEvents(category) {
var events = document.querySelectorAll('.event');
for (var i = 0; i < events.length; i++) {
if (events[i].dataset.category === category) {
events[i].style.display = 'block';
} else {
events[i].style.display = 'none';
}
}
}