User:Антаркт/global.js

//импорт с криптов с dev wiki importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:AjaxPatrol/code.js',        'u:dev:MediaWiki:PiniginsUserInfo/code.js',        'u:dev:MediaWiki:DiscussionsActivity.js',        'u:dev:MediaWiki:UCXSearchBar.js',        'u:dev:MediaWiki:RecentChangesMultiple/code.2.js',        'u:dev:MediaWiki:MultipleActivity.js',        'u:dev:MediaWiki:DiscussionTemplates.js',        'u:nkch:MediaWiki:NkchCSS.js',        'u:dev:MediaWiki:MobilePreview.js',        'u:nkch:MediaWiki:ThemeToggler.js',        'u:nkch:MediaWiki:NoticeManager.js',        'u:dev:MediaWiki:LastEdited/code.js',        'u:dev:MediaWiki:CategorizedNotifications.js',        'u:dev:MediaWiki:OldFandomColors.js',    ] }); //Скрипт от Архххата на галлерею свежих файлов $(function{   var href = $('a[href$=":NewFiles"]').attr('href');

$('a[href$=":NewFiles"]').attr('href', href+'?offset=&limit=500') }); //Скрипт на поиск выделенного текста mw.loader.implement("ext.fandom.HtA.js@111", function ($, require, module) { /*@nomin*/ var exports = {}; require = window.fandomRequire || require; var index = require("./index-50fdfbbe.js"), index$1 = require("./index-1bac726a.js"), useTranslation = require("./useTranslation-0f9ef141.js"), env = require("./env-7a71016f.js"), tslib_es6 = require("./tslib.es6-62bb937a.js"), tracking = require("./tracking-05ed64c1.js"), consts = require("./consts-c47d80e0.js");

function getIsDarkTheme { return mw.config.get("isDarkTheme") }   require("./_commonjsHelpers-b3667336.js"); var arrowHeight = 8;

function MenuContainer(e) { var t, n, i = e.selectionRect, a = e.children, r = (null === (n = null === (t = document.getElementsByClassName("fandom-sticky-header")) || void 0 === t ? void 0 : t[0]) || void 0 === n ? void 0 : n.clientHeight) || 0, c = "".concat((null == i ? void 0 : i.height) - arrowHeight, "px"), l = "".concat((null == i ? void 0 : i.y) - 5, "px"), o = "".concat(i.x + i.width / 2, "px"); return index.react.createElement("div", {           style: {                position: "absolute",                height: c,                top: l,                left: o,                zIndex: 200            }        }, index.react.createElement("div", { className: "highlight__sticky-container ".concat(getIsDarkTheme ? "is-dark-theme" : ""), style: { top: "".concat(r, "px") }       }, index.react.createElement("div", {            className: "highlight__action-wrapper"        }, a))) }   var track = tracking.buildGlobalComponentsTracker({            category: "highlight-to-search",            trackingMethod: consts.TRACKING_METHODS.ANALYTICS        }), trackHighlightMenuSearchThisWiki = function { return track({               label: "highlight-search-this-wiki",                action: consts.ACTIONS.CLICK            }) },       trackHighlightMenuSearchAllWikis = function  { return track({               label: "highlight-search-all-wikis",                action: consts.ACTIONS.CLICK            }) },       trackHighlightText = function (e) { return track({               label: "highlight-text | ".concat(e),                action: consts.ACTIONS.HIGHLIGHT            }) },       MAX_HIGHLIGHT_TEXT_SEARCH_LENGTH = 499;

function SearchWarningMessage(e) { var t = e.highlightText, n = e.suppressWarning; return !(void 0 !== n && n) && t.length > MAX_HIGHLIGHT_TEXT_SEARCH_LENGTH ? index.react.createElement("div", {           className: "highlight__warning-message"        }, "Your Query is too long and will be truncated", index.react.createElement("br", null), "to ", MAX_HIGHLIGHT_TEXT_SEARCH_LENGTH, " characters") : null }

