MediaWiki:Common.js: различия между версиями

Материал из Space Station 14 Вики
мНет описания правки
мНет описания правки
Строка 1: Строка 1:
const currentURL = window.location.href;
const currentURL = window.location.href;
const serversStatus = [{
const serversStatus = [{
  name: "main",
name: "main",
  connect: "https://game2.station14.ru/main/server/status"
connect: "https://game2.station14.ru/main/server/status"
}, {
}, {
  name: "nova",
name: "nova",
  connect: "https://game2.station14.ru/nova/server/status"
connect: "https://game2.station14.ru/nova/server/status"
}, {
}, {
  name: "athara",
name: "athara",
  connect: "https://game2.station14.ru/athara/server/status"
connect: "https://game2.station14.ru/athara/server/status"
}, {
}, {
  name: "solaris",
name: "solaris",
  connect: "https://game2.station14.ru/solaris/server/status"
connect: "https://game2.station14.ru/solaris/server/status"
}, {
}, {
  name: "echo",
name: "echo",
  connect: "https://game2.station14.ru/echo/server/status"
connect: "https://game2.station14.ru/echo/server/status"
}, {
}, {
  name: "elysium",
name: "elysium",
  connect: "https://game2.station14.ru/elysium/server/status"
connect: "https://game2.station14.ru/elysium/server/status"
}, {
}, {
  name: "nebula",
name: "nebula",
  connect: "https://game2.station14.ru/nebula/server/status"
connect: "https://game2.station14.ru/nebula/server/status"
}, {
}, {
  name: "wl",
name: "wl",
  connect: "https://game2.station14.ru/wl/server/status"
connect: "https://game2.station14.ru/wl/server/status"
}, {
}, {
  name: "frontier",
name: "frontier",
  connect: "https://api.codetabs.com/v1/proxy/?quest=https://arles.station14.ru/frontier-main/server/status"
connect: "https://api.codetabs.com/v1/proxy/?quest=https://arles.station14.ru/frontier-main/server/status"
}, {
}, {
  name: "fallout",
name: "fallout",
  connect: "https://api.codetabs.com/v1/proxy/?quest=http://188.92.78.98:1221/status"
connect: "https://api.codetabs.com/v1/proxy/?quest=http://188.92.78.98:1221/status"
}, {
}, {
  name: "marines",
name: "marines",
  connect: "https://game1.station14.ru/marines-main/server/status"
connect: "https://game1.station14.ru/marines-main/server/status"
}, {
}, {
  name: "stalker",
name: "stalker",
  connect: "https://api.codetabs.com/v1/proxy/?quest=https://game.stalkers14.xyz/status"
connect: "https://api.codetabs.com/v1/proxy/?quest=https://game.stalkers14.xyz/status"
}];
}];


