Dantes (обсуждение | вклад) Нет описания правки |
Dantes (обсуждение | вклад) Нет описания правки |
||
| Строка 51: | Строка 51: | ||
// Шаблон JobHeaderTEST | // Шаблон JobHeaderTEST | ||
// Функция для сворачивания | // Функция для разворачивания/сворачивания раздела "Руководства" | ||
function toggleContent( | function toggleContent(el) { | ||
var content = el.nextElementSibling; | |||
if (content.style.display === "block") { | |||
content.style.display = "none"; | |||
el.innerHTML = "Руководства ▼"; | |||
} else { | |||
content.style.display = "block"; | |||
el.innerHTML = "Руководства ▲"; | |||
} | |||
} | } | ||
// Пример выполнения другой задачи для изменения элементов на странице (на основе вашего примера) | |||
function headerRender () { | |||
var headers = document.querySelectorAll('h1, h2, h3, h4, h5'); | |||
headers.forEach(function(header) { | |||
if (header.classList.contains('citizen-section-heading--collapsed')) { | |||
var indicator = header.querySelector('.citizen-sections-enabled,.citizen-section-indicator'); | |||
if (indicator) { | |||
indicator.style.background = 'red'; | |||
indicator.style.boxShadow = '0 0 20px 0px red'; | |||
} | |||
} | |||
}); | |||
} | |||
// Инициализация при загрузке страницы | |||
document.addEventListener('DOMContentLoaded', function() { | |||
headerRender(); // Примерный скрипт для вашего другого запроса | |||
}); | |||
// Шаблон JobHeaderTEST | // Шаблон JobHeaderTEST | ||
Версия от 16:12, 22 сентября 2024
headerRender ();
function headerClick() {
headerRender ()
}
function headerRender () {
if(document.getElementsByClassName('headerColor').length >= 1) {
function headerEdit(el) {
console.log(el.className)
el.setAttribute('onclick', 'headerClick()');
if (el.className !== 'citizen-section-heading citizen-section-heading--collapsed') {
if (el.querySelector('.citizen-sections-enabled,.citizen-section-indicator') !== null) {
el.querySelector('.citizen-sections-enabled,.citizen-section-indicator').style.background = 'red';
el.querySelector('.citizen-sections-enabled,.citizen-section-indicator').style.boxShadow = '0 0 20px 0px red';
}
if (el.querySelector('.mw-headline') !== null) {
el.querySelector('.mw-headline').style.borderImage = 'linear-gradient(to right top, red, red, red)';
el.querySelector('.mw-headline').style.borderImageSlice = '1';
}
}
else if(el.querySelector('.citizen-sections-enabled,.citizen-section-heading--collapsed') !== null){
console.log(el.querySelector('.citizen-sections-enabled,.citizen-section-heading--collapsed,.citizen-section-indicator'))
el.querySelector('.citizen-sections-enabled,.citizen-section-heading--collapsed,.citizen-section-indicator').style.background = 'black';
el.querySelector('.citizen-sections-enabled,.citizen-section-heading--collapsed,.citizen-section-indicator').style.boxShadow = 'unset';
}
}
console.log(document.querySelectorAll('h1, h2, h3 , h4, h5'))
document.querySelectorAll('h1, h2, h3 , h4, h5').forEach(headerEdit);
}
}
// Лого сайта
document.getElementsByClassName('citizen-header__logo')[0].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>';
// Для поиска и применения стилей к .citizen-table-wrapper
document.querySelectorAll('.citizen-table-wrapper').forEach(function(wrapper) {
if (wrapper.querySelector('.job_gear')) {
wrapper.style.overflowX = 'unset'; // Применяем стиль
}
});
// Для поиска и применения стилей к .citizen-overflow--right
document.querySelectorAll('.citizen-overflow--right').forEach(function(overflowRight) {
if (overflowRight.querySelector('.job_gear')) {
overflowRight.style.webkitMaskImage = 'unset'; // Для WebKit браузеров (Safari)
overflowRight.style.maskImage = 'unset'; // Для остальных браузеров
}
});
// Шаблон JobHeaderTEST
// Функция для разворачивания/сворачивания раздела "Руководства"
function toggleContent(el) {
var content = el.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
el.innerHTML = "Руководства ▼";
} else {
content.style.display = "block";
el.innerHTML = "Руководства ▲";
}
}
// Пример выполнения другой задачи для изменения элементов на странице (на основе вашего примера)
function headerRender () {
var headers = document.querySelectorAll('h1, h2, h3, h4, h5');
headers.forEach(function(header) {
if (header.classList.contains('citizen-section-heading--collapsed')) {
var indicator = header.querySelector('.citizen-sections-enabled,.citizen-section-indicator');
if (indicator) {
indicator.style.background = 'red';
indicator.style.boxShadow = '0 0 20px 0px red';
}
}
});
}
// Инициализация при загрузке страницы
document.addEventListener('DOMContentLoaded', function() {
headerRender(); // Примерный скрипт для вашего другого запроса
});
// Шаблон JobHeaderTEST