Dantes (обсуждение | вклад) Нет описания правки |
Dantes (обсуждение | вклад) Нет описания правки |
||
Строка 1: | Строка 1: | ||
/* Лого сайта | /* Лого сайта Shegare */ | ||
Shegare */ | (function() { | ||
document.getElementsByClassName('citizen-header__logo')[0].innerHTML = | 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 */ | ||
Shegare */ | (function() { | ||
if (document.getElementsByClassName('headerColor').length >= 1) { | |||
document. | 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); | |||
if( | |||
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'); | |||
array.forEach(function(el) { | |||
if (el.classList.contains('citizen-section-heading')) { | |||
var sectionIndicator = el.querySelector('.citizen-sections-enabled,.citizen-section-indicator'); | |||
if (sectionIndicator) { | |||
sectionIndicator.style.background = colorBtn; | |||
sectionIndicator.style.boxShadow = '0 0 20px 0px ' + colorBtn + 'cc'; | |||
} | |||
} | var headline = el.querySelector('.mw-headline'); | ||
if (headline) { | |||
headline.style.borderImage = 'linear-gradient(to right top, ' + colorBorder + ', black)'; | |||
headline.style.borderImageSlice = '1'; | |||
} | |||
} else if (el.classList.contains('citizen-section-heading--collapsed')) { | |||
var collapsedIndicator = el.querySelector('.citizen-sections-enabled,.citizen-section-heading--collapsed,.citizen-section-indicator'); | |||
if (collapsedIndicator) { | |||
collapsedIndicator.style.background = 'black'; | |||
collapsedIndicator.style.boxShadow = 'unset'; | |||
} | |||
} | |||
}); | |||
} | } | ||
function | /* Sidebar для ролей Shegare */ | ||
var | (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) { | function filterEvents(category) { | ||
var events = document.querySelectorAll('.event'); | |||
events.forEach(function(event) { | |||
if (event.dataset.category === category) { | |||
event.style.display = 'block'; | |||
} else { | |||
event.style.display = 'none'; | |||
} | |||
}); | |||
} | } |
Версия от 04:14, 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'); array.forEach(function(el) { if (el.classList.contains('citizen-section-heading')) { var sectionIndicator = el.querySelector('.citizen-sections-enabled,.citizen-section-indicator'); if (sectionIndicator) { sectionIndicator.style.background = colorBtn; sectionIndicator.style.boxShadow = '0 0 20px 0px ' + colorBtn + 'cc'; } var headline = el.querySelector('.mw-headline'); if (headline) { headline.style.borderImage = 'linear-gradient(to right top, ' + colorBorder + ', black)'; headline.style.borderImageSlice = '1'; } } else if (el.classList.contains('citizen-section-heading--collapsed')) { var collapsedIndicator = el.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'); events.forEach(function(event) { if (event.dataset.category === category) { event.style.display = 'block'; } else { event.style.display = 'none'; } }); }