function kerisarTest() {
function kerisarTest() {
  console.log("Проверка консоли");
console.log("Проверка консоли");
  const currentUrl = window.location.href;
const currentUrl = window.location.href;
  console.log("currentUrl", currentUrl);
console.log("currentUrl", currentUrl);
 
const jsTest = document.getElementById("jsTest");
  const jsTest = document.getElementById("jsTest");
console.log("jsTest", jsTest);
  console.log("jsTest", jsTest);
const buttonTest = document.createElement('button');
  const buttonTest = document.createElement('button');
buttonTest.classList.add('testButtonJs');
  buttonTest.classList.add('testButtonJs');
buttonTest.textContent = "Привет, я кнопка. Пока я ничего не делаю";
  buttonTest.textContent = "Привет, я кнопка. Пока я ничего не делаю";
jsTest.appendChild(buttonTest);
  jsTest.appendChild(buttonTest);
const kerisarPicture = document.createElement('img');
  const kerisarPicture = document.createElement('img');
kerisarPicture.setAttribute('src',
  kerisarPicture.setAttribute('src',
"https://thumb.cloud.mail.ru/weblink/thumb/xw1/LLmd/Qui7Xbp6g");
    "https://thumb.cloud.mail.ru/weblink/thumb/xw1/LLmd/Qui7Xbp6g");
jsTest.appendChild(kerisarPicture);
  jsTest.appendChild(kerisarPicture);
const iFrameFrontier = document.createElement('iframe');
 
iFrameFrontier.setAttribute('src',
 
"https://arles.station14.ru/frontier-main/server/status");
  const iFrameFrontier = document.createElement('iframe');
jsTest.appendChild(iFrameFrontier);
  iFrameFrontier.setAttribute('src', "https://arles.station14.ru/frontier-main/server/status");
const iFrameFallout = document.createElement('iframe');
  jsTest.appendChild(iFrameFrontier);
iFrameFrontier.setAttribute('src',
 
"https://thingproxy.freeboard.io/fetch/http://188.92.78.98:1221/status");
  const iFrameFallout = document.createElement('iframe');
jsTest.appendChild(iFrameFallout);
  iFrameFrontier.setAttribute('src', "https://thingproxy.freeboard.io/fetch/http://188.92.78.98:1221/status");
const iFrameStalker = document.createElement('iframe');
  jsTest.appendChild(iFrameFallout);
iFrameFrontier.setAttribute('src', "https://game.stalkers14.xyz/status");
 
jsTest.appendChild(iFrameStalker);
  const iFrameStalker = document.createElement('iframe');
const iFrameTest = document.createElement('iframe');
  iFrameFrontier.setAttribute('src', "https://game.stalkers14.xyz/status");
const testHTML =
  jsTest.appendChild(iFrameStalker);
'<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script><!DOCTYPE html><div class="accordion" id="accordionExample"><div class="accordion-item"><h2 class="accordion-header" id="headingOne"><button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> Accordion Item #1 </button></h2><div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample"><div class="accordion-body"><strong>This is the first item»s accordion body.</strong> It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It»s also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow. </div></div></div><div class="accordion-item"><h2 class="accordion-header" id="headingTwo"><button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> Accordion Item #2 </button></h2><div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample"><div class="accordion-body"><strong>This is the second item»s accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It»s also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow. </div></div></div><div class="accordion-item"><h2 class="accordion-header" id="headingThree"><button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> Accordion Item #3 </button></h2><div id="collapseThree" class="accordion-collapse collapse" aria-labelledby="headingThree" data-bs-parent="#accordionExample"><div class="accordion-body"><strong>This is the third item»s accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It»s also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow. </div></div></div></div></body></html>';
 
iFrameTest.setAttribute('srcdoc', testHTML);
  const iFrameTest = document.createElement('iframe');
iFrameTest.setAttribute('width', 1200);
  const testHTML = '<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script><!DOCTYPE html><div class="accordion" id="accordionExample"><div class="accordion-item"><h2 class="accordion-header" id="headingOne"><button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> Accordion Item #1 </button></h2><div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample"><div class="accordion-body"><strong>This is the first item»s accordion body.</strong> It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It»s also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow. </div></div></div><div class="accordion-item"><h2 class="accordion-header" id="headingTwo"><button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> Accordion Item #2 </button></h2><div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample"><div class="accordion-body"><strong>This is the second item»s accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It»s also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow. </div></div></div><div class="accordion-item"><h2 class="accordion-header" id="headingThree"><button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> Accordion Item #3 </button></h2><div id="collapseThree" class="accordion-collapse collapse" aria-labelledby="headingThree" data-bs-parent="#accordionExample"><div class="accordion-body"><strong>This is the third item»s accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It»s also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow. </div></div></div></div></body></html>';
iFrameTest.setAttribute('height', 800);
 
jsTest.appendChild(iFrameTest);
  iFrameTest.setAttribute('srcdoc', testHTML);
const fullHTMLFrameSourceTest = document.querySelector(".fullHTMLFrameSource")
  iFrameTest.setAttribute('width', 1200);
.textContent;
  iFrameTest.setAttribute('height', 800);
console.log("fullHTMLFrameSourceTest", fullHTMLFrameSourceTest);
  jsTest.appendChild(iFrameTest);
const fullHTMLFrameTest = document.createElement('iframe');
 
fullHTMLFrameTest.setAttribute('srcdoc', fullHTMLFrameSourceTest);
  const fullHTMLFrameSourceTest = document.querySelector(".fullHTMLFrameSource").textContent;
fullHTMLFrameTest.setAttribute('width', 1200);
  console.log("fullHTMLFrameSourceTest", fullHTMLFrameSourceTest);
fullHTMLFrameTest.setAttribute('height', 800);
 
jsTest.appendChild(fullHTMLFrameTest);
  const fullHTMLFrameTest = document.createElement('iframe');
const iFrameWiki = document.createElement('iframe');
  fullHTMLFrameTest.setAttribute('srcdoc', fullHTMLFrameSourceTest);
const htmlSource = document.documentElement.innerHTML;
  fullHTMLFrameTest.setAttribute('width', 1200);
console.log(htmlSource);
  fullHTMLFrameTest.setAttribute('height', 800);
iFrameWiki.setAttribute('src',
  jsTest.appendChild(fullHTMLFrameTest);
"https://station14.ru/wiki/%D0%9E%D0%B1%D1%81%D1%83%D0%B6%D0%B4%D0%B5%D0%BD%D0%B8%D0%B5_%D1%83%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D1%86%D1%8B:Kerisar"
 
);
 
iFrameWiki.setAttribute('width', 1200);
  const iFrameWiki = document.createElement('iframe');
iFrameWiki.setAttribute('height', 800);
  const htmlSource = document.documentElement.innerHTML;
jsTest.appendChild(iFrameWiki);
  console.log(htmlSource);
const scriptTest = document.createElement('script');
 
scriptTest.setAttribute('src', "https://game.stalkers14.xyz/status");
  iFrameWiki.setAttribute('src', "https://station14.ru/wiki/%D0%9E%D0%B1%D1%81%D1%83%D0%B6%D0%B4%D0%B5%D0%BD%D0%B8%D0%B5_%D1%83%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D1%86%D1%8B:Kerisar");
jsTest.appendChild(scriptTest);
  iFrameWiki.setAttribute('width', 1200);
var bootstrap_enabled = (typeof $().modal == 'function');
  iFrameWiki.setAttribute('height', 800);
console.log("bootstrap_enabled", bootstrap_enabled);
  jsTest.appendChild(iFrameWiki);
 
 
  const scriptTest = document.createElement('script');
  scriptTest.setAttribute('src', "https://game.stalkers14.xyz/status");
  jsTest.appendChild(scriptTest);
 
  var bootstrap_enabled = (typeof $().modal == 'function');
 
  console.log("bootstrap_enabled", bootstrap_enabled);
 
}
}


