User:NewAqua/global.js

importArticles({	type: "script",	articles: [		'u:dev:MediaWiki:AjaxBatchDelete.js',		'u:dev:MediaWiki:GlobalNavButtons.js',		'u:dev:MediaWiki:MassEdit/code.js',		'u:dev:MediaWiki:MultipleActivity.js',		'u:dev:MediaWiki:PurgeButton/code.js',		'u:dev:MediaWiki:QuickDiff/code.js',		'u:dev:MediaWiki:ThemeToggler.js',		"u:nkch:MediaWiki:nkchCSS.js"	] });

// nkchCSS nkch_css_configs = { theme: "rubyblue", title: "Не кочан, ксс" }

//nkch's GlobalNavButtons window.nkch_navLinks = [{ link: "ru.community", title: "Вики Сообщества" }, {   link: "community", title: "Community Central" }, {   link: "ru.slimerancher", title: "Slime Rancher вики" }, {   link: "ru.spiralka", title: "Спиралька вики" }];

if (typeof window.nkch_navLinks !== "undefined" && Array.isArray(window.nkch_navLinks)) { mw.loader.using(["mediawiki.api", "oojs-ui"]).then(       function  {            const api = new mw.Api;            var originalLinks = document.querySelectorAll(".global-navigation__link:not(.start-a-wiki):not(div)");

originalLinks.forEach(               function (el) {                    el.remove;                }            );

var navLinksWrapper = document.createElement("div");

navLinksWrapper.classList.add("navLinksWrapper")

Object.assign(navLinksWrapper.style, {               width: "100%",                overflowY: "auto",                maxHeight: "500px"            });

if (skin == "fandomdesktop") { document.querySelector(".global-navigation__search.global-navigation__icon").after(navLinksWrapper); };

for (var i in window.nkch_navLinks) { if (typeof window.nkch_navLinks[i].link !== "undefined") { var link = window.nkch_navLinks[i].link.split(".");

var l;                   if (link.length === 1) { l = "https://" + link[0] + ".fandom.com"; } else if (link.length === 2) { l = "https://" + link[1] + ".fandom.com/" + link[0]; };

var favicon = l + "/wiki/Special:Filepath/Site-favicon.ico";

var linkWrapper = document.createElement("a"); linkWrapper.classList.add("global-navigation__link", "navLink");

linkWrapper.href = l;

linkTooltip = document.createElement("div"); linkTooltip.classList.add("wds-tooltip", "is-left");

linkTooltip.style.margin = "-18px 0 0 -9px"; linkTooltip.style.width = "max-content";

if (typeof window.nkch_navLinks[i].title !== "undefined") { linkTooltip.innerHTML = window.nkch_navLinks[i].title; } else { linkTooltip.innerHTML = "[ " + window.nkch_navLinks[i].link + " ]"; };

var linkIcon = document.createElement("div"); linkIcon.classList.add("global-navigation__link-icon");

var linkIconSrc = document.createElement("img");

linkIconSrc.src = favicon; linkIconSrc.setAttribute("width", "16px");

navLinksWrapper.appendChild(linkWrapper); linkWrapper.appendChild(linkIcon); linkWrapper.after(linkTooltip); linkIcon.appendChild(linkIconSrc); }           };

mw.util.addCSS(".navLink + .wds-tooltip { display: none; }"); mw.util.addCSS(".navLink:hover + .wds-tooltip { display: inline-block; }"); mw.util.addCSS(".global-navigation a:nth-of-type(3) { margin-top: 18px; }") }   ); }