Dantes (обсуждение | вклад) Нет описания правки Метка: ручная отмена |
Dantes (обсуждение | вклад) Нет описания правки |
||
| Строка 1: | Строка 1: | ||
const currentURL = window.location.href; | |||
function kerisarTest() { | |||
console.log("Проверка консоли"); | |||
const currentUrl = window.location.href; | |||
console.log("currentUrl", currentUrl); | |||
const jsTest = document.getElementById("jsTest"); | |||
console.log("jsTest", jsTest); | |||
const buttonTest = document.createElement('button'); | |||
buttonTest.classList.add('testButtonJs'); | |||
buttonTest.textContent = "Привет, я кнопка. Пока я ничего не делаю"; | |||
jsTest.appendChild(buttonTest); | |||
const kerisarPicture = document.createElement('img'); | |||
kerisarPicture.setAttribute('src', | |||
"https://thumb.cloud.mail.ru/weblink/thumb/xw1/LLmd/Qui7Xbp6g"); | |||
jsTest.appendChild(kerisarPicture); | |||
const iFrameFrontier = document.createElement('iframe'); | |||
iFrameFrontier.setAttribute('src',"https://arles.station14.ru/frontier-main/server/status"); | |||
jsTest.appendChild(iFrameFrontier); | |||
const iFrameStalker = document.createElement('iframe'); | |||
iFrameStalker.setAttribute('src',"https://game.stalkers14.xyz/status"); | |||
jsTest.appendChild(iFrameStalker); | |||
const iFrameWiki = document.createElement('iframe'); | |||
iFrameWiki.setAttribute('src',"https://station14.ru/wiki/%D0%A0%D0%BE%D0%B1%D0%BE%D1%82%D0%BE%D1%82%D0%B5%D1%85%D0%BD%D0%B8%D0%BA%D0%B0"); | |||
jsTest.appendChild(iFrameWiki); | |||
const scriptTest = document.createElement('script'); | |||
scriptTest.setAttribute('src',"https://game.stalkers14.xyz/status"); | |||
jsTest.appendChild(scriptTest); | |||
} | |||
function getServersInfo(connect, callback) { | |||
const xhr = new XMLHttpRequest(); | |||
xhr.open('GET', connect, true); | |||
xhr.onload = function() { | |||
if (xhr.status >= 200 && xhr.status < 300) { | |||
const data = JSON.parse(xhr.responseText); | |||
callback(null, data); | |||
} else { | |||
callback('Ошибка при выполнении запроса: ' + xhr.status, null); | |||
} | |||
}; | |||
xhr.onerror = function() { | |||
callback('Ошибка при выполнении запроса', null); | |||
}; | |||
xhr.send(); | |||
} | |||
function shangeServersInfo(serverObj, serverName) { | |||
console.log(serverObj, serverName); | |||
if (currentURL.includes("Kerisar")) { | |||
const serverStatusFrame = document.getElementById(serverName); | |||
//console.log("serverStatusFrame", serverStatusFrame); | |||
serverStatusFrame.querySelector(".serverInfoRoundSet").textContent = "#" + serverObj.round; | |||
if (serverObj.status === 0) { | |||
serverStatusFrame.querySelector(".serverStatusSet").textContent = "Лобби"; | |||
} | |||
if (serverObj.status === 1) { | |||
serverStatusFrame.querySelector(".serverStatusSet").textContent = "Раунд идёт"; | |||
} | |||
if (serverObj.status === 2) { | |||
serverStatusFrame.querySelector(".serverStatusSet").textContent = "Завершение"; | |||
} | |||
serverStatusFrame.querySelector(".serverMapSet").textContent = serverObj.map; | |||
serverStatusFrame.querySelector(".serverTimeSet").textContent = serverObj.time; | |||
serverStatusFrame.querySelector(".serverPlayersSet").textContent = serverObj.players; | |||
serverStatusFrame.querySelector(".serverPresetSet").textContent = serverObj.preset; | |||
} | |||
} | |||
function standartServersInfo(connect, name) { | |||
getServersInfo(connect, function(error, data) { | |||
if (error) { | |||
console.error(error); // Обработка ошибок | |||
} else { | |||
//console.log("Ответ получен", data) | |||
const serverInfo = { | |||
name: data.name, | |||
round: data.round_id, | |||
status: data.run_level, | |||
map: data.map, | |||
time: new Date(data.round_start_time).toLocaleString(), | |||
players: data.players, | |||
preset: data.preset | |||
}; | |||
shangeServersInfo(serverInfo, name); | |||
//console.log(serverInfo); | |||
} | |||
}); | |||
} | |||
function standartServersInfoAll() { | |||
for (var i = 0; i < serversStatus.length; i++) { | |||
standartServersInfo(serversStatus[i].connect, serversStatus[i].name); | |||
} | |||
} | |||
function customCSS(textCSS){ | |||
const styleSheet = document.createElement("style"); | |||
styleSheet.textContent = textCSS; | |||
//console.log(textCSS); | |||
document.head.appendChild(styleSheet); | |||
} | |||
$(document).ready(function() { | |||
if (currentURL.includes("Kerisar")) { | |||
kerisarTest(); | |||
standartServersInfoAll(); | |||
} | |||
var cssEls = document.querySelectorAll('.customCSS'); | |||
if (cssEls.length > 0) { | |||
for (var i = 0; i < cssEls.length; i++) { | |||
const textCSS = cssEls[i].textContent; | |||
console.log(textCSS); | |||
customCSS(textCSS); | |||
} | |||
} | |||
}); | |||
/*WikiEditor/Викификатор*/ | |||
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) { | |||
mw.loader.load( | |||
'//ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-wikificator.js&action=raw&ctype=text/javascript' | |||
); | |||
} | |||
var customizeToolbar = function() { | |||
$('#wpTextbox1').wikiEditor('addToToolbar', { | |||
'section': 'advanced', | |||
'group': 'format', | |||
'tools': { | |||
'wikify': { | |||
label: 'Викификатор', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/0/06/Wikify-toolbutton.png', | |||
action: { | |||
type: 'callback', | |||
execute: function(context) { | |||
Wikify(); | |||
} | |||
} | |||
} | |||
} | |||
}); | |||
}; | |||
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) { | |||
mw.loader.using('user.options', function() { | |||
if (mw.user.options.get('usebetatoolbar')) { | |||
mw.loader.using('ext.wikiEditor.toolbar', function() { | |||
$(document).ready(customizeToolbar); | |||
}); | |||
} | |||
}); | |||
} | |||
/** | |||
* Taken from https://wiki.ss220.space/index.php?title=MediaWiki:Common.js&oldid=35626 | |||
*/ | |||
/* Variables for interface text used throughout the script, for ease of translating */ | |||
var i18n = { | |||
// Collapsible elements and page loader | |||
hideText: 'скрыть', | |||
showText: 'показать', | |||
// Page loader | |||
loadErrorTitle: 'Возникла ошибка при загрузке содержимого' | |||
}; | |||
var mcw = window.mcw = {}; | |||
/* Keep track of delegated events on dynamic content */ | |||
mcw.events = {}; | |||
/* Fired whenever wiki content is added. (#mw-content-text, live preview, load page, etc.) */ | |||
mw.hook( 'wikipage.content' ).add( function( $wikipageContent ) { | |||
/** | |||
* Page loader | |||
* | |||
* Allows a page to be downloaded and displayed on demand. | |||
* Use with Template:LoadPage and Template:LoadBox | |||
*/ | |||
( function() { | |||
var $loadPage = $wikipageContent.find( '.load-page' ); | |||
if ( !$loadPage.length ) { | |||
return; | |||
} | |||
// We need the spinner to show loading is happening, but we don't want | |||
// to have a delay while the module downloads, so we'll load this now, | |||
// regardless of if something is clicked | |||
mw.loader.load( 'jquery.spinner' ); | |||
// Create button starting with hide text | |||
// Will be changed to the show text while calculating the maximum button size | |||
var $buttonTemplate = $( '<span>' ).addClass( 'mw-editsection-like load-page-button' ) | |||
.append( '[ ', $( '<span>' ).addClass( 'jslink' ).text( i18n.hideText ), ' ]' ); | |||
var extractList = function( $contentContainer, listClass ) { | |||
var $content = $contentContainer.find( '.mw-parser-output > ul > li > ul' ).children( ':not(.nbttree-inherited)' ); | |||
if ( listClass ) { | |||
$content.addClass( listClass ); | |||
} | |||
return $content; | |||
}; | |||
$loadPage.each( function() { | |||
var $body = $( this ); | |||
var page = $body.data( 'page' ); | |||
if ( !page ) { | |||
return; | |||
} | |||
var template = $body.data( 'template' ); | |||
var treeview = $body.data( 'treeview' ); | |||
var treeviewClass = $body.data( 'treeviewclass' ); | |||
var $heading; | |||
var $contentContainer; | |||
var $content; | |||
var $button = $buttonTemplate.clone(); | |||
var $buttonLink = $button.find( '.jslink' ); | |||
if ( treeview ) { | |||
$heading = $body; | |||
$contentContainer = $( '<div>' ); | |||
} else { | |||
$heading = $body.children().first(); | |||
$contentContainer = $body.find( '.load-page-content' ); | |||
} | |||
// Add the button | |||
$heading.append( $button ); | |||
// Move the edit button to the right spot | |||
$contentContainer.find( '.mw-editsection, .mw-editsection-like' ).insertAfter( $button ); | |||
// Find max button width, and set its min-width to it | |||
var hideWidth = $button.width(); | |||
$buttonLink.text( i18n.showText ); | |||
var showWidth = $button.width(); | |||
if ( hideWidth !== showWidth ) { | |||
$button.css( 'min-width', hideWidth > showWidth ? hideWidth : showWidth ); | |||
} | |||
$buttonLink.click( function() { | |||
if ( $body.hasClass( 'pageloader-contentloaded' ) ) { | |||
if ( $buttonLink.text() === i18n.showText ) { | |||
if ( treeview ) { | |||
$content.insertAfter( $body ); | |||
} else { | |||
$contentContainer.show(); | |||
} | |||
$buttonLink.text( i18n.hideText ); | |||
} else { | |||
if ( treeview ) { | |||
$content.detach(); | |||
} else { | |||
$contentContainer.hide(); | |||
} | |||
$buttonLink.text( i18n.showText ); | |||
} | |||
return; | |||
} | |||
// See if this was loaded elsewhere before making a request | |||
var gotContent; | |||
$( '.pageloader-contentloaded' ).each( function() { | |||
var $fLoader = $( this ); | |||
if ( $fLoader.data( 'page' ) === page && $fLoader.data( 'pageloader-content' ) ) { | |||
$contentContainer.html( $fLoader.data( 'pageloader-content' ) ).removeClass( 'noscript' ); | |||
mw.hook( 'wikipage.content' ).fire( $contentContainer ); | |||
if ( treeview ) { | |||
$body.find( '.noscript' ).remove(); | |||
$content = extractList( $contentContainer, treeviewClass ); | |||
$content.insertAfter( $body ); | |||
} | |||
$buttonLink.text( i18n.hideText ); | |||
$body.addClass( 'pageloader-contentloaded' ); | |||
gotContent = true; | |||
return false; | |||
} | |||
} ); | |||
if ( gotContent ) { | |||
return; | |||
} | |||
// Just in-case the spinner module is still not ready yet | |||
var $spinner = $(); | |||
mw.loader.using( 'jquery.spinner', function() { | |||
// $spinner will be false if the content somehow loaded before the module did | |||
if ( $spinner ) { | |||
$spinner = $.createSpinner().addClass( 'mw-editsection-like' ) | |||
.css( 'min-width', $button.css( 'min-width' ) ); | |||
$button.hide().after( $spinner ); | |||
} | |||
} ); | |||
var requestData = { | |||
action: 'parse', | |||
prop: 'text' | |||
}; | |||
if ( template ) { | |||
requestData.page = page; | |||
} else { | |||
requestData.title = mw.config.get( 'wgPageName' ); | |||
requestData.text = '{' + '{:' + page + '}}'; | |||
} | |||
new mw.Api().get( requestData ).done( function( data ) { | |||
var html = data.parse.text['*']; | |||
$contentContainer.html( html ).removeClass( 'noscript' ); | |||
// Resolve self-links | |||
if ( template ) { | |||
var curPage = '/' + mw.config.get( 'wgPageName' ); | |||
$contentContainer.find( 'a' ).each( function() { | |||
var $link = $( this ); | |||
if ( $link.attr( 'href' ) === curPage ) { | |||
$link.replaceWith( $( '<strong>' ).addClass( 'selflink' ).append( $link.contents() ) ); | |||
} | |||
} ); | |||
html = $contentContainer.html(); | |||
} | |||
$body.data( 'pageloader-content', html ); | |||
// Fire content hook on the new content, running all this stuff again and more :) | |||
mw.hook( 'wikipage.content' ).fire( $contentContainer ); | |||
if ( treeview ) { | |||
$body.find( '.noscript' ).remove(); | |||
$content = extractList( $contentContainer, treeviewClass ); | |||
$content.insertAfter( $body ); | |||
} | |||
$spinner.remove(); | |||
$spinner = false; | |||
$buttonLink.text( i18n.hideText ); | |||
$button.show(); | |||
$body.addClass( 'pageloader-contentloaded' ); | |||
} ).fail( function( _, error ) { | |||
$spinner.remove(); | |||
$spinner = false; | |||
$button.show(); | |||
var errorText = ''; | |||
if ( error.textStatus ) { | |||
errorText = error.textStatus; | |||
} else if ( error.error ) { | |||
errorText = error.error.info; | |||
} | |||
mw.notify( errorText, { title: i18n.loadErrorTitle, autoHide: false } ); | |||
} ); | |||
} ); | |||
} ); | |||
}() ); | |||
/** | |||
* Element animator | |||
* | |||
* Will cycle the active class on any child elements | |||
* within an element with the animated class. | |||
*/ | |||
( function() { | |||
if ( !mcw.animate ) { | |||
mcw.animate = setInterval( function() { | |||
$( '.animated' ).each( function() { | |||
var $elem = $( this ); | |||
var $current = $elem.children( '.active' ); | |||
var $next = $current.nextAll( ':not(.skip):first' ); | |||
// Loop back to the start | |||
if ( !$next.length ) { | |||
$next = $elem.children( ':not(.skip):first' ); | |||
} | |||
$current.removeClass( 'active' ); | |||
$next.addClass( 'active' ); | |||
} ); | |||
}, 2000 ); | |||
} | |||
}() ); | |||
} ); | |||
// SS220 import end | |||
/*Код Аррр*/ | |||
/*Подгрузка внешних css js*/ | /*Подгрузка внешних css js*/ | ||
mw.loader.using('mediawiki.util', function () { | mw.loader.using('mediawiki.util', function () { | ||
Версия от 22:00, 15 февраля 2025
const currentURL = window.location.href;
function kerisarTest() {
console.log("Проверка консоли");
const currentUrl = window.location.href;
console.log("currentUrl", currentUrl);
const jsTest = document.getElementById("jsTest");
console.log("jsTest", jsTest);
const buttonTest = document.createElement('button');
buttonTest.classList.add('testButtonJs');
buttonTest.textContent = "Привет, я кнопка. Пока я ничего не делаю";
jsTest.appendChild(buttonTest);
const kerisarPicture = document.createElement('img');
kerisarPicture.setAttribute('src',
"https://thumb.cloud.mail.ru/weblink/thumb/xw1/LLmd/Qui7Xbp6g");
jsTest.appendChild(kerisarPicture);
const iFrameFrontier = document.createElement('iframe');
iFrameFrontier.setAttribute('src',"https://arles.station14.ru/frontier-main/server/status");
jsTest.appendChild(iFrameFrontier);
const iFrameStalker = document.createElement('iframe');
iFrameStalker.setAttribute('src',"https://game.stalkers14.xyz/status");
jsTest.appendChild(iFrameStalker);
const iFrameWiki = document.createElement('iframe');
iFrameWiki.setAttribute('src',"https://station14.ru/wiki/%D0%A0%D0%BE%D0%B1%D0%BE%D1%82%D0%BE%D1%82%D0%B5%D1%85%D0%BD%D0%B8%D0%BA%D0%B0");
jsTest.appendChild(iFrameWiki);
const scriptTest = document.createElement('script');
scriptTest.setAttribute('src',"https://game.stalkers14.xyz/status");
jsTest.appendChild(scriptTest);
}
function getServersInfo(connect, callback) {
const xhr = new XMLHttpRequest();
xhr.open('GET', connect, true);
xhr.onload = function() {
if (xhr.status >= 200 && xhr.status < 300) {
const data = JSON.parse(xhr.responseText);
callback(null, data);
} else {
callback('Ошибка при выполнении запроса: ' + xhr.status, null);
}
};
xhr.onerror = function() {
callback('Ошибка при выполнении запроса', null);
};
xhr.send();
}
function shangeServersInfo(serverObj, serverName) {
console.log(serverObj, serverName);
if (currentURL.includes("Kerisar")) {
const serverStatusFrame = document.getElementById(serverName);
//console.log("serverStatusFrame", serverStatusFrame);
serverStatusFrame.querySelector(".serverInfoRoundSet").textContent = "#" + serverObj.round;
if (serverObj.status === 0) {
serverStatusFrame.querySelector(".serverStatusSet").textContent = "Лобби";
}
if (serverObj.status === 1) {
serverStatusFrame.querySelector(".serverStatusSet").textContent = "Раунд идёт";
}
if (serverObj.status === 2) {
serverStatusFrame.querySelector(".serverStatusSet").textContent = "Завершение";
}
serverStatusFrame.querySelector(".serverMapSet").textContent = serverObj.map;
serverStatusFrame.querySelector(".serverTimeSet").textContent = serverObj.time;
serverStatusFrame.querySelector(".serverPlayersSet").textContent = serverObj.players;
serverStatusFrame.querySelector(".serverPresetSet").textContent = serverObj.preset;
}
}
function standartServersInfo(connect, name) {
getServersInfo(connect, function(error, data) {
if (error) {
console.error(error); // Обработка ошибок
} else {
//console.log("Ответ получен", data)
const serverInfo = {
name: data.name,
round: data.round_id,
status: data.run_level,
map: data.map,
time: new Date(data.round_start_time).toLocaleString(),
players: data.players,
preset: data.preset
};
shangeServersInfo(serverInfo, name);
//console.log(serverInfo);
}
});
}
function standartServersInfoAll() {
for (var i = 0; i < serversStatus.length; i++) {
standartServersInfo(serversStatus[i].connect, serversStatus[i].name);
}
}
function customCSS(textCSS){
const styleSheet = document.createElement("style");
styleSheet.textContent = textCSS;
//console.log(textCSS);
document.head.appendChild(styleSheet);
}
$(document).ready(function() {
if (currentURL.includes("Kerisar")) {
kerisarTest();
standartServersInfoAll();
}
var cssEls = document.querySelectorAll('.customCSS');
if (cssEls.length > 0) {
for (var i = 0; i < cssEls.length; i++) {
const textCSS = cssEls[i].textContent;
console.log(textCSS);
customCSS(textCSS);
}
}
});
/*WikiEditor/Викификатор*/
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
mw.loader.load(
'//ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-wikificator.js&action=raw&ctype=text/javascript'
);
}
var customizeToolbar = function() {
$('#wpTextbox1').wikiEditor('addToToolbar', {
'section': 'advanced',
'group': 'format',
'tools': {
'wikify': {
label: 'Викификатор',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/0/06/Wikify-toolbutton.png',
action: {
type: 'callback',
execute: function(context) {
Wikify();
}
}
}
}
});
};
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
mw.loader.using('user.options', function() {
if (mw.user.options.get('usebetatoolbar')) {
mw.loader.using('ext.wikiEditor.toolbar', function() {
$(document).ready(customizeToolbar);
});
}
});
}
/**
* Taken from https://wiki.ss220.space/index.php?title=MediaWiki:Common.js&oldid=35626
*/
/* Variables for interface text used throughout the script, for ease of translating */
var i18n = {
// Collapsible elements and page loader
hideText: 'скрыть',
showText: 'показать',
// Page loader
loadErrorTitle: 'Возникла ошибка при загрузке содержимого'
};
var mcw = window.mcw = {};
/* Keep track of delegated events on dynamic content */
mcw.events = {};
/* Fired whenever wiki content is added. (#mw-content-text, live preview, load page, etc.) */
mw.hook( 'wikipage.content' ).add( function( $wikipageContent ) {
/**
* Page loader
*
* Allows a page to be downloaded and displayed on demand.
* Use with Template:LoadPage and Template:LoadBox
*/
( function() {
var $loadPage = $wikipageContent.find( '.load-page' );
if ( !$loadPage.length ) {
return;
}
// We need the spinner to show loading is happening, but we don't want
// to have a delay while the module downloads, so we'll load this now,
// regardless of if something is clicked
mw.loader.load( 'jquery.spinner' );
// Create button starting with hide text
// Will be changed to the show text while calculating the maximum button size
var $buttonTemplate = $( '<span>' ).addClass( 'mw-editsection-like load-page-button' )
.append( '[ ', $( '<span>' ).addClass( 'jslink' ).text( i18n.hideText ), ' ]' );
var extractList = function( $contentContainer, listClass ) {
var $content = $contentContainer.find( '.mw-parser-output > ul > li > ul' ).children( ':not(.nbttree-inherited)' );
if ( listClass ) {
$content.addClass( listClass );
}
return $content;
};
$loadPage.each( function() {
var $body = $( this );
var page = $body.data( 'page' );
if ( !page ) {
return;
}
var template = $body.data( 'template' );
var treeview = $body.data( 'treeview' );
var treeviewClass = $body.data( 'treeviewclass' );
var $heading;
var $contentContainer;
var $content;
var $button = $buttonTemplate.clone();
var $buttonLink = $button.find( '.jslink' );
if ( treeview ) {
$heading = $body;
$contentContainer = $( '<div>' );
} else {
$heading = $body.children().first();
$contentContainer = $body.find( '.load-page-content' );
}
// Add the button
$heading.append( $button );
// Move the edit button to the right spot
$contentContainer.find( '.mw-editsection, .mw-editsection-like' ).insertAfter( $button );
// Find max button width, and set its min-width to it
var hideWidth = $button.width();
$buttonLink.text( i18n.showText );
var showWidth = $button.width();
if ( hideWidth !== showWidth ) {
$button.css( 'min-width', hideWidth > showWidth ? hideWidth : showWidth );
}
$buttonLink.click( function() {
if ( $body.hasClass( 'pageloader-contentloaded' ) ) {
if ( $buttonLink.text() === i18n.showText ) {
if ( treeview ) {
$content.insertAfter( $body );
} else {
$contentContainer.show();
}
$buttonLink.text( i18n.hideText );
} else {
if ( treeview ) {
$content.detach();
} else {
$contentContainer.hide();
}
$buttonLink.text( i18n.showText );
}
return;
}
// See if this was loaded elsewhere before making a request
var gotContent;
$( '.pageloader-contentloaded' ).each( function() {
var $fLoader = $( this );
if ( $fLoader.data( 'page' ) === page && $fLoader.data( 'pageloader-content' ) ) {
$contentContainer.html( $fLoader.data( 'pageloader-content' ) ).removeClass( 'noscript' );
mw.hook( 'wikipage.content' ).fire( $contentContainer );
if ( treeview ) {
$body.find( '.noscript' ).remove();
$content = extractList( $contentContainer, treeviewClass );
$content.insertAfter( $body );
}
$buttonLink.text( i18n.hideText );
$body.addClass( 'pageloader-contentloaded' );
gotContent = true;
return false;
}
} );
if ( gotContent ) {
return;
}
// Just in-case the spinner module is still not ready yet
var $spinner = $();
mw.loader.using( 'jquery.spinner', function() {
// $spinner will be false if the content somehow loaded before the module did
if ( $spinner ) {
$spinner = $.createSpinner().addClass( 'mw-editsection-like' )
.css( 'min-width', $button.css( 'min-width' ) );
$button.hide().after( $spinner );
}
} );
var requestData = {
action: 'parse',
prop: 'text'
};
if ( template ) {
requestData.page = page;
} else {
requestData.title = mw.config.get( 'wgPageName' );
requestData.text = '{' + '{:' + page + '}}';
}
new mw.Api().get( requestData ).done( function( data ) {
var html = data.parse.text['*'];
$contentContainer.html( html ).removeClass( 'noscript' );
// Resolve self-links
if ( template ) {
var curPage = '/' + mw.config.get( 'wgPageName' );
$contentContainer.find( 'a' ).each( function() {
var $link = $( this );
if ( $link.attr( 'href' ) === curPage ) {
$link.replaceWith( $( '<strong>' ).addClass( 'selflink' ).append( $link.contents() ) );
}
} );
html = $contentContainer.html();
}
$body.data( 'pageloader-content', html );
// Fire content hook on the new content, running all this stuff again and more :)
mw.hook( 'wikipage.content' ).fire( $contentContainer );
if ( treeview ) {
$body.find( '.noscript' ).remove();
$content = extractList( $contentContainer, treeviewClass );
$content.insertAfter( $body );
}
$spinner.remove();
$spinner = false;
$buttonLink.text( i18n.hideText );
$button.show();
$body.addClass( 'pageloader-contentloaded' );
} ).fail( function( _, error ) {
$spinner.remove();
$spinner = false;
$button.show();
var errorText = '';
if ( error.textStatus ) {
errorText = error.textStatus;
} else if ( error.error ) {
errorText = error.error.info;
}
mw.notify( errorText, { title: i18n.loadErrorTitle, autoHide: false } );
} );
} );
} );
}() );
/**
* Element animator
*
* Will cycle the active class on any child elements
* within an element with the animated class.
*/
( function() {
if ( !mcw.animate ) {
mcw.animate = setInterval( function() {
$( '.animated' ).each( function() {
var $elem = $( this );
var $current = $elem.children( '.active' );
var $next = $current.nextAll( ':not(.skip):first' );
// Loop back to the start
if ( !$next.length ) {
$next = $elem.children( ':not(.skip):first' );
}
$current.removeClass( 'active' );
$next.addClass( 'active' );
} );
}, 2000 );
}
}() );
} );
// SS220 import end
/*Код Аррр*/
/*Подгрузка внешних css js*/
mw.loader.using('mediawiki.util', function () {
var files = mw.util.getParamValue('use'),
userName = mw.config.get('wgUserName') || '', // Обрабатываем null
FileRE = new RegExp('^(?:MediaWiki:|User:' + mw.util.escapeRegExp(userName) + '/)?[^&<>=%#]*\\.(js|css)$'),
path = mw.config.get('wgServer').replace(/^http:/, 'https:') + mw.config.get('wgScript') + '?action=raw&ctype=text/';
if (!files) return;
$.each(files.split('|'), function (k, v) {
var file = $.trim(v), match = FileRE.exec(file);
if (match) {
switch (match[1]) {
case 'js':
mw.loader.load(path + 'javascript&title=' + encodeURIComponent(file), 'text/javascript');
break;
case 'css':
mw.loader.load(path + 'css&title=' + encodeURIComponent(file), 'text/css');
break;
}
}
});
});
/* Лого сайта */
var logoElement = document.getElementsByClassName('citizen-header__logo')[0];
if (logoElement) {
logoElement.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 */
var footerPlaces = document.getElementById('footer-places');
var pageInfo = document.getElementsByClassName('page-info')[0];
if (footerPlaces && pageInfo) {
footerPlaces.insertAdjacentHTML('afterEnd', pageInfo.innerHTML);
pageInfo.innerHTML = '';
}
/* Логика цвета через headerColor */
var headerColorElement = document.getElementsByClassName('headerColor')[0];
if (headerColorElement) {
var isValidColor = function (color) {
var el = document.createElement('div');
el.style.backgroundColor = color;
return !!el.style.backgroundColor;
};
var headerContent = headerColorElement.innerHTML;
var colorBorder = '', colorBtn = '', i = 0;
while (headerContent[i] !== '|' && i < headerContent.length) {
colorBorder += headerContent[i++];
}
i++;
while (i < headerContent.length) {
colorBtn += headerContent[i++];
}
if (isValidColor(colorBorder) && isValidColor(colorBtn)) {
var headerRender = function (colorBorder, colorBtn) {
var headers = document.querySelectorAll('h1, h2, h3, h4, h5');
for (var j = 0; j < headers.length; j++) {
var header = headers[j];
if (header.className === 'citizen-section-heading') {
var indicator = header.querySelector('.citizen-sections-enabled, .citizen-section-indicator');
var headline = header.querySelector('.mw-headline');
if (indicator) {
indicator.style.background = colorBtn;
indicator.style.boxShadow = '0 0 20px 0px ' + colorBtn + 'cc';
}
if (headline) {
headline.style.borderImage = 'linear-gradient(to right top, ' + colorBorder + ', black)';
headline.style.borderImageSlice = '1';
}
} else if (header.className === 'citizen-section-heading citizen-section-heading--collapsed') {
var collapsedIndicator = header.querySelector('.citizen-sections-enabled, .citizen-section-heading--collapsed, .citizen-section-indicator');
if (collapsedIndicator) {
collapsedIndicator.style.background = 'black';
collapsedIndicator.style.boxShadow = 'unset';
}
}
}
};
headerRender(colorBorder, colorBtn);
document.body.addEventListener('click', function () {
headerRender(colorBorder, colorBtn);
});
}
}
/* Sidebar для ролей */
var jobsContainer = document.getElementsByClassName('JobsTableContainer')[0];
if (jobsContainer) {
var bodyContent = document.getElementById('bodyContent');
if (bodyContent) {
bodyContent.insertAdjacentHTML('beforebegin', jobsContainer.innerHTML);
}
var jobTable = document.getElementById('IdJobsTableContainer1');
if (jobTable) {
jobTable.id = 'IdJobsTableContainer2';
}
}
/* Главное меню лора */
document.querySelectorAll('.custom-item').forEach(function (item) {
item.addEventListener('click', function () {
var link = item.querySelector('a');
if (link) {
window.location.href = link.getAttribute('href');
}
});
});
/* Хронология */
if (typeof $ === 'function') {
$(document).ready(function () {
$('.timeline-header').click(function () {
var content = $(this).next('.timeline-content');
if (content.is(':visible')) {
content.slideUp();
} else {
content.slideDown();
}
});
$('.timeline-content').hide();
});
}