function HighlightAction(e) { var t = e.label, n = e.icon, i = e.href, a = e.onClick, r = e.iconPosition, c = void 0 === r ? "left" : r,           l = n && index.react.createElement(n, {                height: 14            }), o = "right" === c ? index.react.createElement(index.react.Fragment, null, t && index.react.createElement("span", null, t), l) : index.react.createElement(index.react.Fragment, null, l, t && index.react.createElement("span", null, t)); return index.react.createElement("div", {           className: "highlight__action ".concat(getIsDarkTheme ? "is-dark-theme" : "")       }, i ? index.react.createElement("a", { href: i,           target: "_blank", rel: "noopener noreferrer", onClick: a       }, o) : index.react.createElement("button", { onClick: a       }, o)) }   var IconMagnifyingGlassSmall = function  { var e = getIsDarkTheme; return index.react.createElement("svg", {           width: "12",            height: "13",            viewBox: "0 0 12 13",            fill: "none",            xmlns: "http://www.w3.org/2000/svg"        }, index.react.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8 8.36a.331.331 0 0 0-.027.025l-.027.028a3.486 3.486 0 0 1-2.446 1c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5c1.929 0 3.5 1.57 3.5 3.5a3.49 3.49 0 0 1-1 2.446m3.707 2.346L10.03 9.028c.611-.886.97-1.96.97-3.116 0-3.032-2.468-5.5-5.5-5.5a5.507 5.507 0 0 0-5.5 5.5c0 3.033 2.467 5.5 5.5 5.5a5.464 5.464 0 0 0 3.115-.97l1.677 1.677a.997.997 0 0 0 1.415 0 1 1 0 0 0 0-1.414", fill: "".concat(e ? "#3a3a3a" : "#fff") }))   };

function navigateToSearch(e, t) { void 0 === t && (t = "internal"); var n = new URLSearchParams({           scope: t,            query: e,            h: "1",            isFromHighlightActions: "on"        }).toString; window.location.href = "".concat(location.origin, mw.config.get("wgScriptPath"), "/wiki/Special:Search?").concat(n) }

function SearchActions(e) { var t = e.highlightText, n = e.searchActions, i = void 0 === n ? ["search-this", "search-all"] : n,           a = e.labels, r = e.searchIcons, c = e.suppressWarning, l = void 0 !== c && c,           o = useActions({                highlightText: t,                searchActions: i,                searchIcons: r,                labels: a            }); return index.react.createElement(index.react.Fragment, null, index.react.createElement(SearchWarningMessage, { highlightText: t,           suppressWarning: l        }), o.map((function (e, t) {            return index.react.createElement(HighlightAction, tslib_es6.__assign({                key: t            }, e))        }))) }

function useActions(e) { var t, n = e.highlightText, i = e.searchActions, a = void 0 === i ? ["search-this", "search-all"] : i,           r = e.labels, c = e.searchIcons, l = void 0 === c ? {               "search-this": !0, "search-all": !0 } : c,           o = [], s = n.slice(0, MAX_HIGHLIGHT_TEXT_SEARCH_LENGTH), u = useTranslation.useTranslation; if (t = {               "search-this": u("highlight-to-action-search-this-wiki"),                "search-all": u("highlight-to-action-search-all")            }, a.includes("search-this")) { var h = { label: t["search-this"], href: "#", onClick: function (e) { e.preventDefault, trackHighlightMenuSearchThisWiki, navigateToSearch(s, "internal") }           };            l && l["search-this"] && (h.icon = IconMagnifyingGlassSmall), o.push(h) }       if (a.includes("search-all")) { var d = { label: t["search-all"], href: "#", onClick: function (e) { e.preventDefault, trackHighlightMenuSearchAllWikis, navigateToSearch(s, "cross-wiki") }           };            l && l["search-all"] && (d.icon = IconMagnifyingGlassSmall), o.push(d) }       return o    } var defaultRectValues = { width: 0, height: 0, bottom: 0, left: -3e3, right: 0, top: 0, x: 0, y: -3e3 },       boundingClientRectToAbsoluteValues = function (e) { var t = window.scrollY, n = window.scrollX; return e ? {               width: e.width, height: e.height, bottom: e.bottom + t,               left: e.left + n,                right: e.right + n,                top: e.top + t,                x: e.x + n,                y: e.y + t            } : defaultRectValues };

function isEqualBoundingClientRect(e, t) { return !(!e || !t) && ["x", "y", "width", "height"].every((function (n) { return e[n] === t[n] }))   }    var HightlightToActionsApp = function  { var e = document.querySelector("#mw-content-text .unified-search__results") || document.querySelector("#mw-content-text .mw-parser-output"), t = index.react.useState(""), n = t[0], i = t[1], a = index.react.useState(defaultRectValues), r = a[0], c = a[1], l = index.react.useRef(null), o = index.react.useCallback((function { var e;                   null === (e = document.getSelection) || void 0 === e || e.removeAllRanges, i(""), c(defaultRectValues) }), [i, c]), s = index.react.useCallback((function (e) { setTimeout((function { var t, n, i, a;                       (l && l.current && !l.current.contains(e.target) || !(null === (a = null === (i = null === (n = null === (t = document.getSelection) || void 0 === t ? void 0 : t.toString) || void 0 === n ? void 0 : n.call(t)) || void 0 === i ? void 0 : i.trim) || void 0 === a ? void 0 : a.call(i))) && o }), 0)               }), [o, l]); return e ? (index.react.useEffect((function {                var t = function  {                        var t, a, l;                        c(defaultRectValues);                        var s, u, h = document.getSelection,                            d = null === (l = null === (a = null === (t = null == h ? void 0 : h.toString) || void 0 === t ? void 0 : t.call(h)) || void 0 === a ? void 0 : a.trim) || void 0 === l ? void 0 : l.call(a);                       try {                            u = null == (s = null == h ? void 0 : h.getRangeAt(0)) ? void 0 : s.getBoundingClientRect                       } catch (e) {}                        return s && !e.contains(null == s ? void 0 : s.commonAncestorContainer) ? null : d ? (i(d), trackHighlightText(d), n !== d && i(d), void(isEqualBoundingClientRect(u, r) || c(boundingClientRectToAbsoluteValues(u)))) : (n && o, null)                   },                    a = new ResizeObserver(t);                return a.observe(e), e.addEventListener("pointerup", (function (i) {                        t;                        var a = i;                        n ? new ResizeObserver(t).observe(e) : s(a);                        i.stopPropagation                    })),                    function  {                        a.unobserve(e), e.removeEventListener("pointerup", s)                    }            }), [n, s]), index.react.createElement(MenuContainer, { selectionRect: r           }, index.react.createElement("div", {                className: "highlight__actions"            }, index.react.createElement(SearchActions, { highlightText: n,               onClose: o            })))) : null },       initHighlightToAction = function (e) { return index$1.reactDom.render(index.react.createElement(useTranslation.I18nContext.Provider, { value: env.mwMessages }, index.react.createElement(HightlightToActionsApp, null)), e), function { index$1.reactDom.unmountComponentAtNode(e) }       }    $((function  { var e = document.createElement("div"); e.setAttribute("id", "highlight__main-container"), document.body.append(e); var a = $("#highlight__main-container"); mw.hook("ve.activationComplete").add((function { return a.remove, null })), mw.hook("ve.deactivationComplete").add((function { $("body").append(e) })), $(document).mouseup((function (e) { 0 === $(e.target).closest("#mw-content-text .mw-parser-output").length && $("#highlight__main-container > div").css("left", defaultRectValues.left) })), "view" === mw.config.get("wgAction") && 0 === mw.config.get("wgNamespaceNumber") && initHighlightToAction(e) })), module.exports = exports;

}, {}, {   "highlight-to-action-search-all": "\u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0432\u0441\u0435\u043c \u0432\u0438\u043a\u0438", "highlight-to-action-search-this-wiki": "\u041f\u043e\u0438\u0441\u043a \u0432 \u044d\u0442\u043e\u0439 \u0432\u0438\u043a\u0438" });