function getXHRInfo(connect, callback) {
function getXHRInfo(connect, callback) {
  const xhr = new XMLHttpRequest();
const xhr = new XMLHttpRequest();
  xhr.open('GET', connect, true);
xhr.open('GET', connect, true);
  xhr.onload = function() {
xhr.onload = function() {
    if (xhr.status >= 200 && xhr.status < 300) {
if (xhr.status >= 200 && xhr.status < 300) {
      const data = JSON.parse(xhr.responseText);
const data = JSON.parse(xhr.responseText);
      callback(null, data);
callback(null, date);
    } else {
} else {
      callback('Ошибка при выполнении запроса: ' + xhr.status, null);
callback('Ошибка при выполнении запроса: ' + xhr.status, null);
    }
}
  };
};
  xhr.onerror = function() {
xhr.onerror = function() {
    callback('Ошибка при выполнении запроса', null);
callback('Ошибка при выполнении запроса', null);
  };
};
  xhr.send();
xhr.send();
}
}


function shangeServersInfo(serverObj, serverName) {
function shangeServersInfo(serverObj, serverName) {
  console.log(serverObj, serverName);
console.log(serverObj, serverName);
 
if (currentURL.includes("Kerisar")) {
  if (currentURL.includes("Kerisar")) {
const serverStatusFrame = document.getElementById(serverName);
    const serverStatusFrame = document.getElementById(serverName);
//console.log("serverStatusFrame", serverStatusFrame);
    //console.log("serverStatusFrame", serverStatusFrame);
serverStatusFrame.querySelector(".serverInfoRoundSet").textContent = "#" +
 
serverObj.round;
    serverStatusFrame.querySelector(".serverInfoRoundSet").textContent = "#" + serverObj.round;
if (serverObj.status === 0) {
    if (serverObj.status === 0) {
serverStatusFrame.querySelector(".serverStatusSet").textContent = "Лобби";
      serverStatusFrame.querySelector(".serverStatusSet").textContent = "Лобби";
}
    }
if (serverObj.status === 1) {
    if (serverObj.status === 1) {
serverStatusFrame.querySelector(".serverStatusSet").textContent =
      serverStatusFrame.querySelector(".serverStatusSet").textContent = "Раунд идёт";
"Раунд идёт";
    }
}
    if (serverObj.status === 2) {
if (serverObj.status === 2) {
      serverStatusFrame.querySelector(".serverStatusSet").textContent = "Завершение";
serverStatusFrame.querySelector(".serverStatusSet").textContent =
    }
"Завершение";
    serverStatusFrame.querySelector(".serverMapSet").textContent = serverObj.map;
}
    serverStatusFrame.querySelector(".serverTimeSet").textContent = serverObj.time;
serverStatusFrame.querySelector(".serverMapSet").textContent = serverObj.map;
    serverStatusFrame.querySelector(".serverPlayersSet").textContent = serverObj.players;
serverStatusFrame.querySelector(".serverTimeSet").textContent = serverObj.time;
    serverStatusFrame.querySelector(".serverPresetSet").textContent = serverObj.preset;
serverStatusFrame.querySelector(".serverPlayersSet").textContent = serverObj.players;
  }
serverStatusFrame.querySelector(".serverPresetSet").textContent = serverObj.preset;
}
}
}


