2023年政策修订增补工作正在进行中,欢迎参与!
  • Moegirl.ICU:萌娘百科流亡社群 581077156(QQ),欢迎对萌娘百科运营感到失望的编辑者加入
  • Moegirl.ICU:账号认领正在试运行,有意者请参照账号认领流程

MediaWiki:Vector.js

萌娘百科,万物皆可萌的百科全书!转载请标注来源页面的网页链接,并声明引自萌娘百科。内容不可商用。
跳转到导航 跳转到搜索

注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox/Safari:按住“Shift”的同时单击“刷新”,或按“Ctrl-F5”或“Ctrl-R”(Mac为“⌘-R”)
  • Google Chrome:按“Ctrl-Shift-R”(Mac为“⌘-Shift-R”)
  • Internet Explorer:按住“Ctrl”的同时单击“刷新”,或按“Ctrl-F5”
  • Opera:在“工具→首选项”中清除缓存
如果您已登录但该页面出现未登录状态,请尝试在地址栏的地址最后添加代码?_=1来访问最新页面。
添加代码后的本页地址如下:-{R|https://moegirl.icu/MediaWiki:Vector.js?_=1}-
引用api时用mw.loader.using(["mediawiki.api"]),引用uri时用mw.loader.using(["mediawiki.Uri"])
萌娘百科界面管理员团队提醒您
大萌字-InterfaceAdmin.png
本页面由萌娘百科界面管理员团队在其 GitHub 库内进行维护,通过机器人自动生成可被 MediaWiki Gadget 扩展接受的版本并保存到此处。 如果您有任何意见或建议,建议您到技术实现版提出。
/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/global/zh/MediaWiki:Vector.js|user=[[U:BearBin]]|co-authors=|longId=4092c0a7024d50981ef02f93b12d5ad324381227|shortId=4092c0a7|summary=fix: 将zh/mzh/mobile跳转修复功能增加至萌皮网页}}'; 

/* <pre> */

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (g && (g = 0, op[0] && (_ = 0)), _) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
(function () { return __awaiter(void 0, void 0, void 0, function () {
    var startScroll, autoScroll;
    return __generator(this, function (_a) {
        switch (_a.label) {
            case 0:
                startScroll = function () {
                    $("body > #content > #siteNotice .scrollDiv:not(.scrolling), #moe-sitenotice-container > .moe-sitenotice .scrollDiv:not(.scrolling)").addClass("scrolling").each(function (_, ele) {
                        var self = $(ele);
                        self.children().each(function (_, child) {
                            if (child.innerHTML.trim() === "") {
                                child.remove();
                            }
                        });
                        var children = self.children();
                        if (children.length === 0) {
                            return;
                        }
                        var firstChild = children.first();
                        var firstChildHeight = firstChild.outerHeight();
                        self.height(firstChildHeight);
                        children.slice(1).css("top", "".concat(Math.ceil(firstChildHeight), "px"));
                        firstChild.css("top", "0");
                    });
                };
                autoScroll = function () {
                    setInterval(function () {
                        if (!document.hidden) {
                            $("body > #content > #siteNotice .scrollDiv.scrolling, #moe-sitenotice-container > .moe-sitenotice .scrollDiv.scrolling").each(function (_, ele) {
                                var self = $(ele);
                                if (self.css("font-weight") === "700") {
                                    return;
                                }
                                var children = self.children();
                                var all = self.add(children);
                                if (children.length === 1) {
                                    return;
                                }
                                var firstChild = children.first();
                                var firstChildHeight = firstChild.outerHeight();
                                var secondChild = firstChild.next();
                                var secondChildHeight = secondChild.outerHeight();
                                var otherChild = children.slice(2);
                                var maxHeight = Math.max(firstChildHeight, secondChildHeight);
                                otherChild.each(function (_, child) {
                                    maxHeight = Math.max(maxHeight, $(child).outerHeight());
                                });
                                all.addClass("animation");
                                self.height(maxHeight);
                                firstChild.css("top", "-".concat(firstChildHeight, "px"));
                                secondChild.css("top", "".concat((maxHeight - secondChildHeight) / 2, "px"));
                                otherChild.css("top", "".concat(Math.ceil(maxHeight), "px"));
                                setTimeout(function () {
                                    all.removeClass("animation");
                                    firstChild.appendTo(self).css("top", Math.ceil(maxHeight));
                                }, 400);
                            });
                        }
                    }, 5000);
                };
                return [4, $.ready];
            case 1:
                _a.sent();
                startScroll();
                autoScroll();
                return [2];
        }
    });
}); })(); 

/* </pre> */