×
Einen neuen Artikel erstellen
Schreibe den Seitennamen hierhin:
Wir haben derzeit 9.351 Artikel auf VAULTPEDIA. Gib deinen Artikelnamen oberhalb von oder klicke auf einen der unten stehenden Titel und beginne zu schreiben! ein



    VAULTPEDIA
    9.351Artikel

    Benutzer:Eckserah/cosmos.js: Unterschied zwischen den Versionen

    VAULTPEDIA.DE ist seit dem 02.02.2026 öffentlich zugänglich.

    Da es sich um ein frisch migriertes Wiki handelt, können vereinzelt noch Datenbank-, Seiten- oder Designfehler auftreten.

    Tritt unserem Discord bei, um Fehler zu melden oder direkt mit dem Team in Kontakt zu treten.

    Keine Bearbeitungszusammenfassung
    Keine Bearbeitungszusammenfassung
     
    (7 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
    Zeile 1: Zeile 1:
    var _create_class = {
    $(document).ready(function() {
    _defineProperties: function(e, r) {
    mw.loader.using(["oojs-ui", "jquery"]).done(function() {
        for (var a = 0; a < r.length; a++) {
    var _create_class = {
            var c = r[a];
    _class_call_check: function(e, r) {
            c.enumerable = c.enumerable || !1,
                if (!(e instanceof r))
            c.configurable = !0,
                    throw new TypeError("Cannot call a class as a function")
            "value"in c && (c.writable = !0),
            },
            Object.defineProperty(e, c.key, c)
    _defineProperties: function(e, r) {
        }
        for (var a = 0; a < r.length; a++) {
    },
            var c = r[a];
    _create_class: function(e, r, a) {
            c.enumerable = c.enumerable || !1,
        return r && _defineProperties(e.prototype, r),
            c.configurable = !0,
        a && _defineProperties(e, a),
            "value"in c && (c.writable = !0),
        e
            Object.defineProperty(e, c.key, c)
    }
        }
    };
    },
    var SET_LINK_SUGGESTIONS = "SET_LINK_SUGGESTIONS"
    _create_class: function(e, r, a) {
      , CLOSE_LINK_SUGGESTIONS = "CLOSE_LINK_SUGGESTIONS"
        return r && this._defineProperties(e.prototype, r),
      , HIGHLIGHTED_SUGGESTION_CHANGED = "HIGHLIGHTED_SUGGESTION_CHANGED";
        a && this._defineProperties(e, a),
    function LinkSuggestModel(e) {
        e
        OO.EventEmitter.call(this),
    }
        this.isCodeMirrorActive = e,
    };
        this.linkSuggestions = [],
        this.query = {},
    var _define_property = {
        this.highlightedSuggestionIndex = -1
    _define_property: function(e, r, o) {
    }
                return r in e ? Object.defineProperty(e, r, {
    OO.initClass(LinkSuggestModel),
                    value: o,
    OO.mixinClass(LinkSuggestModel, OO.EventEmitter),
                    enumerable: !0,
    LinkSuggestModel.prototype.setCodeMirrorActive = function(e) {
                    configurable: !0,
        this.isCodeMirrorActive = e
                    writable: !0
    }
                }) : e[r] = o,
    ,
                e
    LinkSuggestModel.prototype.setLinkSuggestQuery = function(e, t) {
            }
        this.query = e,
    };
        this.linkSuggestions = t,
    var SET_LINK_SUGGESTIONS = "SET_LINK_SUGGESTIONS"
        this.highlightedSuggestionIndex = -1,
      , CLOSE_LINK_SUGGESTIONS = "CLOSE_LINK_SUGGESTIONS"
        this.emit(SET_LINK_SUGGESTIONS)
      , HIGHLIGHTED_SUGGESTION_CHANGED = "HIGHLIGHTED_SUGGESTION_CHANGED";
    }
    function LinkSuggestModel(e) {
    ,
        OO.EventEmitter.call(this),
    LinkSuggestModel.prototype.highlightNextSuggestion = function() {
        this.isCodeMirrorActive = e,
        this.highlightedSuggestionIndex === this.linkSuggestions.length - 1 ? this.highlightedSuggestionIndex = -1 : this.highlightedSuggestionIndex++,
        this.linkSuggestions = [],
        this.emit(HIGHLIGHTED_SUGGESTION_CHANGED)
        this.query = {},
    }
        this.highlightedSuggestionIndex = -1
    ,
    }
    LinkSuggestModel.prototype.highlightPreviousSuggestion = function() {
    OO.initClass(LinkSuggestModel),
        -1 === this.highlightedSuggestionIndex ? this.highlightedSuggestionIndex = this.linkSuggestions.length - 1 : this.highlightedSuggestionIndex--,
    OO.mixinClass(LinkSuggestModel, OO.EventEmitter),
        this.emit(HIGHLIGHTED_SUGGESTION_CHANGED)
    LinkSuggestModel.prototype.setCodeMirrorActive = function(e) {
    }
        this.isCodeMirrorActive = e
    ,
    }
    LinkSuggestModel.prototype.closeLinkSuggestions = function() {
    ,
        this.highlightedSuggestionIndex = -1,
    LinkSuggestModel.prototype.setLinkSuggestQuery = function(e, t) {
        this.linkSuggestions = [],
        this.query = e,
        this.emit(CLOSE_LINK_SUGGESTIONS)
        this.linkSuggestions = t,
    }
        this.highlightedSuggestionIndex = -1,
    ;
        this.emit(SET_LINK_SUGGESTIONS)
    var LinkSuggestController = function() {
    }
        function e(t, i, o, n) {
    ,
            var r = this;
    LinkSuggestModel.prototype.highlightNextSuggestion = function() {
            _create_class._class_call_check(this, e),
        this.highlightedSuggestionIndex === this.linkSuggestions.length - 1 ? this.highlightedSuggestionIndex = -1 : this.highlightedSuggestionIndex++,
            _define_property._define_property(this, "debouncedPerformLinkSuggestQuery", OO.ui.debounce(this.performLinkSuggestQuery.bind(this), 300)),
        this.emit(HIGHLIGHTED_SUGGESTION_CHANGED)
            _define_property._define_property(this, "handleKeydown", (function(e) {
    }
                var t = e.key
    ,
                  , i = r.model
    LinkSuggestModel.prototype.highlightPreviousSuggestion = function() {
                  , o = i.linkSuggestions
        -1 === this.highlightedSuggestionIndex ? this.highlightedSuggestionIndex = this.linkSuggestions.length - 1 : this.highlightedSuggestionIndex--,
                  , n = i.highlightedSuggestionIndex
        this.emit(HIGHLIGHTED_SUGGESTION_CHANGED)
                  , s = i.query.originalContent;
    }
                if (!!o.length) {
    ,
                    if ("ArrowDown" === t)
    LinkSuggestModel.prototype.closeLinkSuggestions = function() {
                        return e.preventDefault(),
        this.highlightedSuggestionIndex = -1,
                        r.model.highlightNextSuggestion(),
        this.linkSuggestions = [],
                        !0;
        this.emit(CLOSE_LINK_SUGGESTIONS)
                    if ("ArrowUp" === t)
    }
                        return e.preventDefault(),
    ;
                        r.model.highlightPreviousSuggestion(),
    var LinkSuggestController = function() {
                        !0;
        function e(t, i, o, n) {
                    if ("Enter" === t && -1 !== n) {
            var r = this;
                        e.preventDefault();
            _create_class._class_call_check(this, e),
                        var a = o[n]
            _define_property._define_property(this, "debouncedPerformLinkSuggestQuery", OO.ui.debounce(this.performLinkSuggestQuery.bind(this), 300)),
                          , d = index$1.getContentForSuggestions({
            _define_property._define_property(this, "handleKeydown", (function(e) {
                            suggestion: a,
                var t = e.key
                            originalContent: s
                  , i = r.model
                        }).textToInsert;
                  , o = i.linkSuggestions
                        return r.applyLinkSuggest(d),
                  , n = i.highlightedSuggestionIndex
                        !0
                  , s = i.query.originalContent;
                    }
                if (!!o.length) {
                    if ("Esc" === t || "Escape" === t)
                    if ("ArrowDown" === t)
                        return e.preventDefault(),
                        return e.preventDefault(),
                        r.model.closeLinkSuggestions(),
                        r.model.highlightNextSuggestion(),
                        !0
                        !0;
                }
                    if ("ArrowUp" === t)
                r.debouncedPerformLinkSuggestQuery()
                        return e.preventDefault(),
            }
                        r.model.highlightPreviousSuggestion(),
            )),
                        !0;
            this.model = t,
                    if ("Enter" === t && -1 !== n) {
            this.$textbox = i,
                        e.preventDefault();
            this.api = o,
                        var a = o[n]
            this.pageLanguageHasWordBreaks = n
                          , d = index$1.getContentForSuggestions({
        }
                            suggestion: a,
        return _create_class._create_class(e, [{
                            originalContent: s
            key: "applyLinkSuggest",
                        }).textToInsert;
            value: function(e) {
                        return r.applyLinkSuggest(d),
                var t = this.model.query
                        !0
                  , i = t.startOffset
                    }
                  , o = t.wasTemplateTransclusion
                    if ("Esc" === t || "Escape" === t)
                  , n = this.$textbox.textSelection("getCaretPosition")
                        return e.preventDefault(),
                  , r = o ? "}}" : "]]"
                        r.model.closeLinkSuggestions(),
                  , s = 1 + i + e.length + r.length;
                        !0
                this.$textbox.textSelection("setSelection", {
                }
                    start: 1 + i,
                r.debouncedPerformLinkSuggestQuery()
                    end: n
            }
                }).textSelection("replaceSelection", e + r).textSelection("setSelection", {
            )),
                    start: s,
            this.model = t,
                    end: s
            this.$textbox = i,
                }),
            this.api = o,
                this.model.closeLinkSuggestions()
            this.pageLanguageHasWordBreaks = n
            }
        }
        }, {
        return _create_class._create_class(e, [{
            key: "performLinkSuggestQuery",
            key: "applyLinkSuggest",
            value: function() {
            value: function(e) {
                var e = this
                var t = this.model.query
                  , t = this.$textbox.textSelection("getContents")
                  , i = t.startOffset
                  , i = this.$textbox.textSelection("getCaretPosition")
                  , o = t.wasTemplateTransclusion
                  , o = this.pageLanguageHasWordBreaks ? 4 : 1
                  , n = this.$textbox.textSelection("getCaretPosition")
                  , n = index$1.getLinkSuggestQueryFromText(t, i, o);
                  , r = o ? "}}" : "]]"
                if (!n || n.content.length < o || n.content.includes("|"))
                  , s = 1 + i + e.length + r.length;
                    this.model.closeLinkSuggestions();
                this.$textbox.textSelection("setSelection", {
                else {
                    start: 1 + i,
                    var r = n.content.includes("|");
                    end: n
                    this.api.get({
                }).textSelection("replaceSelection", e + r).textSelection("setSelection", {
                        action: "linksuggest",
                    start: s,
                        get: "suggestions",
                    end: s
                        query: n.content
                }),
                    }).then((function(t) {
                this.model.closeLinkSuggestions()
                        var i = t.linksuggest.result.suggestions;
            }
                        i.length && !r ? e.model.setLinkSuggestQuery(n, i) : e.model.closeLinkSuggestions()
        }, {
                    }
            key: "performLinkSuggestQuery",
                    ))
            value: function() {
                }
                var e = this
            }
                  , t = this.$textbox.textSelection("getContents")
        }, {
                  , i = this.$textbox.textSelection("getCaretPosition")
            key: "setLinkSuggestEventHandlers",
                  , o = this.pageLanguageHasWordBreaks ? 4 : 1
            value: function() {
                  , n = index$1.getLinkSuggestQueryFromText(t, i, o);
                var e = this
                if (!n || n.content.length < o || n.content.includes("|"))
                  , t = this.model.isCodeMirrorActive;
                    this.model.closeLinkSuggestions();
                this.model.closeLinkSuggestions(),
                else {
                t ? mw.loader.using(["ext.CodeMirror.v6", "ext.CodeMirror.v6.mode.mediawiki"], (function(t) {
                    var r = n.content.includes("|");
                    var i = t("ext.CodeMirror.v6.lib")
                    this.api.get({
                      , o = i.EditorView
                        action: "linksuggest",
                      , n = i.StateEffect
                        get: "suggestions",
                      , r = i.Prec;
                        query: n.content
                    e.$textbox.off("keydown.linksuggest");
                    }).then((function(t) {
                    var s = o.domEventHandlers({
                        var i = t.linksuggest.result.suggestions;
                        keydown: function(t, i) {
                        i.length && !r ? e.model.setLinkSuggestQuery(n, i) : e.model.closeLinkSuggestions()
                            return e.handleKeydown(t)
                    }
                        }
                    ))
                    });
                }
                    mw.hook("ext.CodeMirror.ready").add((function(e, t) {
            }
                        t.view.dispatch({
        }, {
                            effects: n.appendConfig.of(r.high(s))
            key: "setLinkSuggestEventHandlers",
                        })
            value: function() {
                    }
                var e = this
                    ))
                  , t = this.model.isCodeMirrorActive;
                }
                this.model.closeLinkSuggestions(),
                )) : this.addLinkSuggestWithoutSyntaxHighlighting()
                t ? mw.loader.using(["ext.CodeMirror.v6", "ext.CodeMirror.v6.mode.mediawiki"], (function(t) {
            }
                    var i = t("ext.CodeMirror.v6.lib")
        }, {
                      , o = i.EditorView
            key: "addLinkSuggestWithoutSyntaxHighlighting",
                      , n = i.StateEffect
            value: function() {
                      , r = i.Prec;
                this.$textbox.on("keydown.linksuggest", this.handleKeydown)
                    e.$textbox.off("keydown.linksuggest");
            }
                    var s = o.domEventHandlers({
        }, {
                        keydown: function(t, i) {
            key: "updateCodeMirrorState",
                            return e.handleKeydown(t)
            value: function(e) {
                        }
                var t = this;
                    });
                this.model.setCodeMirrorActive(e),
                    mw.hook("ext.CodeMirror.ready").add((function(e, t) {
                setTimeout((function() {
                        t.view.dispatch({
                    return t.setLinkSuggestEventHandlers()
                            effects: n.appendConfig.of(r.high(s))
                }
                        })
                ))
                    }
            }
                    ))
        }]),
                }
        e
                )) : this.addLinkSuggestWithoutSyntaxHighlighting()
    }();
            }
    function LinkSuggestPopupWidget(e, t, i, o) {
        }, {
        var n;
            key: "addLinkSuggestWithoutSyntaxHighlighting",
        this.model = e,
            value: function() {
        this.controller = t,
                this.$textbox.on("keydown.linksuggest", this.handleKeydown)
        this.$textbox = i,
            }
        this.codeMirrorInstance = null,
        }, {
        this.$caretCoordinateCalculator = o,
            key: "updateCodeMirrorState",
        this.textboxLineHeight = i.css("line-height"),
            value: function(e) {
        this.debouncedUpdatePosition = OO.ui.debounce(this.updatePosition.bind(this), 300),
                var t = this;
        this.model.connect(this, (n = {},
                this.model.setCodeMirrorActive(e),
        _define_property._define_property(n, SET_LINK_SUGGESTIONS, "onLinkSuggestionsSet"),
                setTimeout((function() {
        _define_property._define_property(n, CLOSE_LINK_SUGGESTIONS, "onCloseLinkSuggestions"),
                    return t.setLinkSuggestEventHandlers()
        _define_property._define_property(n, HIGHLIGHTED_SUGGESTION_CHANGED, "onHighlightedSuggestionChanged"),
                }
        n)),
                ))
        this.selectWidget = new OO.ui.SelectWidget,
            }
        this.selectWidget.connect(this, {
        }]),
            choose: "onSuggestionSelected"
        e
        }),
    }();
        LinkSuggestPopupWidget.super.call(this, {
    function LinkSuggestPopupWidget(e, t, i, o) {
            $content: this.selectWidget.$element,
        var n;
            padded: !1,
        this.model = e,
            autoFlip: !1,
        this.controller = t,
            hideWhenOutOfView: !1
        this.$textbox = i,
        }),
        this.codeMirrorInstance = null,
        this.$element.addClass("wikiEditor-ui-linkSuggest"),
        this.$caretCoordinateCalculator = o,
        this.$popup.addClass("wikiEditor-ui-linkSuggest-popup"),
        this.textboxLineHeight = i.css("line-height"),
        this.toggle(!1),
        this.debouncedUpdatePosition = OO.ui.debounce(this.updatePosition.bind(this), 300),
        this.$textbox.on("scroll", this.debouncedUpdatePosition),
        this.model.connect(this, (n = {},
        jquery.$(document).on("scroll", this.debouncedUpdatePosition)
        _define_property._define_property(n, SET_LINK_SUGGESTIONS, "onLinkSuggestionsSet"),
    }
        _define_property._define_property(n, CLOSE_LINK_SUGGESTIONS, "onCloseLinkSuggestions"),
    function WikiEditorModeSwitchPopupButtonWidget(e) {
        _define_property._define_property(n, HIGHLIGHTED_SUGGESTION_CHANGED, "onHighlightedSuggestionChanged"),
        var t = new OO.ui.ButtonWidget({
        n)),
            framed: !1,
        this.selectWidget = new OO.ui.SelectWidget,
            label: mw.msg("visualeditor-mweditmodeve-tool-current"),
        this.selectWidget.connect(this, {
            icon: "eye"
            choose: "onSuggestionSelected"
        });
        }),
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-visualSwitch"),
        LinkSuggestPopupWidget.super.call(this, {
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member"),
            $content: this.selectWidget.$element,
        t.on("click", e),
            padded: !1,
        t.connect(this, {
            autoFlip: !1,
            click: "hidePopup"
            hideWhenOutOfView: !1
        }),
        }),
        WikiEditorModeSwitchPopupButtonWidget.super.call(this, {
        this.$element.addClass("wikiEditor-ui-linkSuggest"),
            framed: !1,
        this.$popup.addClass("wikiEditor-ui-linkSuggest-popup"),
            indicator: "down",
        this.toggle(!1),
            popup: {
        this.$textbox.on("scroll", this.debouncedUpdatePosition),
                containerPadding: 0,
        $(document).on("scroll", this.debouncedUpdatePosition)
                $content: t.$element,
    }
                width: null
    function WikiEditorModeSwitchPopupButtonWidget(e) {
            },
        var t = new OO.ui.ButtonWidget({
            icon: "wikiText",
            framed: !1,
            label: mw.msg("visual-editor-fandom-switch-dropdown-mode-source-label")
            label: mw.msg("visualeditor-mweditmodeve-tool-current"),
        }),
            icon: "eye"
        this.$element.addClass("ve-ui-modeSwitchPopupButtonWidget ve-ui-modeSwitchPopupButtonWidget-fd ve-header-action-item"),
        });
        this.$button.attr("id", "ve-ui-modeSwitchPopupButtonWidget-button"),
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-visualSwitch"),
        this.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-button"),
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member"),
        this.popup.$popup.addClass("ve-ui-modeSwitchPopupButtonWidget-popup")
        t.on("click", e),
    }
        t.connect(this, {
    function CodeEditorModeSwitchPopupButtonWidget(e) {
            click: "hidePopup"
        var t = new OO.ui.ButtonWidget({
        }),
            framed: !1,
        WikiEditorModeSwitchPopupButtonWidget.super.call(this, {
            label: mw.msg("visualeditor-mweditmodeve-tool-current"),
            framed: !1,
            icon: "eye",
            indicator: "down",
            href: e.href
            popup: {
        });
                containerPadding: 0,
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-visualSwitch"),
                $content: t.$element,
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member");
                width: null
        var i = new OO.ui.ButtonWidget({
            },
            framed: !1,
            icon: "wikiText",
            label: mw.msg("visualeditor-mweditmodesource-tool-current"),
            label: mw.msg("visual-editor-fandom-switch-dropdown-mode-source-label")
            icon: "wikiText"
        }),
        });
        this.$element.addClass("ve-ui-modeSwitchPopupButtonWidget ve-ui-modeSwitchPopupButtonWidget-fd ve-header-action-item"),
        i.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-sourceSwitch"),
        this.$button.attr("id", "ve-ui-modeSwitchPopupButtonWidget-button"),
        i.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member"),
        this.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-button"),
        i.setDisabled(!0);
        this.popup.$popup.addClass("ve-ui-modeSwitchPopupButtonWidget-popup")
        var o = t.$element.add(i.$element);
    }
        CodeEditorModeSwitchPopupButtonWidget.super.call(this, {
    function CodeEditorModeSwitchPopupButtonWidget(e) {
            framed: !1,
        var t = new OO.ui.ButtonWidget({
            indicator: "down",
            framed: !1,
            popup: {
            label: mw.msg("visualeditor-mweditmodeve-tool-current"),
                containerPadding: 0,
            icon: "eye",
                $content: o,
            href: e.href
                width: null
        });
            },
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-visualSwitch"),
            icon: "wikiText",
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member");
            label: mw.msg("visual-editor-fandom-switch-dropdown-mode-source-label")
        var i = new OO.ui.ButtonWidget({
        }),
            framed: !1,
        this.$element.addClass("ve-ui-modeSwitchPopupButtonWidget ve-ui-modeSwitchPopupButtonWidget-fd ve-header-action-item"),
            label: mw.msg("visualeditor-mweditmodesource-tool-current"),
        this.$button.attr("id", "ve-ui-modeSwitchPopupButtonWidget-button"),
            icon: "wikiText"
        this.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-button"),
        });
        this.popup.$popup.addClass("ve-ui-modeSwitchPopupButtonWidget-popup")
        i.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-sourceSwitch"),
    }
        i.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member"),
    function initLinkSuggest(e) {
        i.setDisabled(!0);
        var t = !mw.user.options.get("disablelinksuggest")
        var o = t.$element.add(i.$element);
          , i = "wikitext" === mw.config.get("wgPageContentModel");
        CodeEditorModeSwitchPopupButtonWidget.super.call(this, {
        if (t && i) {
            framed: !1,
            var o = mw.user.options.get("usecodemirror") > 0
            indicator: "down",
              , n = mw.config.get("wgPageLanguageHasWordBreaks")
            popup: {
              , r = new mw.Api
                containerPadding: 0,
              , s = new LinkSuggestModel(o)
                $content: o,
              , a = new LinkSuggestController(s,e,r,n)
                width: null
              , d = $("<div />").css({
            },
                position: "absolute",
            icon: "wikiText",
                top: "-2000px",
            label: mw.msg("visual-editor-fandom-switch-dropdown-mode-source-label")
                left: "-2000px",
        }),
                visibility: "hidden",
        this.$element.addClass("ve-ui-modeSwitchPopupButtonWidget ve-ui-modeSwitchPopupButtonWidget-fd ve-header-action-item"),
                "white-space": "pre-wrap",
        this.$button.attr("id", "ve-ui-modeSwitchPopupButtonWidget-button"),
                "font-family": e.css("font-family"),
        this.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-button"),
                "font-size": e.css("font-size"),
        this.popup.$popup.addClass("ve-ui-modeSwitchPopupButtonWidget-popup")
                "line-height": e.css("line-height")
    }
            }).appendTo(document.body)
    function initLinkSuggest(e) {
              , u = new LinkSuggestPopupWidget(s,a,e,d);
        var t = !mw.user.options.get("disablelinksuggest")
            $(".wikiEditor-ui-text").prepend(u.$element),
          , i = "wikitext" === mw.config.get("wgPageContentModel");
            mw.hook("ext.CodeMirror.switch").add((function(e) {
        if (t && i) {
                a.updateCodeMirrorState(e),
            var o = mw.user.options.get("usecodemirror") > 0
                u.setCodeMirrorInstance(e)
              , n = mw.config.get("wgPageLanguageHasWordBreaks")
            }
              , r = new mw.Api
            )),
              , s = new LinkSuggestModel(o)
            setTimeout((function() {
              , a = new LinkSuggestController(s,e,r,n)
                return a.addLinkSuggestWithoutSyntaxHighlighting()
              , d = $("<div />").css({
            }
                position: "absolute",
            ))
                top: "-2000px",
        }
                left: "-2000px",
    }
                visibility: "hidden",
    function postSetupInit() {
                "white-space": "pre-wrap",
        $(".mw-indicators").prependTo("#wikiPreview .mw-parser-output"),
                "font-family": e.css("font-family"),
        $(".page-footer__categories").appendTo("#wikiPreview .mw-parser-output"),
                "font-size": e.css("font-size"),
        setTimeout(wikiEditorTracking),
                "line-height": e.css("line-height")
        mw.hook("ext.CodeMirror.initialize").add((function(e) {
            }).appendTo(document.body)
            "submit" === mw.config.get("wgAction") && window.scrollTo({
              , u = new LinkSuggestPopupWidget(s,a,e,d);
                top: 0
            $(".wikiEditor-ui-text").prepend(u.$element),
            })
            mw.hook("ext.CodeMirror.switch").add((function(e) {
        }
                a.updateCodeMirrorState(e),
        ))
                u.setCodeMirrorInstance(e)
    }
            }
    OO.inheritClass(LinkSuggestPopupWidget, OO.ui.PopupWidget),
            )),
    LinkSuggestPopupWidget.prototype.onLinkSuggestionsSet = function() {
            setTimeout((function() {
        var e = this.model
                return a.addLinkSuggestWithoutSyntaxHighlighting()
          , t = e.linkSuggestions
            }
          , i = e.query.originalContent;
            ))
        if (t.length) {
        }
            this.selectWidget.clearItems();
    }
            var o = t.map((function(e) {
    function postSetupInit() {
                var t = index$1.getContentForSuggestions({
        $(".mw-indicators").prependTo("#wikiPreview .mw-parser-output"),
                    suggestion: e,
        $(".page-footer__categories").appendTo("#wikiPreview .mw-parser-output"),
                    originalContent: i
        mw.hook("ext.CodeMirror.initialize").add((function(e) {
                })
            "submit" === mw.config.get("wgAction") && window.scrollTo({
                  , o = t.textToInsert
                top: 0
                  , n = t.textToDisplay
            })
                  , r = new OO.ui.OptionWidget({
        }
                    data: o,
        ))
                    label: n
    }
                });
    OO.inheritClass(LinkSuggestPopupWidget, OO.ui.PopupWidget),
                return r.$element.addClass("wikiEditor-ui-linkSuggest-suggestion"),
    LinkSuggestPopupWidget.prototype.onLinkSuggestionsSet = function() {
                r
        var e = this.model
            }
          , t = e.linkSuggestions
            ));
          , i = e.query.originalContent;
            this.selectWidget.addItems(o),
        if (t.length) {
            this.toggle(!0),
            this.selectWidget.clearItems();
            this.updatePosition(),
            var o = t.map((function(e) {
            this.model.isCodeMirrorActive && (this.toggle(!1),
                var t = index$1.getContentForSuggestions({
            this.toggleClipping(!1),
                    suggestion: e,
            this.position(),
                    originalContent: i
            this.toggleClipping(!0),
                })
            this.toggle(!0)),
                  , o = t.textToInsert
            this.updatePositionIfOutsideOfViewport()
                  , n = t.textToDisplay
        } else
                  , r = new OO.ui.OptionWidget({
            this.toggle(!1)
                    data: o,
    }
                    label: n
    ,
                });
    LinkSuggestPopupWidget.prototype.onCloseLinkSuggestions = function() {
                return r.$element.addClass("wikiEditor-ui-linkSuggest-suggestion"),
        this.toggle(!1),
                r
        this.$element.addClass("oo-ui-element-hidden"),
            }
        this.selectWidget.clearItems()
            ));
    }
            this.selectWidget.addItems(o),
    ,
            this.toggle(!0),
    LinkSuggestPopupWidget.prototype.computePosition = function() {
            this.updatePosition(),
        var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
            this.model.isCodeMirrorActive && (this.toggle(!1),
        LinkSuggestPopupWidget.super.prototype.computePosition.call(this),
            this.toggleClipping(!1),
        this.$anchor.css({
            this.position(),
            left: 12
            this.toggleClipping(!0),
        });
            this.toggle(!0)),
        var t = null != e ? e : this.getCaretPosition()
            this.updatePositionIfOutsideOfViewport()
          , i = t.top
        } else
          , o = t.left;
            this.toggle(!1)
        return {
    }
            position: "fixed",
    ,
            top: "".concat(i, "px"),
    LinkSuggestPopupWidget.prototype.onCloseLinkSuggestions = function() {
            left: "".concat(o, "px"),
        this.toggle(!1),
            "margin-top": this.textboxLineHeight
        this.$element.addClass("oo-ui-element-hidden"),
        }
        this.selectWidget.clearItems()
    }
    }
    ,
    ,
    LinkSuggestPopupWidget.prototype.getCaretPosition = function() {
    LinkSuggestPopupWidget.prototype.computePosition = function() {
        var e = this.model
        var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
          , t = e.isCodeMirrorActive
        LinkSuggestPopupWidget.super.prototype.computePosition.call(this),
          , i = e.query.startOffset;
        this.$anchor.css({
        if (t) {
            left: 12
            var o = this.codeMirrorInstance.view.state.selection.main.head;
        });
            return this.codeMirrorInstance.view.coordsAtPos(o)
        var t = null != e ? e : this.getCaretPosition()
        }
          , i = t.top
        var n = this.$textbox.textSelection("getContents")
          , o = t.left;
          , r = this.$textbox.textSelection("getCaretPosition")
        return {
          , s = jquery.$("<span />").text(n.substring(i, r));
            position: "fixed",
        this.$caretCoordinateCalculator.width(this.$textbox[0].scrollWidth).text(n.substring(0, i)).append(s);
            top: "".concat(i, "px"),
        var a = this.$textbox.offset()
            left: "".concat(o, "px"),
          , d = a.top
            "margin-top": this.textboxLineHeight
          , u = a.left
        }
          , c = s.position()
    }
          , l = c.top
    ,
          , g = c.left
    LinkSuggestPopupWidget.prototype.getCaretPosition = function() {
          , p = s.width()
        var e = this.model
          , h = this.$textbox.scrollTop()
          , t = e.isCodeMirrorActive
          , m = this.$textbox.scrollLeft();
          , i = e.query.startOffset;
        return {
        if (t) {
            top: d + l - h - window.scrollY,
            var o = this.codeMirrorInstance.view.state.selection.main.head;
            left: u + g + p - m - window.scrollX
            return this.codeMirrorInstance.view.coordsAtPos(o)
        }
        }
    }
        var n = this.$textbox.textSelection("getContents")
    ,
          , r = this.$textbox.textSelection("getCaretPosition")
    LinkSuggestPopupWidget.prototype.updatePosition = function() {
          , s = $("<span />").text(n.substring(i, r));
        var e = this.getCaretPosition();
        this.$caretCoordinateCalculator.width(this.$textbox[0].scrollWidth).text(n.substring(0, i)).append(s);
        if (this.toggleClipping(!1),
        var a = this.$textbox.offset()
        this.position(),
          , d = a.top
        this.toggleClipping(!0),
          , u = a.left
        this.selectWidget.items.length) {
          , c = s.position()
            var t, i;
          , l = c.top
            this.$element.css(this.computePosition(e));
          , g = c.left
            var o = null !== (i = null === (t = this.codeMirrorInstance) || void 0 === t ? void 0 : t.view.dom.getBoundingClientRect()) && void 0 !== i ? i : this.$textbox[0].getBoundingClientRect()
          , p = s.width()
              , n = e.top >= o.top && e.top <= o.bottom;
          , h = this.$textbox.scrollTop()
            this.toggle(n)
          , m = this.$textbox.scrollLeft();
        }
        return {
    }
            top: d + l - h - window.scrollY,
    ,
            left: u + g + p - m - window.scrollX
    LinkSuggestPopupWidget.prototype.setCodeMirrorInstance = function(e) {
        }
        var t = this;
    }
        e ? mw.loader.using(["ext.CodeMirror.v6", "ext.CodeMirror.v6.mode.mediawiki"], (function(e) {
    ,
            var i = e("ext.CodeMirror.v6.lib")
    LinkSuggestPopupWidget.prototype.updatePosition = function() {
              , o = i.EditorView
        var e = this.getCaretPosition();
              , n = i.StateEffect;
        if (this.toggleClipping(!1),
            t.$textbox.off("keydown.linksuggest");
        this.position(),
            var r = o.domEventHandlers({
        this.toggleClipping(!0),
                scroll: function(e, i) {
        this.selectWidget.items.length) {
                    return t.debouncedUpdatePosition()
            var t, i;
                }
            this.$element.css(this.computePosition(e));
            });
            var o = null !== (i = null === (t = this.codeMirrorInstance) || void 0 === t ? void 0 : t.view.dom.getBoundingClientRect()) && void 0 !== i ? i : this.$textbox[0].getBoundingClientRect()
            mw.hook("ext.CodeMirror.ready").add((function(e, i) {
              , n = e.top >= o.top && e.top <= o.bottom;
                t.codeMirrorInstance = i,
            this.toggle(n)
                t.codeMirrorInstance.view.dispatch({
        }
                    effects: n.appendConfig.of(r)
    }
                })
    ,
            }
    LinkSuggestPopupWidget.prototype.setCodeMirrorInstance = function(e) {
            ))
        var t = this;
        }
        e ? mw.loader.using(["ext.CodeMirror.v6", "ext.CodeMirror.v6.mode.mediawiki"], (function(e) {
        )) : this.codeMirrorInstance = null
            var i = e("ext.CodeMirror.v6.lib")
    }
              , o = i.EditorView
    ,
              , n = i.StateEffect;
    LinkSuggestPopupWidget.prototype.onHighlightedSuggestionChanged = function() {
            t.$textbox.off("keydown.linksuggest");
        var e = this.model.highlightedSuggestionIndex;
            var r = o.domEventHandlers({
        if (-1 === e)
                scroll: function(e, i) {
            this.selectWidget.highlightItem();
                    return t.debouncedUpdatePosition()
        else {
                }
            var t = this.selectWidget.items[e];
            });
            this.selectWidget.highlightItem(t)
            mw.hook("ext.CodeMirror.ready").add((function(e, i) {
        }
                t.codeMirrorInstance = i,
    }
                t.codeMirrorInstance.view.dispatch({
    ,
                    effects: n.appendConfig.of(r)
    LinkSuggestPopupWidget.prototype.onSuggestionSelected = function(e) {
                })
        var t = e.getData();
            }
        this.controller.applyLinkSuggest(t)
            ))
    }
        }
    ,
        )) : this.codeMirrorInstance = null
    LinkSuggestPopupWidget.prototype.updatePositionIfOutsideOfViewport = function() {
    }
        var e = this.$element.get(0).getBoundingClientRect()
    ,
          , t = e.left
    LinkSuggestPopupWidget.prototype.onHighlightedSuggestionChanged = function() {
          , i = e.right
        var e = this.model.highlightedSuggestionIndex;
          , o = e.width;
        if (-1 === e)
        window.innerWidth < i && (this.$anchor.css({
            this.selectWidget.highlightItem();
            left: "auto",
        else {
            right: 12
            var t = this.selectWidget.items[e];
        }),
            this.selectWidget.highlightItem(t)
        this.$element.css({
        }
            left: t - o
    }
        }))
    ,
    }
    LinkSuggestPopupWidget.prototype.onSuggestionSelected = function(e) {
    ,
        var t = e.getData();
    OO.inheritClass(WikiEditorModeSwitchPopupButtonWidget, OO.ui.PopupButtonWidget),
        this.controller.applyLinkSuggest(t)
    WikiEditorModeSwitchPopupButtonWidget.prototype.hidePopup = function() {
    }
        this.getPopup().toggle(!1)
    ,
    }
    LinkSuggestPopupWidget.prototype.updatePositionIfOutsideOfViewport = function() {
    ,
        var e = this.$element.get(0).getBoundingClientRect()
    OO.inheritClass(CodeEditorModeSwitchPopupButtonWidget, OO.ui.PopupButtonWidget),
          , t = e.left
    mw.hook("wikiEditor.toolbarReady").add(initLinkSuggest).add(postSetupInit);
          , i = e.right
          , o = e.width;
        window.innerWidth < i && (this.$anchor.css({
            left: "auto",
            right: 12
        }),
        this.$element.css({
            left: t - o
        }))
    }
    ,
    OO.inheritClass(WikiEditorModeSwitchPopupButtonWidget, OO.ui.PopupButtonWidget),
    WikiEditorModeSwitchPopupButtonWidget.prototype.hidePopup = function() {
        this.getPopup().toggle(!1)
    }
    ,
    OO.inheritClass(CodeEditorModeSwitchPopupButtonWidget, OO.ui.PopupButtonWidget),
    mw.hook("wikiEditor.toolbarReady").add(initLinkSuggest).add(postSetupInit);
    });
    });

    Aktuelle Version vom 5. Februar 2026, 09:34 Uhr

    $(document).ready(function() {
    	mw.loader.using(["oojs-ui", "jquery"]).done(function() {
    		var _create_class = {
    			_class_call_check: function(e, r) {
    	            if (!(e instanceof r))
    	                throw new TypeError("Cannot call a class as a function")
    	        },
    			_defineProperties: function(e, r) {
    			    for (var a = 0; a < r.length; a++) {
    			        var c = r[a];
    			        c.enumerable = c.enumerable || !1,
    			        c.configurable = !0,
    			        "value"in c && (c.writable = !0),
    			        Object.defineProperty(e, c.key, c)
    			    }
    			},
    			 _create_class: function(e, r, a) {
    			    return r && this._defineProperties(e.prototype, r),
    			    a && this._defineProperties(e, a),
    			    e
    			}
    		};
    		
    		var _define_property = {
    			_define_property: function(e, r, o) {
    	            return r in e ? Object.defineProperty(e, r, {
    	                value: o,
    	                enumerable: !0,
    	                configurable: !0,
    	                writable: !0
    	            }) : e[r] = o,
    	            e
    	        }	
    		};
    		var SET_LINK_SUGGESTIONS = "SET_LINK_SUGGESTIONS"
    		  , CLOSE_LINK_SUGGESTIONS = "CLOSE_LINK_SUGGESTIONS"
    		  , HIGHLIGHTED_SUGGESTION_CHANGED = "HIGHLIGHTED_SUGGESTION_CHANGED";
    		function LinkSuggestModel(e) {
    		    OO.EventEmitter.call(this),
    		    this.isCodeMirrorActive = e,
    		    this.linkSuggestions = [],
    		    this.query = {},
    		    this.highlightedSuggestionIndex = -1
    		}
    		OO.initClass(LinkSuggestModel),
    		OO.mixinClass(LinkSuggestModel, OO.EventEmitter),
    		LinkSuggestModel.prototype.setCodeMirrorActive = function(e) {
    		    this.isCodeMirrorActive = e
    		}
    		,
    		LinkSuggestModel.prototype.setLinkSuggestQuery = function(e, t) {
    		    this.query = e,
    		    this.linkSuggestions = t,
    		    this.highlightedSuggestionIndex = -1,
    		    this.emit(SET_LINK_SUGGESTIONS)
    		}
    		,
    		LinkSuggestModel.prototype.highlightNextSuggestion = function() {
    		    this.highlightedSuggestionIndex === this.linkSuggestions.length - 1 ? this.highlightedSuggestionIndex = -1 : this.highlightedSuggestionIndex++,
    		    this.emit(HIGHLIGHTED_SUGGESTION_CHANGED)
    		}
    		,
    		LinkSuggestModel.prototype.highlightPreviousSuggestion = function() {
    		    -1 === this.highlightedSuggestionIndex ? this.highlightedSuggestionIndex = this.linkSuggestions.length - 1 : this.highlightedSuggestionIndex--,
    		    this.emit(HIGHLIGHTED_SUGGESTION_CHANGED)
    		}
    		,
    		LinkSuggestModel.prototype.closeLinkSuggestions = function() {
    		    this.highlightedSuggestionIndex = -1,
    		    this.linkSuggestions = [],
    		    this.emit(CLOSE_LINK_SUGGESTIONS)
    		}
    		;
    		var LinkSuggestController = function() {
    		    function e(t, i, o, n) {
    		        var r = this;
    		        _create_class._class_call_check(this, e),
    		        _define_property._define_property(this, "debouncedPerformLinkSuggestQuery", OO.ui.debounce(this.performLinkSuggestQuery.bind(this), 300)),
    		        _define_property._define_property(this, "handleKeydown", (function(e) {
    		            var t = e.key
    		              , i = r.model
    		              , o = i.linkSuggestions
    		              , n = i.highlightedSuggestionIndex
    		              , s = i.query.originalContent;
    		            if (!!o.length) {
    		                if ("ArrowDown" === t)
    		                    return e.preventDefault(),
    		                    r.model.highlightNextSuggestion(),
    		                    !0;
    		                if ("ArrowUp" === t)
    		                    return e.preventDefault(),
    		                    r.model.highlightPreviousSuggestion(),
    		                    !0;
    		                if ("Enter" === t && -1 !== n) {
    		                    e.preventDefault();
    		                    var a = o[n]
    		                      , d = index$1.getContentForSuggestions({
    		                        suggestion: a,
    		                        originalContent: s
    		                    }).textToInsert;
    		                    return r.applyLinkSuggest(d),
    		                    !0
    		                }
    		                if ("Esc" === t || "Escape" === t)
    		                    return e.preventDefault(),
    		                    r.model.closeLinkSuggestions(),
    		                    !0
    		            }
    		            r.debouncedPerformLinkSuggestQuery()
    		        }
    		        )),
    		        this.model = t,
    		        this.$textbox = i,
    		        this.api = o,
    		        this.pageLanguageHasWordBreaks = n
    		    }
    		    return _create_class._create_class(e, [{
    		        key: "applyLinkSuggest",
    		        value: function(e) {
    		            var t = this.model.query
    		              , i = t.startOffset
    		              , o = t.wasTemplateTransclusion
    		              , n = this.$textbox.textSelection("getCaretPosition")
    		              , r = o ? "}}" : "]]"
    		              , s = 1 + i + e.length + r.length;
    		            this.$textbox.textSelection("setSelection", {
    		                start: 1 + i,
    		                end: n
    		            }).textSelection("replaceSelection", e + r).textSelection("setSelection", {
    		                start: s,
    		                end: s
    		            }),
    		            this.model.closeLinkSuggestions()
    		        }
    		    }, {
    		        key: "performLinkSuggestQuery",
    		        value: function() {
    		            var e = this
    		              , t = this.$textbox.textSelection("getContents")
    		              , i = this.$textbox.textSelection("getCaretPosition")
    		              , o = this.pageLanguageHasWordBreaks ? 4 : 1
    		              , n = index$1.getLinkSuggestQueryFromText(t, i, o);
    		            if (!n || n.content.length < o || n.content.includes("|"))
    		                this.model.closeLinkSuggestions();
    		            else {
    		                var r = n.content.includes("|");
    		                this.api.get({
    		                    action: "linksuggest",
    		                    get: "suggestions",
    		                    query: n.content
    		                }).then((function(t) {
    		                    var i = t.linksuggest.result.suggestions;
    		                    i.length && !r ? e.model.setLinkSuggestQuery(n, i) : e.model.closeLinkSuggestions()
    		                }
    		                ))
    		            }
    		        }
    		    }, {
    		        key: "setLinkSuggestEventHandlers",
    		        value: function() {
    		            var e = this
    		              , t = this.model.isCodeMirrorActive;
    		            this.model.closeLinkSuggestions(),
    		            t ? mw.loader.using(["ext.CodeMirror.v6", "ext.CodeMirror.v6.mode.mediawiki"], (function(t) {
    		                var i = t("ext.CodeMirror.v6.lib")
    		                  , o = i.EditorView
    		                  , n = i.StateEffect
    		                  , r = i.Prec;
    		                e.$textbox.off("keydown.linksuggest");
    		                var s = o.domEventHandlers({
    		                    keydown: function(t, i) {
    		                        return e.handleKeydown(t)
    		                    }
    		                });
    		                mw.hook("ext.CodeMirror.ready").add((function(e, t) {
    		                    t.view.dispatch({
    		                        effects: n.appendConfig.of(r.high(s))
    		                    })
    		                }
    		                ))
    		            }
    		            )) : this.addLinkSuggestWithoutSyntaxHighlighting()
    		        }
    		    }, {
    		        key: "addLinkSuggestWithoutSyntaxHighlighting",
    		        value: function() {
    		            this.$textbox.on("keydown.linksuggest", this.handleKeydown)
    		        }
    		    }, {
    		        key: "updateCodeMirrorState",
    		        value: function(e) {
    		            var t = this;
    		            this.model.setCodeMirrorActive(e),
    		            setTimeout((function() {
    		                return t.setLinkSuggestEventHandlers()
    		            }
    		            ))
    		        }
    		    }]),
    		    e
    		}();
    		function LinkSuggestPopupWidget(e, t, i, o) {
    		    var n;
    		    this.model = e,
    		    this.controller = t,
    		    this.$textbox = i,
    		    this.codeMirrorInstance = null,
    		    this.$caretCoordinateCalculator = o,
    		    this.textboxLineHeight = i.css("line-height"),
    		    this.debouncedUpdatePosition = OO.ui.debounce(this.updatePosition.bind(this), 300),
    		    this.model.connect(this, (n = {},
    		    _define_property._define_property(n, SET_LINK_SUGGESTIONS, "onLinkSuggestionsSet"),
    		    _define_property._define_property(n, CLOSE_LINK_SUGGESTIONS, "onCloseLinkSuggestions"),
    		    _define_property._define_property(n, HIGHLIGHTED_SUGGESTION_CHANGED, "onHighlightedSuggestionChanged"),
    		    n)),
    		    this.selectWidget = new OO.ui.SelectWidget,
    		    this.selectWidget.connect(this, {
    		        choose: "onSuggestionSelected"
    		    }),
    		    LinkSuggestPopupWidget.super.call(this, {
    		        $content: this.selectWidget.$element,
    		        padded: !1,
    		        autoFlip: !1,
    		        hideWhenOutOfView: !1
    		    }),
    		    this.$element.addClass("wikiEditor-ui-linkSuggest"),
    		    this.$popup.addClass("wikiEditor-ui-linkSuggest-popup"),
    		    this.toggle(!1),
    		    this.$textbox.on("scroll", this.debouncedUpdatePosition),
    		    $(document).on("scroll", this.debouncedUpdatePosition)
    		}
    		function WikiEditorModeSwitchPopupButtonWidget(e) {
    		    var t = new OO.ui.ButtonWidget({
    		        framed: !1,
    		        label: mw.msg("visualeditor-mweditmodeve-tool-current"),
    		        icon: "eye"
    		    });
    		    t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-visualSwitch"),
    		    t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member"),
    		    t.on("click", e),
    		    t.connect(this, {
    		        click: "hidePopup"
    		    }),
    		    WikiEditorModeSwitchPopupButtonWidget.super.call(this, {
    		        framed: !1,
    		        indicator: "down",
    		        popup: {
    		            containerPadding: 0,
    		            $content: t.$element,
    		            width: null
    		        },
    		        icon: "wikiText",
    		        label: mw.msg("visual-editor-fandom-switch-dropdown-mode-source-label")
    		    }),
    		    this.$element.addClass("ve-ui-modeSwitchPopupButtonWidget ve-ui-modeSwitchPopupButtonWidget-fd ve-header-action-item"),
    		    this.$button.attr("id", "ve-ui-modeSwitchPopupButtonWidget-button"),
    		    this.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-button"),
    		    this.popup.$popup.addClass("ve-ui-modeSwitchPopupButtonWidget-popup")
    		}
    		function CodeEditorModeSwitchPopupButtonWidget(e) {
    		    var t = new OO.ui.ButtonWidget({
    		        framed: !1,
    		        label: mw.msg("visualeditor-mweditmodeve-tool-current"),
    		        icon: "eye",
    		        href: e.href
    		    });
    		    t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-visualSwitch"),
    		    t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member");
    		    var i = new OO.ui.ButtonWidget({
    		        framed: !1,
    		        label: mw.msg("visualeditor-mweditmodesource-tool-current"),
    		        icon: "wikiText"
    		    });
    		    i.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-sourceSwitch"),
    		    i.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member"),
    		    i.setDisabled(!0);
    		    var o = t.$element.add(i.$element);
    		    CodeEditorModeSwitchPopupButtonWidget.super.call(this, {
    		        framed: !1,
    		        indicator: "down",
    		        popup: {
    		            containerPadding: 0,
    		            $content: o,
    		            width: null
    		        },
    		        icon: "wikiText",
    		        label: mw.msg("visual-editor-fandom-switch-dropdown-mode-source-label")
    		    }),
    		    this.$element.addClass("ve-ui-modeSwitchPopupButtonWidget ve-ui-modeSwitchPopupButtonWidget-fd ve-header-action-item"),
    		    this.$button.attr("id", "ve-ui-modeSwitchPopupButtonWidget-button"),
    		    this.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-button"),
    		    this.popup.$popup.addClass("ve-ui-modeSwitchPopupButtonWidget-popup")
    		}
    		function initLinkSuggest(e) {
    		    var t = !mw.user.options.get("disablelinksuggest")
    		      , i = "wikitext" === mw.config.get("wgPageContentModel");
    		    if (t && i) {
    		        var o = mw.user.options.get("usecodemirror") > 0
    		          , n = mw.config.get("wgPageLanguageHasWordBreaks")
    		          , r = new mw.Api
    		          , s = new LinkSuggestModel(o)
    		          , a = new LinkSuggestController(s,e,r,n)
    		          , d = $("<div />").css({
    		            position: "absolute",
    		            top: "-2000px",
    		            left: "-2000px",
    		            visibility: "hidden",
    		            "white-space": "pre-wrap",
    		            "font-family": e.css("font-family"),
    		            "font-size": e.css("font-size"),
    		            "line-height": e.css("line-height")
    		        }).appendTo(document.body)
    		          , u = new LinkSuggestPopupWidget(s,a,e,d);
    		        $(".wikiEditor-ui-text").prepend(u.$element),
    		        mw.hook("ext.CodeMirror.switch").add((function(e) {
    		            a.updateCodeMirrorState(e),
    		            u.setCodeMirrorInstance(e)
    		        }
    		        )),
    		        setTimeout((function() {
    		            return a.addLinkSuggestWithoutSyntaxHighlighting()
    		        }
    		        ))
    		    }
    		}
    		function postSetupInit() {
    		    $(".mw-indicators").prependTo("#wikiPreview .mw-parser-output"),
    		    $(".page-footer__categories").appendTo("#wikiPreview .mw-parser-output"),
    		    mw.hook("ext.CodeMirror.initialize").add((function(e) {
    		        "submit" === mw.config.get("wgAction") && window.scrollTo({
    		            top: 0
    		        })
    		    }
    		    ))
    		}
    		OO.inheritClass(LinkSuggestPopupWidget, OO.ui.PopupWidget),
    		LinkSuggestPopupWidget.prototype.onLinkSuggestionsSet = function() {
    		    var e = this.model
    		      , t = e.linkSuggestions
    		      , i = e.query.originalContent;
    		    if (t.length) {
    		        this.selectWidget.clearItems();
    		        var o = t.map((function(e) {
    		            var t = index$1.getContentForSuggestions({
    		                suggestion: e,
    		                originalContent: i
    		            })
    		              , o = t.textToInsert
    		              , n = t.textToDisplay
    		              , r = new OO.ui.OptionWidget({
    		                data: o,
    		                label: n
    		            });
    		            return r.$element.addClass("wikiEditor-ui-linkSuggest-suggestion"),
    		            r
    		        }
    		        ));
    		        this.selectWidget.addItems(o),
    		        this.toggle(!0),
    		        this.updatePosition(),
    		        this.model.isCodeMirrorActive && (this.toggle(!1),
    		        this.toggleClipping(!1),
    		        this.position(),
    		        this.toggleClipping(!0),
    		        this.toggle(!0)),
    		        this.updatePositionIfOutsideOfViewport()
    		    } else
    		        this.toggle(!1)
    		}
    		,
    		LinkSuggestPopupWidget.prototype.onCloseLinkSuggestions = function() {
    		    this.toggle(!1),
    		    this.$element.addClass("oo-ui-element-hidden"),
    		    this.selectWidget.clearItems()
    		}
    		,
    		LinkSuggestPopupWidget.prototype.computePosition = function() {
    		    var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
    		    LinkSuggestPopupWidget.super.prototype.computePosition.call(this),
    		    this.$anchor.css({
    		        left: 12
    		    });
    		    var t = null != e ? e : this.getCaretPosition()
    		      , i = t.top
    		      , o = t.left;
    		    return {
    		        position: "fixed",
    		        top: "".concat(i, "px"),
    		        left: "".concat(o, "px"),
    		        "margin-top": this.textboxLineHeight
    		    }
    		}
    		,
    		LinkSuggestPopupWidget.prototype.getCaretPosition = function() {
    		    var e = this.model
    		      , t = e.isCodeMirrorActive
    		      , i = e.query.startOffset;
    		    if (t) {
    		        var o = this.codeMirrorInstance.view.state.selection.main.head;
    		        return this.codeMirrorInstance.view.coordsAtPos(o)
    		    }
    		    var n = this.$textbox.textSelection("getContents")
    		      , r = this.$textbox.textSelection("getCaretPosition")
    		      , s = $("<span />").text(n.substring(i, r));
    		    this.$caretCoordinateCalculator.width(this.$textbox[0].scrollWidth).text(n.substring(0, i)).append(s);
    		    var a = this.$textbox.offset()
    		      , d = a.top
    		      , u = a.left
    		      , c = s.position()
    		      , l = c.top
    		      , g = c.left
    		      , p = s.width()
    		      , h = this.$textbox.scrollTop()
    		      , m = this.$textbox.scrollLeft();
    		    return {
    		        top: d + l - h - window.scrollY,
    		        left: u + g + p - m - window.scrollX
    		    }
    		}
    		,
    		LinkSuggestPopupWidget.prototype.updatePosition = function() {
    		    var e = this.getCaretPosition();
    		    if (this.toggleClipping(!1),
    		    this.position(),
    		    this.toggleClipping(!0),
    		    this.selectWidget.items.length) {
    		        var t, i;
    		        this.$element.css(this.computePosition(e));
    		        var o = null !== (i = null === (t = this.codeMirrorInstance) || void 0 === t ? void 0 : t.view.dom.getBoundingClientRect()) && void 0 !== i ? i : this.$textbox[0].getBoundingClientRect()
    		          , n = e.top >= o.top && e.top <= o.bottom;
    		        this.toggle(n)
    		    }
    		}
    		,
    		LinkSuggestPopupWidget.prototype.setCodeMirrorInstance = function(e) {
    		    var t = this;
    		    e ? mw.loader.using(["ext.CodeMirror.v6", "ext.CodeMirror.v6.mode.mediawiki"], (function(e) {
    		        var i = e("ext.CodeMirror.v6.lib")
    		          , o = i.EditorView
    		          , n = i.StateEffect;
    		        t.$textbox.off("keydown.linksuggest");
    		        var r = o.domEventHandlers({
    		            scroll: function(e, i) {
    		                return t.debouncedUpdatePosition()
    		            }
    		        });
    		        mw.hook("ext.CodeMirror.ready").add((function(e, i) {
    		            t.codeMirrorInstance = i,
    		            t.codeMirrorInstance.view.dispatch({
    		                effects: n.appendConfig.of(r)
    		            })
    		        }
    		        ))
    		    }
    		    )) : this.codeMirrorInstance = null
    		}
    		,
    		LinkSuggestPopupWidget.prototype.onHighlightedSuggestionChanged = function() {
    		    var e = this.model.highlightedSuggestionIndex;
    		    if (-1 === e)
    		        this.selectWidget.highlightItem();
    		    else {
    		        var t = this.selectWidget.items[e];
    		        this.selectWidget.highlightItem(t)
    		    }
    		}
    		,
    		LinkSuggestPopupWidget.prototype.onSuggestionSelected = function(e) {
    		    var t = e.getData();
    		    this.controller.applyLinkSuggest(t)
    		}
    		,
    		LinkSuggestPopupWidget.prototype.updatePositionIfOutsideOfViewport = function() {
    		    var e = this.$element.get(0).getBoundingClientRect()
    		      , t = e.left
    		      , i = e.right
    		      , o = e.width;
    		    window.innerWidth < i && (this.$anchor.css({
    		        left: "auto",
    		        right: 12
    		    }),
    		    this.$element.css({
    		        left: t - o
    		    }))
    		}
    		,
    		OO.inheritClass(WikiEditorModeSwitchPopupButtonWidget, OO.ui.PopupButtonWidget),
    		WikiEditorModeSwitchPopupButtonWidget.prototype.hidePopup = function() {
    		    this.getPopup().toggle(!1)
    		}
    		,
    		OO.inheritClass(CodeEditorModeSwitchPopupButtonWidget, OO.ui.PopupButtonWidget),
    		mw.hook("wikiEditor.toolbarReady").add(initLinkSuggest).add(postSetupInit);
    	});
    });