function standartServersInfo(connect, name) {
function standartServersInfo(connect, name) {
  getXHRInfo(connect, function(error, serverData) {
getXHRInfo("https://worldtimeapi.org/api/timezone/Europe/Moscow", function(error, date) {
    if (error) {
if (error) {
      console.error(error);
console.error(error); // Обработка ошибок
    } else {
} else {
      getXHRInfo("https://worldtimeapi.org/api/timezone/Europe/Moscow", function(error, timeData) {
const currentTime = date.datetime;
        if (error) {
console.log("currentTime", currentTime);
          console.error(error);
}
        } else {
});
          const serverInfo = {
            name: serverData.name,
            round: serverData.round_id,
getXHRInfo(connect, function(error, date) {
            status: serverData.run_level,
if (error) {
            map: serverData.map,
console.error(error); // Обработка ошибок
            // time: getTimeDifference(serverData.round_start_time),
} else {
            time: new Date(serverData.round_start_time).toLocaleString(),
const serverInfo = {
            players: serverData.players,
name: date.name,
            preset: serverData.preset,
round: date.round_id,
            currentTime: timeData.datetime // Используем полученное время
status: date.run_level,
          };
map: date.map,
         
//time: getTimeDifference(date.round_start_time),
          shangeServersInfo(serverInfo, name);
time: new Date(date.round_start_time).toLocaleString(),
          console.log(serverInfo);
players: date.players,
        }
preset: date.preset
      });
};
    }
shangeServersInfo(serverInfo, name);
  });
console.log(serverInfo);
}
});
}
}


function standartServersInfoAll() {
function standartServersInfoAll() {
  for (var i = 0; i < serversStatus.length; i++) {
for (var i = 0; i < serversStatus.length; i++) {
    standartServersInfo(serversStatus[i].connect, serversStatus[i].name);
standartServersInfo(serversStatus[i].connect, serversStatus[i].name);
  }
}
}
}


function customCSS(textCSS) {
function customCSS(textCSS) {
  const styleSheet = document.createElement("style");
const styleSheet = document.createElement("style");
  styleSheet.textContent = textCSS;
styleSheet.textContent = textCSS;
  //console.log(textCSS);
//console.log(textCSS);
 
document.head.appendChild(styleSheet);
  document.head.appendChild(styleSheet);
}
}


function needBootstrap() {
function needBootstrap() {
              const elements = document.querySelectorAll('.turnBootstrap');
const elements = document.querySelectorAll('.turnBootstrap');
             
if (elements.length > 0) {
              if (elements.length > 0) {
const link = document.createElement('link');
                  const link = document.createElement('link');
link.href =
                  link.href = "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css";
"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css";
                  link.rel = "stylesheet";
link.rel = "stylesheet";
                  link.integrity = "sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC";
link.integrity =
                  link.crossOrigin = "anonymous";
"sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC";
 
link.crossOrigin = "anonymous";
                  const script = document.createElement('script');
const script = document.createElement('script');
                  script.src = "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js";
script.src =
                  script.integrity = "sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM";
"https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js";
                  script.crossOrigin = "anonymous";
script.integrity =
 
"sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM";
                  document.head.appendChild(link);
script.crossOrigin = "anonymous";
                  document.head.appendChild(script);
document.head.appendChild(link);
              }
document.head.appendChild(script);
          }
}
 
}
window.onload = needBootstrap;
window.onload = needBootstrap;
$(document).ready(function() {
$(document).ready(function() {
  if (currentURL.includes("Kerisar")) {
if (currentURL.includes("Kerisar")) {
    kerisarTest();
kerisarTest();
    standartServersInfoAll();
standartServersInfoAll();
  }
}
  var cssEls = document.querySelectorAll('.customCSS');
var cssEls = document.querySelectorAll('.customCSS');
 
if (cssEls.length > 0) {
  if (cssEls.length > 0) {
for (var i = 0; i < cssEls.length; i++) {
    for (var i = 0; i < cssEls.length; i++) {
const textCSS = cssEls[i].textContent;
      const textCSS = cssEls[i].textContent;
console.log(textCSS);
      console.log(textCSS);
customCSS(textCSS);
      customCSS(textCSS);
}
    }
}
  }
var needBootstrap = document.querySelectorAll('.needBootstrap');
  var needBootstrap = document.querySelectorAll('.needBootstrap');
if (needBootstrap.length > 0) {
  if (needBootstrap.length > 0) {
console.log("needBootstrap() start");
    console.log("needBootstrap() start");
}
  }
 
});
});
/*WikiEditor/Викификатор*/
/*WikiEditor/Викификатор*/
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
  mw.loader.load(
mw.loader.load(
    '//ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-wikificator.js&action=raw&ctype=text/javascript'
'//ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-wikificator.js&action=raw&ctype=text/javascript'
  );
);
}
}
var customizeToolbar = function() {
var customizeToolbar = function() {
  $('#wpTextbox1').wikiEditor('addToToolbar', {
$('#wpTextbox1').wikiEditor('addToToolbar', {
    'section': 'advanced',
'section': 'advanced',
    'group': 'format',
'group': 'format',
    'tools': {
'tools': {
      'wikify': {
'wikify': {
        label: 'Викификатор',
label: 'Викификатор',
        type: 'button',
type: 'button',
        icon: '//upload.wikimedia.org/wikipedia/commons/0/06/Wikify-toolbutton.png',
icon: '//upload.wikimedia.org/wikipedia/commons/0/06/Wikify-toolbutton.png',
        action: {
action: {
          type: 'callback',
type: 'callback',
          execute: function(context) {
execute: function(context) {
            Wikify();
Wikify();
          }
}
        }
}
      }
}
    }
}
  });
});
};
};
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
  mw.loader.using('user.options', function() {
mw.loader.using('user.options', function() {
    if (mw.user.options.get('usebetatoolbar')) {
if (mw.user.options.get('usebetatoolbar')) {
      mw.loader.using('ext.wikiEditor.toolbar', function() {
mw.loader.using('ext.wikiEditor.toolbar', function() {
        $(document).ready(customizeToolbar);
$(document).ready(customizeToolbar);
      });
});
    }
}
  });
});
}
}
/**
/**
  * Taken from https://wiki.ss220.space/index.php?title=MediaWiki:Common.js&oldid=35626
  * 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 */
