Dantes (обсуждение | вклад) Нет описания правки |
Dantes (обсуждение | вклад) Нет описания правки |
||
Строка 82: | Строка 82: | ||
mw.loader.using(['mediawiki.util'], function () { | mw.loader.using(['mediawiki.util'], function () { | ||
var customItems = document.querySelectorAll('.custom-item'); | var customItems = document.querySelectorAll('.custom-item'); | ||
var | var colorVars = [ | ||
'var(--color-1)', | |||
'var(--color-2)', | |||
'var(--color-3)', | |||
'var(--color-4)', | |||
'var(--color-5)', | |||
'var(--color-6)' | |||
]; | |||
for (var i = 0; i < customItems.length; i++) { | for (var i = 0; i < customItems.length; i++) { | ||
Строка 95: | Строка 102: | ||
} | } | ||
item.style.borderColor = | item.style.borderColor = colorVars[index % colorVars.length]; | ||
item.style.transition = 'all | item.style.transition = 'all var(--transition-duration)'; | ||
item.onmouseover = function () { | item.onmouseover = function () { | ||
item.style.backgroundColor = | item.style.backgroundColor = colorVars[index % colorVars.length]; | ||
item.style.color = ' | item.style.color = 'var(--hover-text-color)'; | ||
item.style.boxShadow = '0 0 20px ' + | item.style.boxShadow = '0 0 20px ' + colorVars[index % colorVars.length]; | ||
item.style.transform = 'scale(1.05)'; | item.style.transform = 'scale(1.05)'; | ||
item.style.transition = 'all | item.style.transition = 'all var(--transition-duration)'; | ||
}; | }; | ||
item.onmouseout = function () { | item.onmouseout = function () { | ||
item.style.backgroundColor = ' | item.style.backgroundColor = 'var(--item-bg-color)'; | ||
item.style.color = ' | item.style.color = 'var(--text-color)'; | ||
item.style.boxShadow = 'none'; | item.style.boxShadow = 'none'; | ||
item.style.transform = 'scale(1)'; | item.style.transform = 'scale(1)'; | ||
item.style.transition = 'all | item.style.transition = 'all var(--transition-duration)'; | ||
}; | }; | ||
Строка 118: | Строка 125: | ||
item.style.transform = 'scale(1.1)'; | item.style.transform = 'scale(1.1)'; | ||
setTimeout(function () { | setTimeout(function () { | ||
item.style.transition = 'all | item.style.transition = 'all var(--transition-duration)'; | ||
item.style.transform = 'scale(1)'; | item.style.transform = 'scale(1)'; | ||
}, 100); | }, 100); | ||
Строка 129: | Строка 136: | ||
var styleSheet = document.createElement("style"); | var styleSheet = document.createElement("style"); | ||
styleSheet.type = "text/css"; | styleSheet.type = "text/css"; | ||
styleSheet.innerHTML = | styleSheet.innerHTML = ` | ||
@keyframes pulse-effect { | |||
0% { background-color: var(--item-bg-color); border-color: var(--color-1); box-shadow: 0 0 15px var(--color-1); } | |||
25% { background-color: var(--item-bg-color); border-color: var(--color-2); box-shadow: 0 0 15px var(--color-2); } | |||
50% { background-color: var(--item-bg-color); border-color: var(--color-3); box-shadow: 0 0 15px var(--color-3); } | |||
75% { background-color: var(--item-bg-color); border-color: var(--color-4); box-shadow: 0 0 15px var(--color-4); } | |||
100% { background-color: var(--item-bg-color); border-color: var(--color-5); box-shadow: 0 0 15px var(--color-5); } | |||
} | |||
`; | |||
document.head.appendChild(styleSheet); | document.head.appendChild(styleSheet); | ||
}); | }); |
Версия от 14:03, 20 ноября 2024
/* ----------------------------------------------Блок Shegare ---------------------------------------------------------------------------------*/ /* Лого сайта Shegare */ 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>'; /* Перенос page-info в конец footer-places Shegare */ document.getElementById('footer-places').insertAdjacentHTML('afterEnd', document.getElementsByClassName('page-info')[0].innerHTML); document.getElementsByClassName('page-info')[0].innerHTML = null; /* Begin логика цвета через headerColor Shegare */ 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'); var colorBorder = ''; var colorBtn = ''; var i = 0; for(; header[0].innerHTML[i] !== '|' && i < header[0].innerHTML.length; i++) { colorBorder += header[0].innerHTML[i]; } i++; for(; i < header[0].innerHTML.length; i++) { colorBtn += header[0].innerHTML[i]; } if(isValidColor(colorBorder) && isValidColor(colorBtn) && header[0].innerHTML.length > 0) { headerRender (colorBorder, colorBtn); document.body.addEventListener('click', function() { headerRender(colorBorder, colorBtn); }); } else { throw "headerColor"; } } function headerRender (colorBorder, colorBtn) { var array = document.querySelectorAll('h1, h2, h3 , h4, h5'); for(var i = 0; i < array.length; i++) { if (array[i].className === 'citizen-section-heading') { array[i].querySelector('.citizen-sections-enabled,.citizen-section-indicator').style.background = colorBtn; array[i].querySelector('.citizen-sections-enabled,.citizen-section-indicator').style.boxShadow = ('0 0 20px 0px ' + colorBtn + 'cc'); array[i].querySelector('.mw-headline').style.borderImage = ('linear-gradient(to right top, ' + colorBorder + ', black)'); array[i].querySelector('.mw-headline').style.borderImageSlice = '1'; } else if(array[i].className === 'citizen-section-heading citizen-section-heading--collapsed') { array[i].querySelector('.citizen-sections-enabled,.citizen-section-heading--collapsed,.citizen-section-indicator').style.background = 'black'; array[i].querySelector('.citizen-sections-enabled,.citizen-section-heading--collapsed,.citizen-section-indicator').style.boxShadow = 'unset'; } } } /* End логика цвета через headerColor Shegare */ /* Begin sidebar для ролей Shegare */ if(document.getElementsByClassName('JobsTableContainer').length >= 1) { document.getElementById('content').insertAdjacentHTML('afterbegin', document.getElementsByClassName('JobsTableContainer')[0].innerHTML); document.getElementById('IdJobsTableContainer1').id = 'IdJobsTableContainer2'; document.getElementById('content').style.display = 'flex'; document.getElementById('bodyContent').style.minHeight = '1350px'; } /* ----------------------------------------------------------Данте------------------------------------------------------------------------*/ mw.loader.using(['mediawiki.util'], function () { var customItems = document.querySelectorAll('.custom-item'); var colorVars = [ 'var(--color-1)', 'var(--color-2)', 'var(--color-3)', 'var(--color-4)', 'var(--color-5)', 'var(--color-6)' ]; for (var i = 0; i < customItems.length; i++) { (function (item, index) { var link = item.querySelector('a') || item.querySelector('.custom-text a'); if (link) { item.style.cursor = 'pointer'; item.onclick = function () { window.location.href = link.href; }; } item.style.borderColor = colorVars[index % colorVars.length]; item.style.transition = 'all var(--transition-duration)'; item.onmouseover = function () { item.style.backgroundColor = colorVars[index % colorVars.length]; item.style.color = 'var(--hover-text-color)'; item.style.boxShadow = '0 0 20px ' + colorVars[index % colorVars.length]; item.style.transform = 'scale(1.05)'; item.style.transition = 'all var(--transition-duration)'; }; item.onmouseout = function () { item.style.backgroundColor = 'var(--item-bg-color)'; item.style.color = 'var(--text-color)'; item.style.boxShadow = 'none'; item.style.transform = 'scale(1)'; item.style.transition = 'all var(--transition-duration)'; }; item.onclick = function () { item.style.transition = 'none'; item.style.transform = 'scale(1.1)'; setTimeout(function () { item.style.transition = 'all var(--transition-duration)'; item.style.transform = 'scale(1)'; }, 100); }; item.style.animation = 'pulse-effect 3s ease-in-out infinite'; })(customItems[i], i); } var styleSheet = document.createElement("style"); styleSheet.type = "text/css"; styleSheet.innerHTML = ` @keyframes pulse-effect { 0% { background-color: var(--item-bg-color); border-color: var(--color-1); box-shadow: 0 0 15px var(--color-1); } 25% { background-color: var(--item-bg-color); border-color: var(--color-2); box-shadow: 0 0 15px var(--color-2); } 50% { background-color: var(--item-bg-color); border-color: var(--color-3); box-shadow: 0 0 15px var(--color-3); } 75% { background-color: var(--item-bg-color); border-color: var(--color-4); box-shadow: 0 0 15px var(--color-4); } 100% { background-color: var(--item-bg-color); border-color: var(--color-5); box-shadow: 0 0 15px var(--color-5); } } `; document.head.appendChild(styleSheet); });