Dantes (обсуждение | вклад) Нет описания правки Метка: ручная отмена |
Dantes (обсуждение | вклад) Нет описания правки Метка: ручная отмена |
||
| Строка 78: | Строка 78: | ||
}); | }); | ||
/*------------------------------------------------ | /*------------------------------------------------Полигон-----------------------------------------------------------------------------*/ | ||
/* Внешние JS файлы? | /* Внешние JS файлы? | ||
| Строка 89: | Строка 89: | ||
* @revision 2023-09-24 | * @revision 2023-09-24 | ||
*/ | */ | ||
mw.loader.using('mediawiki.util', function () { | mw.loader.using( 'mediawiki.util', function () { | ||
var files = mw.util.getParamValue( 'use' ), user, FileRE, ExtRE, path; | |||
if ( !files ) { | |||
return; | |||
} | |||
user = mw.util.escapeRegExp( mw.config.get( 'wgUserName', '' ) ); | |||
FileRE = new RegExp( '^(?:MediaWiki:' + ( user ? '|User:' + user + '/' : '' ) + ')[^&<>=%#]*\\.(js|css)$' ); | |||
ExtRE = new RegExp( '^ext\\.[^,]+$' ); | |||
path = mw.config.get('wgServer') | |||
+ mw.config.get('wgScript') | |||
+ '?action=raw&ctype=text/'; | |||
$.each( files.split( '|' ), function(k, v) { | |||
var f = $.trim( v ), what = FileRE.exec( f ) || ['', '']; | |||
switch ( what[1] ) { | |||
case 'js': | |||
mw.loader.load( path + 'javascript&title=' + encodeURIComponent( f ) ); | |||
break; | |||
case 'css': | |||
mw.loader.load( path + 'css&title=' + encodeURIComponent( f ) ); | |||
break; | |||
default: | |||
if ( ExtRE.exec( f ) ) { | |||
mw.loader.load(f); | |||
} | |||
} | |||
}); | |||
}); | }); | ||
*/ | |||
Версия от 08:59, 17 января 2025
/* ----------------------------------------------Блок 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('bodyContent').insertAdjacentHTML('beforebegin', document.getElementsByClassName('JobsTableContainer')[0].innerHTML);
document.getElementById('IdJobsTableContainer1').id = 'IdJobsTableContainer2';
}
/* End sidebar для ролей
Shegare */
/* ----------------------------------------------------------Данте------------------------------------------------------------------------ */
/* ----------------------------------------------------------Главное меню лора------------------------------------------------------------------------ */
document.querySelectorAll('.custom-item').forEach(function(item) {
item.addEventListener('click', function() {
window.location.href = item.querySelector('a').getAttribute('href');
});
});
/*------------------------------------------------Полигон-----------------------------------------------------------------------------*/
/* Внешние JS файлы?
/**
* Load CSS and JS files temporarily through URL.
* &use=File1.css|File2.css|File3.js
*
* Required modules: mediawiki.util
* @source https://www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL#Load_multiple_files
* @revision 2023-09-24
*/
mw.loader.using( 'mediawiki.util', function () {
var files = mw.util.getParamValue( 'use' ), user, FileRE, ExtRE, path;
if ( !files ) {
return;
}
user = mw.util.escapeRegExp( mw.config.get( 'wgUserName', '' ) );
FileRE = new RegExp( '^(?:MediaWiki:' + ( user ? '|User:' + user + '/' : '' ) + ')[^&<>=%#]*\\.(js|css)$' );
ExtRE = new RegExp( '^ext\\.[^,]+$' );
path = mw.config.get('wgServer')
+ mw.config.get('wgScript')
+ '?action=raw&ctype=text/';
$.each( files.split( '|' ), function(k, v) {
var f = $.trim( v ), what = FileRE.exec( f ) || ['', ''];
switch ( what[1] ) {
case 'js':
mw.loader.load( path + 'javascript&title=' + encodeURIComponent( f ) );
break;
case 'css':
mw.loader.load( path + 'css&title=' + encodeURIComponent( f ) );
break;
default:
if ( ExtRE.exec( f ) ) {
mw.loader.load(f);
}
}
});
});
*/