Dantes (обсуждение | вклад) Нет описания правки |
Dantes (обсуждение | вклад) Нет описания правки |
||
| Строка 172: | Строка 172: | ||
document.body.appendChild(container); | document.body.appendChild(container); | ||
var styles = | var styles = [ | ||
.wiki_PlanetTable-container { | '.wiki_PlanetTable-container {', | ||
display: flex; | 'display: flex;', | ||
flex-wrap: wrap; | 'flex-wrap: wrap;', | ||
gap: 20px; | 'gap: 20px;', | ||
justify-content: center; | 'justify-content: center;', | ||
align-items: flex-start; | 'align-items: flex-start;', | ||
padding: 20px; | 'padding: 20px;', | ||
position: relative; | 'position: relative;', | ||
max-width: 100%; | 'max-width: 100%;', | ||
} | '}', | ||
'.wiki_PlanetTable-planet-block {', | |||
.wiki_PlanetTable-planet-block { | 'display: flex;', | ||
display: flex; | 'flex-direction: column;', | ||
flex-direction: column; | 'align-items: center;', | ||
align-items: center; | 'position: relative;', | ||
position: relative; | 'width: 300px;', | ||
width: 300px; | '}', | ||
} | '.wiki_PlanetTable-planet {', | ||
'width: 100px;', | |||
.wiki_PlanetTable-planet { | 'height: 100px;', | ||
width: 100px; | 'border-radius: 50%;', | ||
height: 100px; | 'background-color: #000;', | ||
border-radius: 50%; | 'overflow: hidden;', | ||
background-color: #000; | 'position: relative;', | ||
overflow: hidden; | 'animation: rotate-planet 5s linear infinite;', | ||
position: relative; | 'display: flex;', | ||
animation: rotate-planet 5s linear infinite; | 'justify-content: center;', | ||
display: flex; | 'align-items: center;', | ||
justify-content: center; | 'border: 2px solid #00ffe1;', | ||
align-items: center; | '}', | ||
border: 2px solid #00ffe1; | '.wiki_PlanetTable-planet img {', | ||
} | 'width: 100%;', | ||
'height: 100%;', | |||
.wiki_PlanetTable-planet img { | 'border-radius: 50%;', | ||
width: 100%; | '}', | ||
height: 100%; | '.wiki_PlanetTable-description {', | ||
border-radius: 50%; | 'background-color: rgba(20, 20, 20, 0.8);', | ||
} | 'border: 2px solid #00ffe1;', | ||
'border-radius: 8px;', | |||
.wiki_PlanetTable-description { | 'padding: 10px;', | ||
background-color: rgba(20, 20, 20, 0.8); | 'font-size: 14px;', | ||
border: 2px solid #00ffe1; | 'color: #cfcfcf;', | ||
border-radius: 8px; | 'margin-top: 10px;', | ||
padding: 10px; | 'width: 100%;', | ||
font-size: 14px; | 'text-align: center;', | ||
color: #cfcfcf; | '}', | ||
margin-top: 10px; | '.wiki_PlanetTable-line {', | ||
width: 100%; | 'width: 2px;', | ||
text-align: center; | 'height: 30px;', | ||
} | 'background-color: #00ffe1;', | ||
'margin: 10px 0;', | |||
.wiki_PlanetTable-line { | '}', | ||
width: 2px; | '@keyframes rotate-planet {', | ||
height: 30px; | 'from { transform: rotate(0deg); }', | ||
background-color: #00ffe1; | 'to { transform: rotate(360deg); }', | ||
margin: 10px 0; | '}' | ||
} | ].join('\n'); | ||
@keyframes rotate-planet { | |||
from { | |||
to { | |||
} | |||
var styleSheet = document.createElement("style"); | var styleSheet = document.createElement("style"); | ||
| Строка 246: | Строка 236: | ||
document.head.appendChild(styleSheet); | document.head.appendChild(styleSheet); | ||
})(); | })(); | ||
/* ----------------------------------------------------------Планеты лора------------------------------------------------------------------------ */ | /* ----------------------------------------------------------Планеты лора------------------------------------------------------------------------ */ | ||
Версия от 03:06, 21 ноября 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 items = document.querySelectorAll('.custom-item');
for (var i = 0; i < items.length; i++) {
(function (item) {
var link = item.querySelector('a');
if (link) {
item.style.cursor = 'pointer';
item.onclick = function () {
window.location.href = link.href;
};
item.onmouseover = function () {
item.style.transform = 'scale(1.05)';
item.style.boxShadow = '0 4px 15px rgba(255, 255, 255, 0.3)';
};
item.onmouseout = function () {
item.style.transform = 'scale(1)';
item.style.boxShadow = 'none';
};
}
})(items[i]);
}
});
/* ----------------------------------------------------------Главное меню лора------------------------------------------------------------------------ */
/* ----------------------------------------------------------Планеты лора------------------------------------------------------------------------ */
(function() {
var planetData = [
{
name: 'Земля',
image: 'Земля.png',
description: 'Столичный Мир. Третья по удалённости от Солнца планета в Солнечной системе...'
},
{
name: 'Марс',
image: 'Марс.png',
description: 'Известен как Красная планета...'
},
{
name: 'Юпитер',
image: 'Юпитер.png',
description: 'Газовый гигант с множеством спутников...'
},
{
name: 'Венера',
image: 'Венера.png',
description: 'Вторая планета от Солнца, известная своими плотными облаками...'
}
];
var container = document.createElement('div');
container.className = 'wiki_PlanetTable-container';
planetData.forEach(function(planet) {
var block = document.createElement('div');
block.className = 'wiki_PlanetTable-planet-block';
var planetDiv = document.createElement('div');
planetDiv.className = 'wiki_PlanetTable-planet';
var planetImg = document.createElement('img');
planetImg.src = 'File:' + planet.image;
planetImg.alt = planet.name;
planetDiv.appendChild(planetImg);
var line = document.createElement('div');
line.className = 'wiki_PlanetTable-line';
var descriptionDiv = document.createElement('div');
descriptionDiv.className = 'wiki_PlanetTable-description';
var heading = document.createElement('h2');
heading.textContent = planet.name;
descriptionDiv.appendChild(heading);
var paragraph = document.createElement('p');
paragraph.textContent = planet.description;
descriptionDiv.appendChild(paragraph);
block.appendChild(planetDiv);
block.appendChild(line);
block.appendChild(descriptionDiv);
container.appendChild(block);
});
document.body.appendChild(container);
var styles = [
'.wiki_PlanetTable-container {',
'display: flex;',
'flex-wrap: wrap;',
'gap: 20px;',
'justify-content: center;',
'align-items: flex-start;',
'padding: 20px;',
'position: relative;',
'max-width: 100%;',
'}',
'.wiki_PlanetTable-planet-block {',
'display: flex;',
'flex-direction: column;',
'align-items: center;',
'position: relative;',
'width: 300px;',
'}',
'.wiki_PlanetTable-planet {',
'width: 100px;',
'height: 100px;',
'border-radius: 50%;',
'background-color: #000;',
'overflow: hidden;',
'position: relative;',
'animation: rotate-planet 5s linear infinite;',
'display: flex;',
'justify-content: center;',
'align-items: center;',
'border: 2px solid #00ffe1;',
'}',
'.wiki_PlanetTable-planet img {',
'width: 100%;',
'height: 100%;',
'border-radius: 50%;',
'}',
'.wiki_PlanetTable-description {',
'background-color: rgba(20, 20, 20, 0.8);',
'border: 2px solid #00ffe1;',
'border-radius: 8px;',
'padding: 10px;',
'font-size: 14px;',
'color: #cfcfcf;',
'margin-top: 10px;',
'width: 100%;',
'text-align: center;',
'}',
'.wiki_PlanetTable-line {',
'width: 2px;',
'height: 30px;',
'background-color: #00ffe1;',
'margin: 10px 0;',
'}',
'@keyframes rotate-planet {',
'from { transform: rotate(0deg); }',
'to { transform: rotate(360deg); }',
'}'
].join('\n');
var styleSheet = document.createElement("style");
styleSheet.type = "text/css";
styleSheet.innerText = styles;
document.head.appendChild(styleSheet);
})();
/* ----------------------------------------------------------Планеты лора------------------------------------------------------------------------ */