mw.loader.implement("ext.fandom.HtA.css@111",null,{"css":[   ".highlight__actions{-webkit-box-shadow:0 0 5px 0 rgba(0,0,0,.55);box-shadow:0 0 5px 0 rgba(0,0,0,.55);display:-webkit-box;display:flex;padding:9px}.highlight__sticky-container{background-color:#280033;border-radius:3px;bottom:0;color:#fff;font-family:rubik,helvetica,arial,sans-serif;font-size:14px;font-weight:400;margin-top:-44px;min-height:36px;position:-webkit-sticky;position:sticky;-webkit-transform:translateX(-50%);transform:translateX(-50%);z-index:1000}.highlight__sticky-container:before{border:8px solid transparent;border-top-color:#280033;content:\"\";left:50%;margin-left:-5.33333px;position:absolute;top:97%}.highlight__sticky-container a{color:currentColor}.highlight__sticky-container svg{fill:currentColor}.highlight__sticky-container.is-dark-theme{background-color:#ffc500;color:#3a3a3a}.highlight__sticky-container.is-dark-theme:before{border-color:#ffc500 transparent transparent}.highlight__action-wrapper{height:auto;width:100%}.highlight__warning-message{background-color:#595358;border-radius:3px;bottom:calc(100% + 7px);-webkit-box-sizing:content-box;box-sizing:content-box;color:#fff;font-family:rubik,helvetica,arial,sans-serif;font-size:14px;left:50%;line-height:21px;padding:12px;position:absolute;text-align:center;-webkit-transform:translateX(-50%);transform:translateX(-50%);width:350px}.highlight__action{display:-webkit-box;display:flex;font-size:14px;line-height:17px}.highlight__action:after{border-right:1px solid hsla(0,0%,100%,.25);content:\"\";display:block;height:12px;margin:auto 9px;width:0}.highlight__action:last-child:after{display:none}.highlight__action a,.highlight__action button{-webkit-box-align:center;align-items:center;display:-webkit-box;display:flex;font-size:14px;line-height:17px;margin:0;padding:0;text-decoration:none}.highlight__action a:active,.highlight__action a:focus,.highlight__action a:hover,.highlight__action button:active,.highlight__action button:focus,.highlight__action button:hover{color:currentColor;text-decoration:underline}.highlight__action svg{margin-right:3px;vertical-align:middle}.highlight__action:not(:first-child) svg{display:none}.highlight__action button{background-color:transparent;border-style:none;-webkit-box-shadow:none;box-shadow:none;color:currentColor;cursor:pointer;outline-offset:0}.highlight__action.is-dark-theme:after{border-right:1px solid rgba(14,25,26,.3)}" ]});