/* Variables for interface text used throughout the script, for ease of translating */
var i18n = {
var i18n = {
  // Collapsible elements and page loader
// Collapsible elements and page loader
  hideText: 'скрыть',
hideText: 'скрыть',
  showText: 'показать',
showText: 'показать',
 
// Page loader
  // Page loader
loadErrorTitle: 'Возникла ошибка при загрузке содержимого'
  loadErrorTitle: 'Возникла ошибка при загрузке содержимого'
};
};
var mcw = window.mcw = {};
var mcw = window.mcw = {};
/* Keep track of delegated events on dynamic content */
/* Keep track of delegated events on dynamic content */
mcw.events = {};
mcw.events = {};
/* Fired whenever wiki content is added. (#mw-content-text, live preview, load page, etc.) */
/* Fired whenever wiki content is added. (#mw-content-text, live preview, load page, etc.) */
mw.hook('wikipage.content').add(function($wikipageContent) {
mw.hook('wikipage.content').add(function($wikipageContent) {
  /**
/**
  * Page loader
* Page loader
  *
*
  * Allows a page to be downloaded and displayed on demand.
* Allows a page to be downloaded and displayed on demand.
  * Use with Template:LoadPage and Template:LoadBox
* Use with Template:LoadPage and Template:LoadBox
  */
*/
 
(function() {
  (function() {
var $loadPage = $wikipageContent.find('.load-page');
    var $loadPage = $wikipageContent.find('.load-page');
if (!$loadPage.length) {
    if (!$loadPage.length) {
return;
      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,
    // We need the spinner to show loading is happening, but we don't want
// regardless of if something is clicked
    // to have a delay while the module downloads, so we'll load this now,
mw.loader.load('jquery.spinner');
    // regardless of if something is clicked
// Create button starting with hide text
    mw.loader.load('jquery.spinner');
// Will be changed to the show text while calculating the maximum button size
 
var $buttonTemplate = $('<span>').addClass(
    // Create button starting with hide text
'mw-editsection-like load-page-button').append('[ ', $('<span>').addClass(
    // Will be changed to the show text while calculating the maximum button size
'jslink').text(i18n.hideText), ' ]');
    var $buttonTemplate = $('<span>').addClass('mw-editsection-like load-page-button')
var extractList = function($contentContainer, listClass) {
      .append('[ ', $('<span>').addClass('jslink').text(i18n.hideText), ' ]');
var $content = $contentContainer.find('.mw-parser-output > ul > li > ul')
 
.children(':not(.nbttree-inherited)');
    var extractList = function($contentContainer, listClass) {
if (listClass) {
      var $content = $contentContainer.find('.mw-parser-output > ul > li > ul').children(':not(.nbttree-inherited)');
$content.addClass(listClass);
      if (listClass) {
}
        $content.addClass(listClass);
return $content;
      }
};
 
$loadPage.each(function() {
      return $content;
var $body = $(this);
    };
var page = $body.data('page');
 
if (!page) {
    $loadPage.each(function() {
return;
      var $body = $(this);
}
      var page = $body.data('page');
var template = $body.data('template');
      if (!page) {
var treeview = $body.data('treeview');
        return;
var treeviewClass = $body.data('treeviewclass');
      }
var $heading;
 
var $contentContainer;
      var template = $body.data('template');
var $content;
      var treeview = $body.data('treeview');
var $button = $buttonTemplate.clone();
      var treeviewClass = $body.data('treeviewclass');
var $buttonLink = $button.find('.jslink');
      var $heading;
if (treeview) {
      var $contentContainer;
$heading = $body;
      var $content;
$contentContainer = $('<div>');
      var $button = $buttonTemplate.clone();
} else {
      var $buttonLink = $button.find('.jslink');
$heading = $body.children().first();
      if (treeview) {
$contentContainer = $body.find('.load-page-content');
        $heading = $body;
}
        $contentContainer = $('<div>');
// Add the button
      } else {
$heading.append($button);
        $heading = $body.children().first();
// Move the edit button to the right spot
        $contentContainer = $body.find('.load-page-content');
$contentContainer.find('.mw-editsection, .mw-editsection-like').insertAfter(
      }
$button);
 
// Find max button width, and set its min-width to it
      // Add the button
var hideWidth = $button.width();
      $heading.append($button);
$buttonLink.text(i18n.showText);
 
var showWidth = $button.width();
      // Move the edit button to the right spot
if (hideWidth !== showWidth) {
      $contentContainer.find('.mw-editsection, .mw-editsection-like').insertAfter($button);
$button.css('min-width', hideWidth > showWidth ? hideWidth : showWidth);
 
}
      // Find max button width, and set its min-width to it
$buttonLink.click(function() {
      var hideWidth = $button.width();
if ($body.hasClass('pageloader-contentloaded')) {
      $buttonLink.text(i18n.showText);
if ($buttonLink.text() === i18n.showText) {
      var showWidth = $button.width();
if (treeview) {
 
$content.insertAfter($body);
      if (hideWidth !== showWidth) {
} else {
        $button.css('min-width', hideWidth > showWidth ? hideWidth : showWidth);
$contentContainer.show();
      }
}
 
$buttonLink.text(i18n.hideText);
      $buttonLink.click(function() {
} else {
        if ($body.hasClass('pageloader-contentloaded')) {
if (treeview) {
          if ($buttonLink.text() === i18n.showText) {
$content.detach();
            if (treeview) {
} else {
              $content.insertAfter($body);
$contentContainer.hide();
            } else {
}
              $contentContainer.show();
$buttonLink.text(i18n.showText);
            }
}
            $buttonLink.text(i18n.hideText);
return;
          } else {
}
            if (treeview) {
// See if this was loaded elsewhere before making a request
              $content.detach();
var gotContent;
            } else {
$('.pageloader-contentloaded').each(function() {
              $contentContainer.hide();
var $fLoader = $(this);
            }
if ($fLoader.data('page') === page && $fLoader.data(
            $buttonLink.text(i18n.showText);
'pageloader-content')) {
          }
$contentContainer.html($fLoader.data('pageloader-content')).removeClass(
          return;
'noscript');
        }
mw.hook('wikipage.content').fire($contentContainer);
 
if (treeview) {
        // See if this was loaded elsewhere before making a request
$body.find('.noscript').remove();
        var gotContent;
$content = extractList($contentContainer, treeviewClass);
        $('.pageloader-contentloaded').each(function() {
$content.insertAfter($body);
          var $fLoader = $(this);
}
          if ($fLoader.data('page') === page && $fLoader.data('pageloader-content')) {
$buttonLink.text(i18n.hideText);
            $contentContainer.html($fLoader.data('pageloader-content')).removeClass('noscript');
$body.addClass('pageloader-contentloaded');
            mw.hook('wikipage.content').fire($contentContainer);
gotContent = true;
 
return false;
            if (treeview) {
}
              $body.find('.noscript').remove();
});
              $content = extractList($contentContainer, treeviewClass);
if (gotContent) {
              $content.insertAfter($body);
return;
            }
}
 
// Just in-case the spinner module is still not ready yet
            $buttonLink.text(i18n.hideText);
var $spinner = $();
            $body.addClass('pageloader-contentloaded');
mw.loader.using('jquery.spinner', function() {
            gotContent = true;
// $spinner will be false if the content somehow loaded before the module did
            return false;
if ($spinner) {
          }
$spinner = $.createSpinner().addClass('mw-editsection-like').css(
        });
'min-width', $button.css('min-width'));
        if (gotContent) {
$button.hide().after($spinner);
          return;
}
        }
});
 
var requestData = {
        // Just in-case the spinner module is still not ready yet
action: 'parse',
        var $spinner = $();
prop: 'text'
        mw.loader.using('jquery.spinner', function() {
};
          // $spinner will be false if the content somehow loaded before the module did
if (template) {
          if ($spinner) {
requestData.page = page;
            $spinner = $.createSpinner().addClass('mw-editsection-like')
} else {
              .css('min-width', $button.css('min-width'));
requestData.title = mw.config.get('wgPageName');
            $button.hide().after($spinner);
requestData.text = '{' + '{:' + page + '}}';
          }
}
        });
new mw.Api().get(requestData).done(function(data) {
 
var html = data.parse.text['*'];
        var requestData = {
$contentContainer.html(html).removeClass('noscript');
          action: 'parse',
// Resolve self-links
          prop: 'text'
if (template) {
        };
var curPage = '/' + mw.config.get('wgPageName');
        if (template) {
$contentContainer.find('a').each(function() {
          requestData.page = page;
var $link = $(this);
        } else {
if ($link.attr('href') === curPage) {
          requestData.title = mw.config.get('wgPageName');
$link.replaceWith($('<strong>').addClass('selflink').append(
          requestData.text = '{' + '{:' + page + '}}';
$link.contents()));
        }
}
        new mw.Api().get(requestData).done(function(data) {
});
          var html = data.parse.text['*'];
html = $contentContainer.html();
          $contentContainer.html(html).removeClass('noscript');
}
 
$body.data('pageloader-content', html);
          // Resolve self-links
// Fire content hook on the new content, running all this stuff again and more :)
          if (template) {
mw.hook('wikipage.content').fire($contentContainer);
            var curPage = '/' + mw.config.get('wgPageName');
if (treeview) {
            $contentContainer.find('a').each(function() {
$body.find('.noscript').remove();
              var $link = $(this);
$content = extractList($contentContainer, treeviewClass);
              if ($link.attr('href') === curPage) {
$content.insertAfter($body);
                $link.replaceWith($('<strong>').addClass('selflink').append($link.contents()));
}
              }
$spinner.remove();
            });
$spinner = false;
            html = $contentContainer.html();
$buttonLink.text(i18n.hideText);
          }
$button.show();
 
$body.addClass('pageloader-contentloaded');
          $body.data('pageloader-content', html);
}).fail(function(_, error) {
 
$spinner.remove();
          // Fire content hook on the new content, running all this stuff again and more :)
$spinner = false;
          mw.hook('wikipage.content').fire($contentContainer);
$button.show();
 
var errorText = '';
          if (treeview) {
if (error.textStatus) {
            $body.find('.noscript').remove();
errorText = error.textStatus;
            $content = extractList($contentContainer, treeviewClass);
} else if (error.error) {
            $content.insertAfter($body);
errorText = error.error.info;
          }
}
 
mw.notify(errorText, {
          $spinner.remove();
title: i18n.loadErrorTitle,
          $spinner = false;
autoHide: false
          $buttonLink.text(i18n.hideText);
});
          $button.show();
});
          $body.addClass('pageloader-contentloaded');
});
        }).fail(function(_, error) {
});
          $spinner.remove();
}());
          $spinner = false;
/**
          $button.show();
* Element animator
 
*
          var errorText = '';
* Will cycle the active class on any child elements
          if (error.textStatus) {
* within an element with the animated class.
            errorText = error.textStatus;
*/
          } else if (error.error) {
(function() {
            errorText = error.error.info;
if (!mcw.animate) {
          }
mcw.animate = setInterval(function() {
 
$('.animated').each(function() {
          mw.notify(errorText, {
var $elem = $(this);
            title: i18n.loadErrorTitle,
var $current = $elem.children('.active');
            autoHide: false
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');
  /**
});
  * Element animator
}, 2000);
  *
}
  * 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
// SS220 import end

Версия от 01:24, 15 августа 2024

const currentURL = window.location.href;
const serversStatus = [{
	name: "main",
	connect: "https://game2.station14.ru/main/server/status"
}, {
	name: "nova",
	connect: "https://game2.station14.ru/nova/server/status"
}, {
	name: "athara",
	connect: "https://game2.station14.ru/athara/server/status"
}, {
	name: "solaris",
	connect: "https://game2.station14.ru/solaris/server/status"
}, {
	name: "echo",
	connect: "https://game2.station14.ru/echo/server/status"
}, {
	name: "elysium",
	connect: "https://game2.station14.ru/elysium/server/status"
}, {
	name: "nebula",
	connect: "https://game2.station14.ru/nebula/server/status"
}, {
	name: "wl",
	connect: "https://game2.station14.ru/wl/server/status"
}, {
	name: "frontier",
	connect: "https://api.codetabs.com/v1/proxy/?quest=https://arles.station14.ru/frontier-main/server/status"
}, {
	name: "fallout",
	connect: "https://api.codetabs.com/v1/proxy/?quest=http://188.92.78.98:1221/status"
}, {
	name: "marines",
	connect: "https://game1.station14.ru/marines-main/server/status"
}, {
	name: "stalker",
	connect: "https://api.codetabs.com/v1/proxy/?quest=https://game.stalkers14.xyz/status"
}];

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 iFrameFallout = document.createElement('iframe');
	iFrameFrontier.setAttribute('src',
		"https://thingproxy.freeboard.io/fetch/http://188.92.78.98:1221/status");
	jsTest.appendChild(iFrameFallout);
	const iFrameStalker = document.createElement('iframe');
	iFrameFrontier.setAttribute('src', "https://game.stalkers14.xyz/status");
	jsTest.appendChild(iFrameStalker);
	const iFrameTest = document.createElement('iframe');
	const testHTML =
		'<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script><!DOCTYPE html><div class="accordion" id="accordionExample"><div class="accordion-item"><h2 class="accordion-header" id="headingOne"><button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> Accordion Item #1 </button></h2><div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample"><div class="accordion-body"><strong>This is the first item»s accordion body.</strong> It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It»s also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow. </div></div></div><div class="accordion-item"><h2 class="accordion-header" id="headingTwo"><button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> Accordion Item #2 </button></h2><div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample"><div class="accordion-body"><strong>This is the second item»s accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It»s also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow. </div></div></div><div class="accordion-item"><h2 class="accordion-header" id="headingThree"><button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> Accordion Item #3 </button></h2><div id="collapseThree" class="accordion-collapse collapse" aria-labelledby="headingThree" data-bs-parent="#accordionExample"><div class="accordion-body"><strong>This is the third item»s accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It»s also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow. </div></div></div></div></body></html>';
	iFrameTest.setAttribute('srcdoc', testHTML);
	iFrameTest.setAttribute('width', 1200);
	iFrameTest.setAttribute('height', 800);
	jsTest.appendChild(iFrameTest);
	const fullHTMLFrameSourceTest = document.querySelector(".fullHTMLFrameSource")
		.textContent;
	console.log("fullHTMLFrameSourceTest", fullHTMLFrameSourceTest);
	const fullHTMLFrameTest = document.createElement('iframe');
	fullHTMLFrameTest.setAttribute('srcdoc', fullHTMLFrameSourceTest);
	fullHTMLFrameTest.setAttribute('width', 1200);
	fullHTMLFrameTest.setAttribute('height', 800);
	jsTest.appendChild(fullHTMLFrameTest);
	const iFrameWiki = document.createElement('iframe');
	const htmlSource = document.documentElement.innerHTML;
	console.log(htmlSource);
	iFrameWiki.setAttribute('src',
		"https://station14.ru/wiki/%D0%9E%D0%B1%D1%81%D1%83%D0%B6%D0%B4%D0%B5%D0%BD%D0%B8%D0%B5_%D1%83%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D1%86%D1%8B:Kerisar"
	);
	iFrameWiki.setAttribute('width', 1200);
	iFrameWiki.setAttribute('height', 800);
	jsTest.appendChild(iFrameWiki);
	const scriptTest = document.createElement('script');
	scriptTest.setAttribute('src', "https://game.stalkers14.xyz/status");
	jsTest.appendChild(scriptTest);
	var bootstrap_enabled = (typeof $().modal == 'function');
	console.log("bootstrap_enabled", bootstrap_enabled);
}

function getXHRInfo(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, date);
		} 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) {
	getXHRInfo("https://worldtimeapi.org/api/timezone/Europe/Moscow", function(error, date) {
		if (error) {
			console.error(error); // Обработка ошибок
		} else {
			const currentTime = date.datetime;
			console.log("currentTime", currentTime);
		}
	});
	
	
	getXHRInfo(connect, function(error, date) {
		if (error) {
			console.error(error); // Обработка ошибок
		} else {
			const serverInfo = {
				name: date.name,
				round: date.round_id,
				status: date.run_level,
				map: date.map,
				//time: getTimeDifference(date.round_start_time),
				time: new Date(date.round_start_time).toLocaleString(),
				players: date.players,
				preset: date.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);
}

function needBootstrap() {
	const elements = document.querySelectorAll('.turnBootstrap');
	if (elements.length > 0) {
		const link = document.createElement('link');
		link.href =
			"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css";
		link.rel = "stylesheet";
		link.integrity =
			"sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC";
		link.crossOrigin = "anonymous";
		const script = document.createElement('script');
		script.src =
			"https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js";
		script.integrity =
			"sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM";
		script.crossOrigin = "anonymous";
		document.head.appendChild(link);
		document.head.appendChild(script);
	}
}
window.onload = needBootstrap;
$(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);
		}
	}
	var needBootstrap = document.querySelectorAll('.needBootstrap');
	if (needBootstrap.length > 0) {
		console.log("needBootstrap() start");
	}
});
/*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