MediaWiki:Common.js: различия между версиями
Страница интерфейса MediaWiki
Дополнительные действия
Admin (обсуждение | вклад) Нет описания правки |
Admin (обсуждение | вклад) Нет описания правки |
||
| Строка 1: | Строка 1: | ||
const pageName = mw.config.get("wgPageName"); | const pageName = mw.config.get("wgPageName"); | ||
document.querySelectorAll(".server-hook").forEach(function(element) { | |||
var ip = element.getAttribute("data-ip"); | |||
var port = element.getAttribute("data-port"); | |||
var url = "https://wiki.ss13-bluemoon.ru/nodeapi/status?ip="+encodeURIComponent(ip)+"&port="+encodeURIComponent(port); | |||
fetch(url) | |||
.then(function(response) { | |||
if (!response.ok) { | |||
throw new Error(response.status); | |||
} | |||
return response.json(); | |||
}) | |||
.then(function(data) { | |||
element.textContent = data.response.players; | |||
}) | |||
.catch(function(error) { | |||
element.textContent = "⨉"; | |||
}); | |||
}); | |||
if (pageName == "Заглавная_страница") { | |||
document.documentElement.classList.replace('skin-theme-clientpref-day', 'skin-theme-clientpref-night'); | |||
} | |||
if (pageName != "Шаблон:Таблица_Космический_Закон") { | if (pageName != "Шаблон:Таблица_Космический_Закон") { | ||
| Строка 78: | Строка 102: | ||
isJopa = true; | isJopa = true; | ||
}); | }); | ||
} | } | ||